ich alle Google verfügbaren Links gescheuert haben dieses Problem zu beheben, aber es bleibt noch ungelöst für mich ...Python Import: kann nicht Namen ‚Multiarray‘ importieren
ich folgende Fehlermeldung erhalten, wenn graph_tool zu importieren versuchen, in python3. Ich habe sowohl Python 2.7 und 3.6 und Anaconda installiert. Ich installiere Pakete entweder unter pip
, conda
oder brew
. Ich habe MacOS Sierra 10.12.3.
$ python3
Python 3.5.2 |Anaconda custom (x86_64)| (default, Jul 2 2016, 17:52:12)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from graph_tool.all import *
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/numpy/core/__init__.py", line 16, in <module>
from . import multiarray
ImportError: cannot import name 'multiarray'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/graph_tool/__init__.py", line 104, in <module>
import numpy
File "/usr/local/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/usr/local/lib/python3.6/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python3.6/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/local/lib/python3.6/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python3.6/site-packages/numpy/core/__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: cannot import name 'multiarray'
Einige Informationen über meine Verzeichnisse/Pfade:
>>> import sys
>>> print(('\n').join(sys.path))
/usr/local/lib/python3.6/site-packages
/Users/mymacbook/anaconda/lib/python35.zip
/Users/mymacbook/anaconda/lib/python3.5
/Users/mymacbook/anaconda/lib/python3.5/plat-darwin
/Users/mymacbook/anaconda/lib/python3.5/lib-dynload
/Users/mymacbook/.local/lib/python3.5/site-packages
/Users/mymacbook/anaconda/lib/python3.5/site-packages
/Users/mymacbook/anaconda/lib/python3.5/site-packages/Sphinx-1.4.6-py3.5.egg
/Users/mymacbook/anaconda/lib/python3.5/site-packages/aeosa
/Users/mymacbook/anaconda/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg
/usr/local/lib/python2.7/site-packages
/usr/local/Cellar/matplotlib/2.0.2/libexec/lib/python2.7/site-packages
/usr/local/Cellar/numpy/1.13.3/libexec/nose/lib/python2.7/site-packages
$ echo $PYTHONPATH
/usr/local/lib/python3.6/site-packages
$ pr /Users/mymacbook/.local/lib/python3.5/site-packages/homebrew.pth
import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")
Zusätzliche Informationen:
Irgendwo Online angegeben auch, dass ich die neueste Version von matplotlib
haben sollte. Ich starte brew info matplotlib
und die folgende Einschränkung erscheint. Ich führe die Befehle wie angegeben aus, aber diese Warnung wird immer noch angezeigt. Ich bin mir nicht sicher, ob dieses Problem für das multiarray
Problem relevant ist.
==> Caveats
If you want to use the `wxagg` backend, do `brew install wxpython`.
This can be done even after the matplotlib install.
If you use system python (that comes - depending on the OS X version -
with older versions of numpy, scipy and matplotlib), you may need to
ensure that the brewed packages come earlier in Python's sys.path with:
mkdir -p /Users/mymacbook/.local/lib/python3.5/site-packages
echo 'import sys; sys.path.insert(1, "/usr/local/lib/python2.7/site-packages")' >> /Users/mymacbook/.local/lib/python3.5/site-packages/homebrew.pth
This formula installed .pth files to Homebrew's site-packages and your
Python isn't configured to process them, so you will not be able to
import the modules this formula installed. If you plan to develop
with these modules, please run:
mkdir -p /Users/mymacbook/.local/lib/python3.5/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/mymacbook/.local/lib/python3.5/site-packages/homebrew.pth
FYI Informationen über meine numpy
Paket. Es hat auch den gleichen Vorbehalt wie oben.
$ brew info numpy
numpy: stable 1.13.3 (bottled), HEAD
Package for scientific computing with Python
http://www.numpy.org
/usr/local/Cellar/numpy/1.12.1 (442 files, 9.6MB)
Poured from bottle on 2017-06-08 at 15:05:49
/usr/local/Cellar/numpy/1.13.0 (1,371 files, 29.0MB)
Built from source on 2017-06-24 at 00:28:31 with: --with-python3
/usr/local/Cellar/numpy/1.13.3 (893 files, 21.8MB) *
Poured from bottle on 2017-10-22 at 22:06:55
Auch ein anderes Problem (möglicherweise im Zusammenhang) ....
$ pip search numpy
Traceback (most recent call last):
File "/Users/tamtran/anaconda/bin/pip", line 7, in <module>
from pip import main
File "/Users/tamtran/anaconda/lib/python3.5/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog.
.
.
.
AttributeError: '_NamespacePath' object has no attribute 'sort'
Vielen Dank im Voraus für Ihre Hilfe! (Entschuldigung für die Unmenge an Informationen, nur versuchen, so viel Kontext wie möglich zu bieten) (auch wenn Sie spezifische commands
Ihren Lösungen zur Verfügung stellen könnten)
Ich stimme zu, dass das Umsortieren von 'sys.path' nicht optimal ist. Aber nachdem ich mit einer neuen 'conda'-Umgebung angefangen habe, habe ich das gleiche Problem von OP getroffen -' sys.path' funktionierte immer noch nicht korrekt. –
@andrew_reece (siehe meine Bearbeitung) Wenn Sie oder OP eine bestimmte Zielanaconda-Version und -Plattform veröffentlichen, kann ich oder ein anderer Benutzer möglicherweise einen Lauf beim Erstellen des Pakets für den Upload nach Anaconda oder Conda-Forge durchführen. –
@PhilCooper Hallo Phil, danke für deine Antwort! Ich habe versucht, Ihrem Vorschlag zu folgen, aber die Notwendigkeit von 'python3.6',' graph_tool' zu installieren, ist entstanden, was mich auf eine andere Reise von Schwierigkeiten geführt hat. Würde es Ihnen etwas ausmachen, sich meine [neue SO-Frage hier] anzusehen (https://stackoverflow.com/questions/46900020/python-conda-resolvepackagenotfound)? Danke im Voraus! – tamtam