Mit conda 4.8.2
unter Python 3.8 installiert, schlägt der Import fehl:
Python 3.8.6 | packaged by conda-forge | (default, Oct 7 2020, 18:42:56)
[Clang 10.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from mayavi import mlab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/mayavi/mlab.py", line 16, in <module>
from mayavi.tools.camera import view, roll, yaw, pitch, move
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/mayavi/tools/camera.py", line 24, in <module>
from .engine_manager import get_engine
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/mayavi/tools/engine_manager.py", line 12, in <module>
from mayavi.preferences.api import preference_manager
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/mayavi/preferences/api.py", line 4, in <module>
from .preference_manager import preference_manager
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/mayavi/preferences/preference_manager.py", line 29, in <module>
from traitsui.api import View, Group, Item
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/traitsui/api.py", line 35, in <module>
from .editors.api import (
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/traitsui/editors/__init__.py", line 26, in <module>
from .api import (
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/traitsui/editors/api.py", line 45, in <module>
from .list_str_editor import ListStrEditor
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/traitsui/editors/list_str_editor.py", line 29, in <module>
from pyface.image_resource import ImageResource
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/pyface/image_resource.py", line 19, in <module>
ImageResource = toolkit_object("image_resource:ImageResource")
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/pyface/base_toolkit.py", line 152, in __call__
module = import_module(mname, package)
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/pyface/ui/qt4/image_resource.py", line 25, in <module>
from pyface.i_image_resource import IImageResource, MImageResource
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/pyface/i_image_resource.py", line 14, in <module>
from pyface.resource_manager import resource_manager
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/pyface/resource_manager.py", line 14, in <module>
from pyface.resource.api import ResourceManager
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/pyface/resource/api.py", line 13, in <module>
from .resource_manager import ResourceManager
File "/Users/scott/opt/anaconda3/envs/mapping/lib/python3.8/site-packages/pyface/resource/resource_manager.py", line 20, in <module>
from importlib_resources import files
ModuleNotFoundError: No module named 'importlib_resources'
Ich denke, dies könnte mit der Unterstützung von Python 3.9 zusammenhängen, da es läuft
pip install importlib-resources
behebt das Problem (zu finden auf https://pypi.org/project/importlib-resources/).
Ich bin mir nicht sicher, was der bevorzugte Weg wäre, dies zu beheben, oder ich würde die PR beitragen.
Aus irgendeinem Grund nimmt Ihre Installation von Pyface die Abhängigkeit von importlib_resources
(und möglicherweise auch importlib_metadata
) nicht auf. Wenn Sie pip
oder edm
, sollten sie korrekt installiert werden, aber es sieht so aus, als würden Sie conda
also sollten Sie dies demjenigen melden, der Ihre Pyface-Builds bereitstellt.
Wenn Sie pip
, um Pyface (oder Mayavi) zu installieren, melden Sie dies bitte als Problem im Pyface-Repository!
Ich werde dies schließen, da es kein direktes Problem mit Mayavi ist.
Dein Paket funktioniert nicht richtig mit conda
Das Thema/die Augen sollte man nicht einfach verschließen
Ich denke, es ist jedoch nicht der Fehler von mayavi
, sondern die Verpackung von pyface von conda-forge, also sollte dies das richtige Problem sein, das Sie sich ansehen sollten:
Danke @larsoner für den Hinweis auf das Problem in conda-forge. Hoffentlich wird Ihre PR bald zusammengeführt!
Hilfreichster Kommentar
Ich denke, es ist jedoch nicht der Fehler von
mayavi
, sondern die Verpackung von pyface von conda-forge, also sollte dies das richtige Problem sein, das Sie sich ansehen sollten:https://github.com/conda-forge/pyface-feedstock/pull/27