Help installing VTK with pip

Hello,
I’ve been trying to install mayavi using pip but I get the following error:
Error: Could not find a version that satisfies the requirement vtk (from mayavi) from (from versions: none)
Error: No matching distribution found for vtk (from mayavi)

When I try to install vtk directly I get a similar error.
I’ve since tried to follow the instructions posted here but I get an error in CMake saying:
Error: The source directory does not appear to contain CMakeLists.txt

I am using a Windows10 Operating system.

Any help would be appreciated.
Thanks

Are you trying to use Python 2.7 (2.7 is likely your windows 10 system’s default Python version)? VTK does not have Python wheels available for 2.7 on Windows due to C++ 11 incompatibilities or something.

I’d highly recommend trying Python 3.6+ and use anaconda over pip to manage your Python environment.

@banesullivan

Bane, is there a good reason why anaconda is preferred over pip? I noticed that the latest version on pypi is the 8.1.2 release which is giving problems in combination with pyside2.

If vtk on pypi is not recommended, would it be a good idea to remove vtk from pypi to avoid people from accidentally using it and running into all kinds of compatibility issues?

It can get opinionated, but Anaconda does a much better job of managing all of your requirements across your virtual environment. It is really easy to make an unstable environment with pip alone. I’d recommend looking into the differences yourself: Anaconda | Understanding Conda and Pip

The main reason I recommend Anaconda here is that VTK 8.2.0 is live on the conda-forge channel: GitHub - conda-forge/vtk-feedstock: A conda-smithy repository for vtk.

I believe PySide2 support wasn’t added until VTK 8.2.x - not positive about that but if you only have 8.1.2, try using PyQt5. Also this post shows you how to use PySide2 on earlier versions of VTK: VTK 8.2.0 - come and get it! - #10 by dgobbi

Well, I hope what I said above did not convey that point. VTK 8.1.2 which is the version on PyPI is fine to use! What isn’t recommended is Python 2.7 as is approaching the end of its life and there are incompatibilities on WIndows.

Well, it is out of date, but it should not be removed - there are not “all kinds of compatibility issues” of which I am aware. There are good reasons to keep stable distributions in the archives on PyPI for all the folks that have been using that wheel since it was published in 2018.

Now should it be updated? Absolutely! Hopefully, some work from the upcoming hackathon will address this: A VTK Hackathon on November 6, 2019 - #10 by Dave_DeMarle It Might help to chime in there and let them know you are +1 for updating the PyPI wheels