nipy / mindboggle

Automated anatomical brain label/shape analysis software (+ website)
http://mindboggle.info
Other
146 stars 54 forks source link

"No module named 'vtk'" error after installing VTK 7 and running Python 3 #73

Closed binarybottle closed 8 years ago

binarybottle commented 8 years ago

After running most of the install_mindboggle.sh script, which installs Miniconda with Python 3, VTK 7, etc., I get the error "No module named 'vtk'" when trying to import vtk in iPython. I couldn't find any options when I cmake'd VTK related to Python. What am I missing?

satra commented 8 years ago

you are building VTK but not ensuring that it's built with python support and installed into a python environment.

i would still suggest installing it directly using conda, instead of building it:

https://anaconda.org/search?q=platform%3Alinux-64+vtk

and if you are going to build it, build with the conda recipe.

binarybottle commented 8 years ago

Thank you! When I copy and paste the lines from install_mindboggle.sh into an ubuntu vm, I am able to import vtk in ipython. However, if I call install_mindboggle.sh from within build_mindboggle.sh, which builds a vm, then vagrant up and vagrant ssh, and finally run mindboggle, I get:

"ImportError: No module named 'vtk'"

satra commented 8 years ago

it's because your environment is likely not using the same python in both cases. you have to study vagrant to understand when things are persistent.

binarybottle commented 8 years ago

So even if I install Python 3 (Miniconda3-latest-$OS-x86_64.sh) and add it to .bash_profile (export PATH=$CONDA_PATH/bin:\$PATH" >> $ENV), it still won't know which Python? Do I need to set PYTHONPATH or something in .bash_profile?

satra commented 8 years ago

for this line:

https://github.com/nipy/mindboggle/blob/master/install/install_mindboggle.sh#L121

you could simply do:

export PATH=$CONDA_PATH/bin:$PATH

it's possible that the source command isn't doing the right thing.

you can also check your python path, right before you do make.

binarybottle commented 8 years ago

Working with the VTK 7.0 (conda install -c https://conda.anaconda.org/clinicalgraphics vtk), the original echo export line, and a few other minor changes. Thank you!!!

cvanelteren commented 7 years ago

Could you enlighten me on what these minor changes are? I used the conda line you mentioned to get vtk installed but when I import it states 'No module named 'vtkCommonCorePython''

binarybottle commented 7 years ago

@GlobalTraveler -- I looked back at the commits on and just prior to April 7th, and the only relevant changes (now that we've moved away from Vagrant + VirtualBox) were made to the install_mindboggle.sh file. We've gotten reports from others that they've used this script to successfully install mindboggle when they couldn't use Docker, but I don't know what the difference might be in their setup. Is there a reason you can't use the Docker container?

cvanelteren commented 7 years ago

I think the issue is with with the vtk setup. I can't seem to be able to build vtk from source forcing it to use python > 3. It complains about something related to tcl not being found (even when I point it to the respective directory). Do you perhaps know if there is a change in tcltk in newer linux kernels ? [I am using ubuntu 17.04]

binarybottle commented 7 years ago

I'm afraid I don't know about tcltk changes, but maybe the following issue's solution may be relevant for your vtk installation problem?:

https://github.com/nipy/mindboggle/issues/109#issuecomment-298560093 containing the link: https://github.com/menpo/conda-vtk

cvanelteren commented 7 years ago

Solved it! For some odd reason the vtk install through clinical graphics does not work properly for me. Downgrading python to 3.5.3 and installing it from the menpo source solved the issue. The link provided above also raised an odd. Regardless, thanks!

srfpala commented 6 years ago

Running Windows 7 with Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) and using Pyscripter as my IDE Added this Environment Variable VTK_BIN D:\Program Files\VTK6.3.0\bin But Pyscripter says No module named vtk Are there instructions that I've missed that explain what needs to be done ? Bob

PeerHerholz commented 6 years ago

Hey @srfpala,

unfortunately, I don't have any experience working with python, etc. on windows. Hence, only some general pointers (not dealing with any possible specific things related to windows):

HTH, best, Peer