[vtk filters into blender - blender

I'm trying to import vtk into Blender to use specific filters. I'm facing some difficulties since Blender is not able to find, and subsequently to use any filter.
Here is the situation:
I've build VTK including the python wrapping. I have DLLs and *.py libraries.
I have created PYTHONPATH and added both Wrapping\python and VTK\Release directories. Python 2.7 has been used to generate *.py VTK libraries. The python 3.4 interpreter (and blender since my version is using a python V3.4 distribution) is able to import the vtk library but gives me an error "Import error: Dynamic module does not define init function(PyInit_vtkCommonCorePython)"
I'm very pessimistic because VTK has been built using python 2.7 and blender uses python 3.4. Python 3.4 canno find the suitable DLL corresponding to the .py since VTK dlls are named "vtkLIBxxx27D-6.1.dll" and specifically dedicated for python 2.7.
Is there a way to force a backward compatibility to blender and its python interpreter to import a python 2.7 library?
Do we have any chance to make vtk (python 2.7) working into blender (python 3.4)?
Thanks for your help.
Laurent.

Blender 2.6 uses Python 3+, while VTK is wrapped for 2.7. The two APIs are incompatible (hence the major version change in Python).
If your aim is to import vtk polydata into Blender, my suggestion is that you save the VTK files as STL or OBJ (you have VTK writers for both) and import them into Blender that way.

I know this answer is a couple of years too late, but Blender and VTK can now use the same Python version, so I've recently updated a script that converts Blender meshes <==> VtkPolyData. If you are interested, the script and a few demos are here:
https://github.com/cwant/VTKBlender
Regards,
Chris

Related

Python error importing dll files while py file import is successful

I have the setup as seen in the attached image:
Both the pyd and functions.py file are defined in the same folder yet the error is only at importing pyd file.
The error is ModuleNotFoundError: No module named marketPriceMarcoPolo
I am not sure what is going on.
Edit:
The pyd file was generated on Python 3.7 and is being used on a PC with Python 3.8 installed. Does it matter?
The pyd file was generated on Python 3.7 and is being used on a PC with Python 3.8 installed. Does it matter?
Yes, it matters. It's in the name of the build (.cp37-amd_win64). That means the extension is built for use with CPython 3.7 64-bit on Windows.
Extensions are linked to an explicit Python version. When you run your script on Python 3.8, it will look for marketPriceMarcoPolo.cp38-win_amd64.pyd instead. Build it with the Python you intend to use it with.

Tensorflow not working on Python 3.7, Mac OS, and Pycharm

Attempting to run tensorflow a Mac, using python 3.7 as well as PyCharm and receiving where module tensorflow has no attribute app, at the following.
I've run through a number of potential solutions. Following the instructions provided on this question: Installing tensorflow on Pycharm (Mac). I've managed to successfully create a virtual-env in which I installed the tensorflow package however this folder contains
nothing but the init.py and pycache and the error remains.
I've also tried copying the contents of the tensorflow GitHub repo directly into this folder but it results in an ImportError.
Not sure what the issue is. Should I switch to python 2.7?
Python 3.7 is still unsupported as of this moment by tensorflow.

Needed help?? installing Tensorflow-GPU for Win 10 Pro 9-2-18

1.Create a new environment through conda create --name tftest. (You can replace tftest with e.g. the name of your current project.)
2.Activate that new environment through activate tftest.
3.Install TF into this environment through conda install tensorflow.
4.Ensure that you're in the right environment through where python (which should produce a path containing "tftest").
5.Run Python through python.
6.import tensorflow as tf in a shell in that environment.
Thanks to great community as I found this thanks to another post!!!
Starting with version 1.6.0, prebuild binaries need AVX instructions.
There are some bug reports by people who tried to use the precompiled binaries but whose doesn't support AVX instructions and got the same error as you posted here:
https://github.com/tensorflow/tensorflow/issues/17761
https://github.com/tensorflow/tensorflow/issues/17386
Maybe you have this problem? If yes, you may have to build tensorflow from sources or downgrade to tensorflow 1.5.1.

Python - program written in Python 3.5.2 also executable on higher python versions?

I've written a program on the python version 3.5.2, because i need a 64 bit version of python for my tensorflow-gpu library.
Its also possible to use the normal tensorflow library, which doese'nt require a 64 bit python, but in my case i wanted to use my gpu.
My question is: If some users have a higher version installed (of python) and use the normal tensorflow library, will they still be able to execute it?
Fabian
It all depends on what code you used, and if the syntax was changed in later versions. For example, if your version of Python uses print "Hello World!" and the user's version is print("Hello World"), then you would have to change it to the later versions specification.

What is the numpy pypi package naming convention

Trying to determine which numpy package is compatible with my python environment. My server has no internet access, so I need to download and install the package locally.
I know the cp27 refers to Python 2.7, but what is the difference between these two packages:
numpy-1.12.0rc1-cp27-cp27m-manylinux1_x86_64.whl
numpy-1.12.0rc1-cp27-cp27mu-manylinux1_x86_64.whl
The differing part is an ABI tag.
mu indicates --enable-unicode=ucs4
m on its own is --enable-unicode=ucs2
See UCS-2 vs UCS-4 builds; to determine which you need for your current installation, see How to find out if Python is compiled with UCS-2 or UCS-4?