首先说一下我的配置,ubuntu20.04,python3.6(虚拟环境)
完整报错:
Building wheels for collected packages: mayavi
Building wheel for mayavi (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/liong/anaconda3/envs/py36/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-le1pjsip
cwd: /tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/
Complete output (33 lines):
running bdist_wheel
running build
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/setup.py", line 464, in <module>
**config
File "/home/liong/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
File "/home/liong/anaconda3/envs/py36/lib/python3.6/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/home/liong/anaconda3/envs/py36/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/liong/anaconda3/envs/py36/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/home/liong/anaconda3/envs/py36/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/liong/anaconda3/envs/py36/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/home/liong/anaconda3/envs/py36/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/liong/anaconda3/envs/py36/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/setup.py", line 268, in run
build_tvtk_classes_zip()
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/setup.py", line 254, in build_tvtk_classes_zip
gen_tvtk_classes_zip()
File "tvtk/setup.py", line 82, in gen_tvtk_classes_zip
from tvtk.code_gen import TVTKGenerator
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/tvtk/code_gen.py", line 30, in <module>
from .common import get_tvtk_name, camel2enthought
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/tvtk/common.py", line 10, in <module>
import vtk
ModuleNotFoundError: No module named 'vtk'
----------------------------------------
ERROR: Failed building wheel for mayavi
Running setup.py clean for mayavi
Failed to build mayavi
Installing collected packages: traits, pyface, traitsui, configobj, apptools, vtk, envisage, mayavi
Running setup.py install for mayavi ... error
ERROR: Command errored out with exit status -11:
command: /home/liong/anaconda3/envs/py36/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-88gff1ct/install-record.txt --single-version-externally-managed --compile --install-headers /home/liong/anaconda3/envs/py36/include/python3.6m/mayavi
cwd: /tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/
Complete output (93 lines):
running install
running build
----------------------------------------------------------------------
Deleting possibly old TVTK classes
Building TVTK classes... vtkAnimationCue: Ignoring method: Get/SetDirection
default: 1, range: None
vtkContextDevice2D: Ignoring method: Get/SetViewportRect
default: [1041433776, 32616, 1041433776, 32616], range: None
vtkContextDevice2D: Ignoring method: Get/SetViewportSize
default: [1041433776, 32616], range: None
vtkEventDataForDevice: Ignoring method: Get/SetAction
default: -1, range: None
vtkEventDataForDevice: Ignoring method: Get/SetDevice
default: -1, range: None
vtkFXAAOptions: Ignoring method: Get/SetDebugOptionValue
default: 0, range: None
vtkIncrementalForceLayout: Ignoring method: Get/SetGravityPoint
default: [200.0, 200.0], range: None
vtkOpenGLBufferObject: Ignoring method: Get/SetType
default: 0, range: None
vtkOpenGLFXAAFilter: Ignoring method: Get/SetDebugOptionValue
default: 0, range: None
vtkRenderWidget: Ignoring method: Get/SetPosition
default: [0, 0], range: None
vtkRenderWidget: Ignoring method: Get/SetSize
default: [300, 300], range: None
vtkShader: Ignoring method: Get/SetType
default: 3, range: None
vtkVolumeTexture: Ignoring method: Get/SetPartitions
default: [1, 1, 1], range: None
vtkChartMatrix: Ignoring method: Get/SetFillStrategy
default: 0, range: None
vtkChartMatrix: Ignoring method: Get/SetGutter
default: [15.0, 15.0], range: None
vtkChartMatrix: Ignoring method: Get/SetRect
default: [0, 0, 100, 100], range: None
vtkChartMatrix: Ignoring method: Get/SetSize
default: [0, 0], range: None
vtkContextArea: Ignoring method: Get/SetDrawAreaBounds
default: [0.0, 0.0, 300.0, 300.0], range: None
vtkContextArea: Ignoring method: Get/SetDrawAreaResizeBehavior
default: 0, range: None
vtkContextArea: Ignoring method: Get/SetFixedMargins
default: [0, 0, 0, 0], range: None
vtkContextArea: Ignoring method: Get/SetFixedRect
default: [0, 0, 300, 300], range: None
vtkContextArea: Ignoring method: Get/SetGeometry
default: [0, 0, 300, 300], range: None
vtkImplicitProjectOnPlaneDistance: Ignoring method: Get/SetNorm
default: 2, range: None
vtkOpenGLVertexBufferObject: Ignoring method: Get/SetCoordShiftAndScaleMethod
default: 0, range: None
vtkSimple3DCirclesStrategy: Ignoring method: Get/SetMarkedValue
default: (invalid), range: None
vtkArrayNorm: Ignoring method: Get/SetWindow
default: [0, 9223372036854775807), range: None
vtkChart: Ignoring method: Get/SetSize
default: [0.0, 0.0, 0.0, 0.0], range: None
vtkChartXYZ: Ignoring method: Get/SetAxisColor
default: [0, 0, 0, 255], range: None
vtkEuclideanClusterExtraction: Radius not updatable (VTK 9.1 bug - value not properly initialized)
Warning: We cannot determine the trait type of vtkHigherOrderHexahedron.Order
Warning: We cannot determine the trait type of vtkHigherOrderQuadrilateral.Order
Warning: We cannot determine the trait type of vtkHigherOrderWedge.Order
vtkHyperTreeGridPreConfiguredSource: Ignoring method: Get/SetCustomArchitecture
default: 0, range: None
vtkHyperTreeGridPreConfiguredSource: Ignoring method: Get/SetHTGMode
default: 0, range: None
Fatal Python error: Segmentation fault
Current thread 0x00007f683ef6a340 (most recent call first):
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/tvtk/vtk_parser.py", line 705 in _find_get_set_methods
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/tvtk/vtk_parser.py", line 488 in _organize_methods
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/tvtk/vtk_parser.py", line 154 in parse
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/tvtk/wrapper_gen.py", line 341 in _gen_methods
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/tvtk/wrapper_gen.py", line 242 in generate_code
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/tvtk/code_gen.py", line 235 in _write_wrapper_class
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/tvtk/code_gen.py", line 142 in generate_code
File "tvtk/setup.py", line 98 in gen_tvtk_classes_zip
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/setup.py", line 254 in build_tvtk_classes_zip
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/setup.py", line 268 in run
File "/home/liong/anaconda3/envs/py36/lib/python3.6/distutils/dist.py", line 974 in run_command
File "/home/liong/anaconda3/envs/py36/lib/python3.6/distutils/cmd.py", line 313 in run_command
File "/home/liong/anaconda3/envs/py36/lib/python3.6/distutils/command/install.py", line 545 in run
File "/home/liong/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/distutils/command/install.py", line 34 in setuptools_run
File "/home/liong/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/distutils/command/install.py", line 60 in run
File "/home/liong/anaconda3/envs/py36/lib/python3.6/distutils/dist.py", line 974 in run_command
File "/home/liong/anaconda3/envs/py36/lib/python3.6/distutils/dist.py", line 955 in run_commands
File "/home/liong/anaconda3/envs/py36/lib/python3.6/distutils/core.py", line 148 in setup
File "/home/liong/anaconda3/envs/py36/lib/python3.6/site-packages/setuptools/__init__.py", line 153 in setup
File "/home/liong/anaconda3/envs/py36/lib/python3.6/site-packages/numpy/distutils/core.py", line 169 in setup
File "/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/setup.py", line 464 in <module>
File "<string>", line 1 in <module>
----------------------------------------
ERROR: Command errored out with exit status -11: /home/liong/anaconda3/envs/py36/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_et2d_88/mayavi_a1f30e0a23134f7dbea3e5e1300e7415/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-88gff1ct/install-record.txt --single-version-externally-managed --compile --install-headers /home/liong/anaconda3/envs/py36/include/python3.6m/mayavi Check the logs for full command output.
我查了很多都是关于windows的,直接去一个网站下载对应的whl文件,很少有ubuntu的解决方法。因为我之前手动下载了vtk-7.1,我一直以为我的vtk就是7.1了,结果就试着常尝试了一下下载vtk-8.1.2发现我默认安装的9.2.6,我也不清楚为什么会有两个版本,好像还没冲突,于是乎:
pip install vtk==8.1.2
直接就装上了,然后再用最原始的方法
pip install mayavi
就突然成了,以前用python3.8环境的时候好像这个库都是秒装的。。。记录以下解决的历程吧。