简体   繁体   中英

vtk with python 3.6, Anaconda 4.4

I am having the following error when I run vtk with python through anaconda

root@user:~# conda install -c clinicalgraphics vtk=7.1.0
Fetching package metadata ...........
Solving package specifications: .

# All requested packages already installed.
# packages in environment at /home/user/anaconda3:
#
vtk                       7.1.0                    py36_3    clinicalgraphics
root@user~# python
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:09:58) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
Traceback (most recent call last):
  File "/home/user/anaconda3/lib/python3.6/site-packages/vtk/vtkCommonCore.py", line 5, in <module>
    from .vtkCommonCorePython import *
ImportError: /home/user/anaconda3/lib/python3.6/site-packages/vtk/../../../libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/user/anaconda3/lib/python3.6/site-packages/vtk/../../../libvtkCommonCorePython36D-7.1.so.1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/lib/python3.6/site-packages/vtk/__init__.py", line 41, in <module>
    from .vtkCommonCore import *
  File "/home/user/anaconda3/lib/python3.6/site-packages/vtk/vtkCommonCore.py", line 9, in <module>
    from vtkCommonCorePython import *
ModuleNotFoundError: No module named 'vtkCommonCorePython'

I tried using the solution presented in Install vtk with python 3.6 and No module ImportError , they don't seem to work. Surprisingly, I don't face this issue in my Windows distribution. Any alternate suggestion are welcome. I am really trying to avoid downgrading from Python3 to Python2 or using a separate conda environment just for vtk..but if end up doing so...I guess I have to make that work. I tried linking the library of my own build of vtk 8...that doesn't seem to work as well

So I did end up creating a new environment based on menpo vtk=7 python=3 using the following commands

root@user:~# conda create --name VTKpythonENV python=3
   .......
root@user:~# conda install -n VTKpythonENV -c menpo vtk=7 python=3
..........
root@user:~# source activate VTKpythonENV
(VTKpythonENV) root@user:~# python
Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 13:51:32) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk

This works for me but other suggestions using clinical graphics vtk are also welcome

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM