Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from mayavi import mlab ends in error #991

Open
dsche-cyber opened this issue Dec 17, 2020 · 1 comment
Open

from mayavi import mlab ends in error #991

dsche-cyber opened this issue Dec 17, 2020 · 1 comment

Comments

@dsche-cyber
Copy link

After calling python and importing mlab from mayavi, results in error, making mayavi unusable.

python
Python 3.8.6 (default, Sep 30 2020, 04:00:38) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mayavi import mlab

Error stack:

QStandardPaths: runtime directory '/run/user/1000' is not owned by UID 0, but a directory permissions 0700 owned by UID 1000 GID 1000
QSettings::value: Empty key passed
QStandardPaths: runtime directory '/run/user/1000' is not owned by UID 0, but a directory permissions 0700 owned by UID 1000 GID 1000
QStandardPaths: runtime directory '/run/user/1000' is not owned by UID 0, but a directory permissions 0700 owned by UID 1000 GID 1000
QSettings::value: Empty key passed
/usr/lib/python3.8/site-packages/traits/etsconfig/etsconfig.py:423: UserWarning: Environment variable "HOME" not set, setting home directory to /tmp
  warn(
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/tvtk/tvtk_base.py", line 22, in <module>
    from traits.api import PrefixMap, PrefixList
ImportError: cannot import name 'PrefixMap' from 'traits.api' (/usr/lib/python3.8/site-packages/traits/api.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/site-packages/mayavi/mlab.py", line 16, in <module>
    from mayavi.tools.camera import view, roll, yaw, pitch, move
  File "/usr/lib/python3.8/site-packages/mayavi/tools/camera.py", line 24, in <module>
    from .engine_manager import get_engine
  File "/usr/lib/python3.8/site-packages/mayavi/tools/engine_manager.py", line 13, in <module>
    from mayavi.core.registry import registry
  File "/usr/lib/python3.8/site-packages/mayavi/core/registry.py", line 16, in <module>
    from mayavi.core.metadata import Metadata, import_symbol
  File "/usr/lib/python3.8/site-packages/mayavi/core/metadata.py", line 11, in <module>
    from mayavi.core.pipeline_info import PipelineInfo
  File "/usr/lib/python3.8/site-packages/mayavi/core/pipeline_info.py", line 12, in <module>
    from .utils import get_tvtk_dataset_name
  File "/usr/lib/python3.8/site-packages/mayavi/core/utils.py", line 6, in <module>
    from tvtk.api import tvtk
  File "/usr/lib/python3.8/site-packages/tvtk/api.py", line 10, in <module>
    from tvtk.tvtk_access import tvtk
  File "/usr/lib/python3.8/site-packages/tvtk/tvtk_access.py", line 55, in <module>
    from tvtk.tvtk_classes import tvtk_helper
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "<frozen zipimport>", line 259, in load_module
  File "tvtk_classes/tvtk_helper.py", line 2, in <module>
  File "/usr/lib/python3.8/site-packages/tvtk/tvtk_base.py", line 26, in <module>
    class PrefixMap(Trait):
TypeError: function() argument 'code' must be code, not str
@dsche-cyber
Copy link
Author

dsche-cyber commented Dec 24, 2020

I solved the Issue for me, but still I think the code needs to be updated, as the exception handling still fails for old traits version.

To fix my Issue I followed the suggestion in Issue #940:
#940 (comment)

So I have now vtk9.0.1-3 from the AUR and installed mayavi-4.7.3dev0 from source.

Further the problem lies in the arch repo packages of traits and traitsui as these are too old (vtk9 seems to be needed by python3.8> and so mayavi-4.7.2> is needed, so the traits packages in the repos do not fit to these newer packages).
To update those I needed to remove other packages too, as it was breaking dependencies:
sudo pacman -R python-traits python-apptools python-envisage python-pyface
Now to update traits:
sudo pip install -U traits traitsui
Then install the packages that were removed before:
sudo pacman -S python-apptools python-envisage python-pyface
Note: I do not know, if those package are required for building other packages under arch, if so it is probably a good idea not to mix pacman and pip installed packages, so alternatively use:
sudo pip install -U apptools envisage pyface
Now it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant