enthought / mayavi

3D visualization of scientific data in Python
http://docs.enthought.com/mayavi/mayavi/
Other
1.28k stars 282 forks source link

Install with pip #1284

Open HoloHolo-phys opened 7 months ago

HoloHolo-phys commented 7 months ago

I apologize for the quite dump question, but I believe this is an issue that people stumble upon recently, and I could not find any reliable answer so far. I basically struggle to install everything correctly.

I think everything was and is quite straightforward if you use python 3.10. But at the moment it is almost retro and many want to use 3.11 at least. And install python 3.10 is not an obvious thing for not expert - it is now in security mode and the usual installer is not provided. The second thing is 'numpy migration thing' associated with deprecated 'distutils'. Simultaneously, it is not clear how important the vtk updates are. So as I view it, several important things are interconnected and if any of them is not supported by others, then nothing is working. The amount of possible errors are numerous.

However, I expect that there exist a proper set of versions for mayavi, python, vtk and numpy and everything else which would work for anyone. Can someone advise how to install it in a normal way with pip? Because the python 3.11 + pip install vtk + pip install mayavi is not working for me. And 10 other combinations which I already tried. Also, just to mention: I have installed VS build tools which are important for vtk and other things as well. So I pretty sure that my problem is about versions. Also I tried to install mayavi with: pip install https://github.com/enthought/mayavi/zipball/master. It helped but it seems like this is not a stable version of mayavi but something currently developing. It occasionally crash because of some conflicts with vtk/numpy. Like the same script can work or not completely at random.

I am also aware that possibly the conda is more supported way of installation. But unfortunately, the conda package channels are limited, I still need ~10 other packages from PyPl libraries. And if I will mix the conda and pip environments, this will be a mess and completely different problem. In any case, if you will advise using conda, I will try to dig in this direction.

Thank you very much in advance.

timdiller commented 6 months ago

pip install with Python 3.12 is also failing in a way that looks like a bug in the build step. I'm on macOS 14 (Sonoma)

mayavi_test_3.12 ❯ python --version
Python 3.12.0

mayavi_test_3.12 ❯ pip --version     
pip 23.3.1 from /Users/tdiller/timdiller/venvs/mayavi_test_3.12/lib/python3.12/site-packages/pip (python 3.12)

mayavi_test_3.12 ❯ pip install mayavi
Collecting mayavi
  Using cached mayavi-4.8.1.tar.gz (20.6 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [24 lines of output]
      <string>:127: SyntaxWarning: invalid escape sequence '\.'
      <string>:128: SyntaxWarning: invalid escape sequence '\.'
      <string>:152: SyntaxWarning: invalid escape sequence '\.'
      <string>:153: SyntaxWarning: invalid escape sequence '\.'
      Traceback (most recent call last):
        File "/Users/tdiller/timdiller/venvs/mayavi_test_3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/tdiller/timdiller/venvs/mayavi_test_3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/tdiller/timdiller/venvs/mayavi_test_3.12/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/_2/1g16s0vn7t11sf8s740wm08h0000gr/T/pip-build-env-clsyqljo/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/_2/1g16s0vn7t11sf8s740wm08h0000gr/T/pip-build-env-clsyqljo/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/_2/1g16s0vn7t11sf8s740wm08h0000gr/T/pip-build-env-clsyqljo/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/private/var/folders/_2/1g16s0vn7t11sf8s740wm08h0000gr/T/pip-build-env-clsyqljo/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 291, in <module>
      NameError: name 'build_src' is not defined
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
JonCrow14 commented 5 months ago

pip install isn't working for me either (for Idle Python 3.12) windows 11 too

Screenshot 2024-01-16 224905
HoloHolo-phys commented 5 months ago

Just to know for guys who can stumble upon this: I used Python 3.10 + pip and it worked in usual way. But I suppose many things will migrate to newer versions at some point, so it is possible that 3.10 is only a temporary solution.

BlueSpaceship commented 5 months ago

I tried with Python 3.9.13, 3.10.11, 3.11.7, all failed. @HoloHolo-phys which version did you use?

HoloHolo-phys commented 5 months ago

I tried with Python 3.9.13, 3.10.11, 3.11.7, all failed. @HoloHolo-phys which version did you use?

So here possibly all relevant packages and their versions: Python 3.10.10

Also, I dont remember if I installed mayavi with just 'pip install mayavi' or directly from github with 'pip install https://github.com/enthought/mayavi/zipball/master'.

And before VTK install, maybe it is crucial to have VS build tools being installed. Get it with "Microsoft Visual C++ Build Tools". The latest link to that is actually here: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019

Hope it will for for you!

wkaczan commented 5 months ago

I was trying to follow the instruction to install mayavi from github: $ git clone https://github.com/enthought/mayavi.git $ cd mayavi $ pip install -r requirements.txt $ pip install PyQt5 # replace this with any supported toolkit $ python setup.py install # or develop

However there is no requirements.txt file in the mayavi folder.

pushkarmutha commented 5 months ago

Thanks @HoloHolo-phys. Your method worked for me. Here are the exact commands I ran

conda create --name mayavi
conda activate mayavi
#conda install -c conda-forge scipy traits jupyter ipywidgets ipyevents
conda install python=3.10
conda install numpy=1.26.2
pip install vtk==9.3.0
pip install PyQt5==5.15.10
pip install mayavi==4.8.1
HoloHolo-phys commented 5 months ago

@woj-kaczan

NameError: name 'build_src' is not defined Any ideas how to deal with it?

I would say that 'src' error is likely related to C++ compiler that is supposed to build VTK/mayavi libraries. VTK is C++ thing originally and python package is only a wrapper. Double check that you have something like minGW and PATH things are fine. I think it should be automatically installed with "Microsoft Visual C++ Build Tools". I apologize if this is not helpful, I am far from these things, I am only a poor python user 😁.

patricioastudillo commented 3 months ago

I had the same issue with

This worked for me pip install https://github.com/enthought/mayavi/zipball/master