enthought / mayavi

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

unable to run mayavi2 (Imported VTK version (9.0) does not match the one used to build the TVTK classes (7.1). This may cause problems. Please rebuild TVTK.) #1061

Closed ratna-saikiran closed 2 years ago

ratna-saikiran commented 3 years ago

Imported VTK version (9.0) does not match the one used to build the TVTK classes (7.1). This may cause problems. Please rebuild TVTK.

yoda-vid commented 3 years ago

I've seen a similar error in an environment where I had installed Mayavi and VTK 8.1, then later updated VTK to 9. The workaround for me was simply to create a new environment and install both Mayavi and VTK 9 afresh. I also tried to reinstall Mayavi with VTK 9 but encountered another error.

rahulporuri commented 2 years ago

... then later updated VTK to 9.

tvtk, which is installed along with mayavi, is built against a specific version of vtk. So, updating vtk in the environment causes the installed tvtk version to complain about the mismatch!

The workaround for me was simply to create a new environment and install both Mayavi and VTK 9 afresh!

This is almost the right solution - every time vtk is upgraded in an environment, you will have to reinstall mayavi (which reinstalls tvtk).

I also tried to reinstall Mayavi with VTK 9 but encountered another error.

We are aware of this issue and we are working on fixing this. The fix has been incorporated into the development branch and will be available in a released version soon.

Q : Can I ask why you upgraded the vtk version after installing the packages?

I'm going to close this issue as there is no actual bug here.

yoda-vid commented 2 years ago

Thanks for your insights, clarifies a lot for me!

Q : Can I ask why you upgraded the vtk version after installing the packages?

I was testing upgrading all dependencies of my package (pip install --upgrade --upgrade-strategy eager <my-package>), so this was not from a specific need to update VTK or Mayavi but a side-effect of the full dependencies update.

I tested this more and found that the warning sometimes occurs even in a fresh environment. Turns out this was because Pip installed a cached version of a Mayavi wheel that was built during a prior installation on VTK 8. The workaround was to either remove the cache (rm -rf ~/.cache/pip) or to rebuild the wheel (pip install --no-binary=mayavi mayavi or pip install --no-cache-dir mayavi).

rahulporuri commented 2 years ago

... to rebuild the wheel ...

I'd recommend reinstalling mayavi/rebuilding the wheel. That's the safest/surest option AFIAK.