Impossible to install mayavi on Windows 11 and Python 3.X - Windows fatal exception: access violation
Opened this issue · 6 comments
I have been trying for 20 hours to get this to install and it simply does not install. I don't understand how it is possible to stop working after using this for years. I have tried 20 versions of Python 3.X and nothing works. All pip installs fails with:
Building TVTK classes... Windows fatal exception: access violation
I tried pip install mayavi and it fails for all Python 3.X versions I tried (3.13, 3.12, 3.9, 3.8, 3.7, 3.10, 3.11) they ALL fail. NONE works.
I have a mayavi working on an older machine and I tried to install the exact same versions of packages I have there:
Python 3.9.12 installed:
pip install numpy==1.25.2
pip install apptools==5.2.1
pip install envisage==7.0.3
pip install packaging==23.1
pip install pyface==8.0.0
pip install pygments==2.15.1
pip install traits==6.4.1
pip install traitsui==8.0.0
pip install vtk==9.2.6
pip install mayavi==4.8.1
Result: Numpy is required to build Mayavi correctly, please install it first. If I upgrade numpy, I get the same result.
I then went ahead and cloned the git version. It failed with Building TVTK classes... Windows fatal exception: access violation
. I managed to find the method that fails:
fails at vtk_parser.py, line 713: default = getattr(obj, 'Get%s' % key)()
The only method that fails is klass_name == 'vtkGenericCell' and key == 'CellFaces'. So I went ahead and added:
if (klass_name == 'vtkGenericCell' and key == 'CellFaces'):
default = None
else:
default = getattr(obj, 'Get%s' % key)()
Then it worked (this was with Python 3.12). However, when I tried to use mayavi, I get:
TypeError: unhashable type: 'PolyData'
Could anyone help with ANY version of Python and vtk and mayavi that works on Windows 11? I have Visual Studio 2019 installed if that makes any difference.
I have the same issue on Linux from python 3.11 and 3.12 and mayavi 4.8.3.dev0
I have a similar problem on Windows 11
Tried Python 3.8, 3.9, 3.10, 3.11, 3.12.
PyQt5 5.15.11
vtk 9.3.1, 9.4
mayavi 4.8.2
C:\Windows\System32>pip3 install mayavi
Collecting mayavi
Using cached mayavi-4.8.2.tar.gz (7.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting apptools (from mayavi)
Using cached apptools-5.3.0-py3-none-any.whl.metadata (4.3 kB)
Collecting envisage (from mayavi)
Using cached envisage-7.0.3-py3-none-any.whl.metadata (5.2 kB)
Requirement already satisfied: numpy in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from mayavi) (1.26.2)
Collecting pyface>=6.1.1 (from mayavi)
Using cached pyface-8.0.0-py3-none-any.whl.metadata (7.7 kB)
Requirement already satisfied: pygments in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from mayavi) (2.18.0)
Collecting traits>=6.0.0 (from mayavi)
Using cached traits-6.4.3-cp312-cp312-win_amd64.whl.metadata (5.2 kB)
Collecting traitsui>=7.0.0 (from mayavi)
Using cached traitsui-8.0.0-py3-none-any.whl.metadata (6.8 kB)
Requirement already satisfied: packaging in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from mayavi) (24.2)
Requirement already satisfied: vtk in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from mayavi) (9.3.1)
Requirement already satisfied: setuptools in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from envisage->mayavi) (75.6.0)
Requirement already satisfied: matplotlib>=2.0.0 in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from vtk->mayavi) (3.9.3)
Requirement already satisfied: contourpy>=1.0.1 in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from matplotlib>=2.0.0->vtk->mayavi) (1.3.1)
Requirement already satisfied: cycler>=0.10 in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from matplotlib>=2.0.0->vtk->mayavi) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from matplotlib>=2.0.0->vtk->mayavi) (4.55.2)
Requirement already satisfied: kiwisolver>=1.3.1 in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from matplotlib>=2.0.0->vtk->mayavi) (1.4.7)
Requirement already satisfied: pillow>=8 in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from matplotlib>=2.0.0->vtk->mayavi) (11.0.0)
Requirement already satisfied: pyparsing>=2.3.1 in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from matplotlib>=2.0.0->vtk->mayavi) (3.2.0)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from matplotlib>=2.0.0->vtk->mayavi) (2.9.0.post0)
Requirement already satisfied: six>=1.5 in c:\users\sev\appdata\local\programs\python\python312\lib\site-packages (from python-dateutil>=2.7->matplotlib>=2.0.0->vtk->mayavi) (1.17.0)
Using cached pyface-8.0.0-py3-none-any.whl (1.3 MB)
Using cached traits-6.4.3-cp312-cp312-win_amd64.whl (5.0 MB)
Using cached traitsui-8.0.0-py3-none-any.whl (1.5 MB)
Using cached apptools-5.3.0-py3-none-any.whl (230 kB)
Using cached envisage-7.0.3-py3-none-any.whl (268 kB)
Building wheels for collected packages: mayavi
Building wheel for mayavi (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for mayavi (pyproject.toml) did not run successfully.
│ exit code: 3221225477
╰─> [58 lines of output]
:133: SyntaxWarning: invalid escape sequence '.'
:134: SyntaxWarning: invalid escape sequence '.'
_configtest.c
running bdist_wheel
running build
running build_py
C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\wrapper_gen.py:1594: SyntaxWarning: invalid escape sequence '.'
'[a-zA-Z0-9]+.Output$': (
C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\wrapper_gen.py:1596: SyntaxWarning: invalid escape sequence '.'
'[a-zA-Z0-9]+.Source$': (
C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\wrapper_gen.py:1598: SyntaxWarning: invalid escape sequence '.'
'[a-zA-Z0-9]+.ScalarType$': (
C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\wrapper_gen.py:1602: SyntaxWarning: invalid escape sequence '.'
'[a-zA-Z0-9]+.Input$': (
C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\wrapper_gen.py:1605: SyntaxWarning: invalid escape sequence '.'
'[a-zA-Z0-9]+.InputConnection$': (
C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\wrapper_gen.py:1607: SyntaxWarning: invalid escape sequence '.'
'[a-zA-Z0-9.]+FileName$': (
C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\wrapper_gen.py:1609: SyntaxWarning: invalid escape sequence '.'
'[a-zA-Z0-9.]+FilePrefix$': (
Building tvtk_classes.zip
----------------------------------------------------------------------
Building TVTK classes... Windows fatal exception: access violation
Current thread 0x00002790 (most recent call first):
File "C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\vtk_parser.py", line 713 in _find_get_set_methods
File "C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\vtk_parser.py", line 491 in _organize_methods
File "C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\vtk_parser.py", line 157 in parse
File "C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\wrapper_gen.py", line 337 in _gen_methods
File "C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\wrapper_gen.py", line 238 in generate_code
File "C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\code_gen.py", line 235 in _write_wrapper_class
File "C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\code_gen.py", line 142 in generate_code
File "C:\Users\Sev\AppData\Local\Temp\pip-install-0xl1gveb\mayavi_bdb2188a48c84930841cc05c1e8f5532\tvtk\_setup.py", line 58 in gen_tvtk_classes_zip
File "<string>", line 247 in build_tvtk_classes_zip
File "<string>", line 254 in run
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 973 in run_command
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\dist.py", line 995 in run_command
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 316 in run_command
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 135 in run
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 973 in run_command
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\dist.py", line 995 in run_command
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 316 in run_command
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\command\bdist_wheel.py", line 381 in run
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 973 in run_command
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\dist.py", line 995 in run_command
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 954 in run_commands
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 199 in run_commands
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 183 in setup
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\__init__.py", line 117 in setup
File "<string>", line 322 in <module>
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\build_meta.py", line 320 in run_setup
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\build_meta.py", line 522 in run_setup
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\build_meta.py", line 407 in _build_with_temp_dir
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\build_meta.py", line 426 in _build
File "C:\Users\Sev\AppData\Local\Temp\pip-build-env-3cqo302j\overlay\Lib\site-packages\setuptools\build_meta.py", line 438 in build_wheel
File "C:\Users\Sev\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251 in build_wheel
File "C:\Users\Sev\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335 in main
File "C:\Users\Sev\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353 in <module>
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mayavi
Failed to build mayavi
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (mayavi)
I install from the command line with administrator rights.
please suggest a solution to the problem.
+1
I am on Windows 10 with the same problem
I activated the verbose mode in vtk_parser.py by setting VTK_PARSER_VERBOSE
set VTK_PARSER_VERBOSE=1
and the last lines I see when I run pip install mayavi==4.8.2 --verbose
are
...
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
Instantiating <class 'vtkmodules.vtkInfovisLayout.vtkCirclePackFrontChainLayoutStrategy'>
Calling vtkCirclePackFrontChainLayoutStrategy.GetHeight()
Windows fatal exception: access violation
I tried different versions of the Python vtk package (9.4.0, 9.2.5, 9.1.0) but the message is identical.
Same issue with Linux, Python 3.8 and mayavi 4.8.2
The error thrown is of course different to Windows:
Building TVTK classes... Fatal Python error: Segmentation fault
Possible workaround: