conda-forge / vtk-feedstock

A conda-smithy repository for vtk.
BSD 3-Clause "New" or "Revised" License
13 stars 64 forks source link

vtk broken? #21

Closed christianbrodbeck closed 7 years ago

christianbrodbeck commented 7 years ago

I'm trying to write a recipe that depends on mayavi and hence vtk, and for Linux it ends with the traceback below. This looks like something is missing after the vtk install through conda-forge? Or is there a workaround for this, in which case maybe vtk could raise a better error message?

Traceback (most recent call last):
  File "/staged-recipes/build_artefacts/pysurfer_1485201053033/_t_env/bin/pysurfer", line 9, in <module>
    from surfer._commandline import parser
  File "/staged-recipes/build_artefacts/pysurfer_1485201053033/_t_env/lib/python2.7/site-packages/surfer/__init__.py", line 1, in <module>
    from .viz import Brain, TimeViewer  # noqa
  File "/staged-recipes/build_artefacts/pysurfer_1485201053033/_t_env/lib/python2.7/site-packages/surfer/viz.py", line 13, in <module>
    from mayavi import mlab
  File "/staged-recipes/build_artefacts/pysurfer_1485201053033/_t_env/lib/python2.7/site-packages/mayavi/mlab.py", line 27, in <module>
    from mayavi.tools.camera import view, roll, yaw, pitch, move
  File "/staged-recipes/build_artefacts/pysurfer_1485201053033/_t_env/lib/python2.7/site-packages/mayavi/tools/camera.py", line 25, in <module>
    from .engine_manager import get_engine
  File "/staged-recipes/build_artefacts/pysurfer_1485201053033/_t_env/lib/python2.7/site-packages/mayavi/tools/engine_manager.py", line 14, in <module>
    from mayavi.core.engine import Engine
  File "/staged-recipes/build_artefacts/pysurfer_1485201053033/_t_env/lib/python2.7/site-packages/mayavi/core/engine.py", line 12, in <module>
    import vtk
  File "/staged-recipes/build_artefacts/pysurfer_1485201053033/_t_env/lib/python2.7/site-packages/vtk/__init__.py", line 100, in <module>
    from .vtkRenderingOpenGL import *
  File "/staged-recipes/build_artefacts/pysurfer_1485201053033/_t_env/lib/python2.7/site-packages/vtk/vtkRenderingOpenGL.py", line 9, in <module>
    from vtkRenderingOpenGLPython import *
ImportError: No module named vtkRenderingOpenGLPython
Korijn commented 7 years ago

I don't think Mayavi is on conda-forge yet so I don't think the one in defaults could work with this version of VTK.

christianbrodbeck commented 7 years ago

The reason I assumed it was a general vtk problem is that the error happens during a bare import vtk statement. Could this be due to mayavi?

Mayavi on defaults does misspecify its vtk dependency and I've opened an issue for that (https://github.com/ContinuumIO/anaconda-issues/issues/1365)

However the output before the exception contains the following lines, suggesting that mayavi is coming from conda-forge (I think it was added very recently though):

The following packages will be downloaded:

...
    mayavi-4.5.0               |      np111py27_1        12.8 MB  conda-forge
...

