当我尝试正常安装Mayavi时
pip3 install mayavi
出现错误
ERRROR: Failed building wheel for mayavi
,并且不会安装。奇怪的是,如果我使用以下方式创建虚拟环境
python3 -m venv venv
进入virtualenv然后安装pip3,不会出现任何错误,并且一切正常。我认为与vtk一起使用的滚轮设置存在一些问题,但我对它的了解还不足以弄清导致此问题的原因。如果我可以在如何确定问题原因上获得帮助,那将是很棒的。我在下面发布了一个完整的错误供参考。万一有人问为什么我不只是使用venv,我想将整个环境放在没有venv的docker容器中工作。
rob@taqueria:/# pip3 install mayavi
Collecting mayavi
Using cached https://files.pythonhosted.org/packages/08/ea/eb808cb4df8f92bc4d9f9a1ef14566b9b5d60370e6ecbaf9061cdae335fa/mayavi-4.7.1.tar.bz2
Requirement already satisfied: apptools in /usr/local/lib/python3.6/dist-packages (from mayavi) (4.5.0)
Requirement already satisfied: envisage in /usr/local/lib/python3.6/dist-packages (from mayavi) (4.8.0)
Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from mayavi) (1.17.3)
Requirement already satisfied: pyface>=6.1.1 in /usr/local/lib/python3.6/dist-packages (from mayavi) (6.1.2)
Requirement already satisfied: pygments in /usr/local/lib/python3.6/dist-packages (from mayavi) (2.4.2)
Requirement already satisfied: traits>=4.6.0 in /usr/local/lib/python3.6/dist-packages (from mayavi) (5.1.2)
Requirement already satisfied: traitsui>=6.0.0 in /usr/local/lib/python3.6/dist-packages (from mayavi) (6.1.3)
Requirement already satisfied: vtk in /usr/local/lib/python3.6/dist-packages (from mayavi) (8.1.2)
Requirement already satisfied: configobj in /usr/local/lib/python3.6/dist-packages (from apptools->mayavi) (5.0.6)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from apptools->mayavi) (1.11.0)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from envisage->mayavi) (39.0.1)
Building wheels for collected packages: mayavi
Building wheel for mayavi (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-855msxfa/mayavi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-855msxfa/mayavi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-w7bpqedu --python-tag cp36
cwd: /tmp/pip-install-855msxfa/mayavi/
Complete output (44 lines):
running bdist_wheel
running build
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/vtk/vtkOpenGLKit.py", line 5, in <module>
from .vtkOpenGLKitPython import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-855msxfa/mayavi/setup.py", line 474, in <module>
**config
File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/core.py", line 171, in setup
return old_setup(**new_attr)
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/dist-packages/wheel/bdist_wheel.py", line 192, in run
self.run_command('build')
File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-855msxfa/mayavi/setup.py", line 268, in run
build_tvtk_classes_zip()
File "/tmp/pip-install-855msxfa/mayavi/setup.py", line 254, in build_tvtk_classes_zip
gen_tvtk_classes_zip()
File "tvtk/setup.py", line 83, in gen_tvtk_classes_zip
from tvtk.code_gen import TVTKGenerator
File "/tmp/pip-install-855msxfa/mayavi/tvtk/code_gen.py", line 10, in <module>
import vtk_module as vtk
File "tvtk/vtk_module.py", line 15, in <module>
from vtk import *
File "/usr/local/lib/python3.6/dist-packages/vtk/__init__.py", line 12, in <module>
from .vtkOpenGLKit import *
File "/usr/local/lib/python3.6/dist-packages/vtk/vtkOpenGLKit.py", line 9, in <module>
from vtkOpenGLKitPython import *
ModuleNotFoundError: No module named 'vtkOpenGLKitPython'
----------------------------------------
ERROR: Failed building wheel for mayavi
Running setup.py clean for mayavi
Failed to build mayavi```