The Mayavi conda-forge recipe (https://github.com/conda-forge/mayavi-feedstock) explicitly requires vtk ==7.1.0 (https://github.com/conda-forge/mayavi-feedstock/blob/master/recipe/meta.yaml#L31)

Korijn commented 7 years ago

You are right.

I'm confused though; the mayavi-feedstock CI is passing on all platforms: https://github.com/conda-forge/mayavi-feedstock/pull/2

You'd think this error would occur there as well, hm?

christianbrodbeck commented 7 years ago

Might the relevant difference be that PySurfer imports mlab from mayavi, which I don't think the mayavi feedstock test does? Unfortunately I don't have access to Linux to test this with vtk 7.

Korijn commented 7 years ago

Actually, I think VTK is being built with vtkRenderingOpenGL2 instead of 1, and Mayavi isn't compatible with that.

[Edit] No, scratch that... -DVTK_RENDERING_BACKEND=OpenGL

dfroger commented 7 years ago

requires vtk ==7.1.0

There is a discussion about that: https://github.com/conda-forge/mayavi-feedstock/issues/1

dfroger commented 7 years ago

mayavi-feedstock CI is passing on all platforms: conda-forge/mayavi-feedstock#2

I just merged this PR, so mayavi should br available on Linux and Windows (in a few minutes), but not OSX (https://github.com/conda-forge/mayavi-feedstock/issues/3)

dfroger commented 7 years ago

ImportError: No module named vtkRenderingOpenGLPython

I'll try to reproduce this

dfroger commented 7 years ago

Here https://circleci.com/gh/conda-forge/staged-recipes/12483?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link mayavi is installed from default (don't know the reason why).

On my Linux machine, this install mayavi from conda-forge:

conda create -n sufer mayavi python=2.7 imageio matplotlib mayavi nibabel numpy scipy

and this works:

source activate surfer
python -c 'import vtk'
python -c 'import mayavi'
mayavi --help

[EDIT] On last build https://circleci.com/gh/conda-forge/staged-recipes/12761?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link, mayavi is installed from conda-forge

dfroger commented 7 years ago

I think py-surfer recipe need to add libXt-devel and mesa-libGLU-devel to its yum_requirements.txt, like the mayavi one

[Edit] or just like vtk's yum_requirements.txt.

dfroger commented 7 years ago

Is it possible to modify VTK recipe so that it is checked? (post install script, or something like this)

Korijn commented 7 years ago

I think that is already the case?

test:
  imports:
    - vtk
    - vtk.vtkChartsCore
    - vtk.vtkCommonCore
    - vtk.vtkFiltersCore
    - vtk.vtkFiltersGeneric
    - vtk.vtkGeovisCore
    - vtk.vtkFiltersHybrid
    - vtk.vtkIOCore
    - vtk.vtkImagingCore
    - vtk.vtkInfovisCore
    - vtk.vtkRenderingCore
    - vtk.vtkViewsCore
    - vtk.vtkRenderingVolume
    - vtk.vtkInteractionWidgets
christianbrodbeck commented 7 years ago

Here https://circleci.com/gh/conda-forge/staged-recipes/12483?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link mayavi is installed from default (don't know the reason why).

Yes strange, this is still the same in the latest build, for the build it's pulling mayavi from defaults, but for the test it's pulling from conda-forge. The only difference in the requirements is that build also has setuptools, that can hardly be the reason? A difference in channel priorities?

Korijn commented 7 years ago

Care to share your conda config --get and conda info?

The latest few versions of conda and conda-build are notoriously buggy by the way, we've been having weird hiccups for the last two weeks for all sorts of stuff...

christianbrodbeck commented 7 years ago

@Korijn I was referring to the build on circleci (linked), not my machine.

christianbrodbeck commented 7 years ago

Closing, since updating yum_requirements solved my issue. Thanks!

dfroger commented 7 years ago

@christianbrodbeck thanks, I think we should find a way to make it more explicit, document it, or check it before the error occurs to provide to explict warning. Without a doubt, the error will reappear for other users...

Korijn commented 7 years ago

It was surprising for me to see that it raised an ImportError at the python level and not at the dll/so level... I'm having a hard time believing that the either of them was really missing. They just failed to load.

christianbrodbeck commented 7 years ago

Could a comment be added to the VTK feedstock readme? Something like "Projects that depend on VTK should add a yum_requirements.txt file like vtk-feedstock/recipe/yum_requirements.txt. Failure to do so can result in an ImportError: No module named vtkRenderingOpenGLPython."? That would show up when searching for "vtkRenderingOpenGLPython".

It was surprising for me to see that it raised an ImportError at the python level and not at the dll/so level

Yes that was confusing for me too, maybe VTK could be modified to raise a more meaningful error? I am not familiar with the VTK source though... searching for "vtkRenderingOpenGLPython" does not even yield any results...

dfroger commented 7 years ago

Could a comment be added to the VTK feedstock readme?

As README are generated by conda-smithy, is it ok to modify them?

christianbrodbeck commented 7 years ago

Right... is there any way to add notes to a feedstock except for comments in the meta.yaml which seem to be discouraged?

Korijn commented 7 years ago

@christianbrodbeck VTK autogenerates the Python wrappers with lots of CMake magic, see: https://github.com/Kitware/VTK/blob/0937c8a6be8a10b95828c31b289cd1cecce78432/CMake/vtkPythonWrapping.cmake

jakirkham commented 7 years ago

Comments in the recipe are ok. We just try to remove boilerplate comments that come from copying and tweaking the example at staged-recipes.

Also it is possible to add a README to the recipe directory. Here's an example (albeit not the prettiest one).

kazemSafari commented 6 years ago

Hi i'm trying to install "mayavi". So i installed all the prerequisite packages including vtk. But after type enter "pip install mayavi" into my ubuntu 16.04 shell, i get a similar error: "from vtkOpenGLKitPython import * ModuleNotFoundError: No module named 'vtkOpenGLKitPython'"

How can i fix this error. I did not get your solution "christianbrodbeck"?

mustafa-qamaruddin commented 6 years ago

ImportError: No module named 'vtkOpenGLKitPython'

christianbrodbeck commented 6 years ago

@kazemSafari sorry I missed your comment, this issue is about conda-forge recipes, not local install issues. It looks like your VTK install failed somehow?