Hallo,
Es gibt eine Reihe von Paketen, die ich installiere, die NumPy erfordern (z. B. TensorFlow), und ich kann sie aufgrund eines ImportError auf der Numpy-Seite anscheinend nicht installieren und importieren.
Dies geschieht sowohl bei pip install
als auch beim Bauen aus der Quelle.
import numpy as np
import tensorflow as tf
ImportError: numpy.core._multiarray_umath failed to import
'1.16.0.dev0+cdbf35b'
Ich habe das Gefühl, dass dies auch ein Systemproblem sein könnte, da sogar ein älterer Numpy mir den gleichen Fehler gibt
Wir benötigen weitere Informationen, um Ihnen zu helfen. Ist import numpy as np
erfolgreich und dann import tensorflow as tf
fehl? Wenn es die erste ist, sollten weitere Informationen zu der Ausnahme vorliegen. Wenn es der zweite ist, woher haben Sie Tensorflow? Welche Python verwendest du?
Hallo @mattip :
Es ist letzteres (wie in: Ich kann import numpy
alles gut, aber dann ist TF derjenige, der nicht importiert werden kann).
Hier ist die vollständige Spur (ich verwende die neueste Miniconda-Shell-Datei):
```Python 3.6.5 |Anaconda, Inc.| (Standard, 29.04.2018, 16:14:56 Uhr)
Geben Sie „Copyright“, „Credits“ oder „Lizenz“ ein, um weitere Informationen zu erhalten
IPython 6.5.0 -- Ein verbessertes interaktives Python. Typ '?' für Hilfe.
In [1]: numpy als np importieren
ImportError Traceback (letzter Aufruf zuletzt)
ImportError Traceback (letzter Aufruf zuletzt)
ImportError Traceback (letzter Aufruf zuletzt)
ImportError Traceback (letzter Aufruf zuletzt)
ImportError: numpy.core._multiarray_umath konnte nicht importiert werden
In [3]: np.__version__
Aus[3]: '1.15.1'
```
Ich habe Numpy und Scipy immer aus dem Quellcode erstellt, seit ich auf meine lokale MKL verlinken wollte, aber als ich anfing, den ImportError zu bekommen, fing ich an, mit pip install
herumzufummeln, der numpy ing, aber dieser Fehler ist immer noch da
In [3]: np.__version__
Out[3]: '1.15.1'
Das ist seltsam, das Modul _multiarray_umath
ist neu in Master. Ich vermute jedoch, dass die jüngste Code-Neuanordnung die Wurzel Ihrer Probleme ist.
Wenn Sie Development numpy verwenden, sollten Sie tensorflow nach Möglichkeit neu kompilieren.
Und vielleicht alle installierten Nicht-System-Numpy-Versionen löschen und neu installieren.
Danke @charris ! Es sieht mit ziemlicher Sicherheit so aus, als ob ein fehlerhafter Cache diesen Importfehler verursacht hat. Ich habe gerade einen sauberen Docker gebaut und gerade die Importe numpy (sowohl pip als auch build) und Tensorflow (nur pip) getestet, und beide Versionen von numpy haben beim Importieren von TF alles gut überprüft!
Ich werde weiterhin andere Pakete installieren und berichten, ob es wirklich ein böser Zufall war oder ob andere Pakete unterwegs etwas Unartiges tun!
Ja, alles ist gut! Danke für die schnellen Antworten, jetzt schließen (immer noch nicht sicher, warum die Dinge schief gelaufen sind, aber jetzt funktioniert es zumindest!).
Link zu #10915 Code-Reorganisation PR.
Hallo, habe das gleiche Problem mit Django (Warnung mit genau demselben Fehler) und jede Neuinstallation, Cache leeren (Pip) funktioniert nicht. Irgendeine Idee, warum das passiert?
Danke!
@amehrdad88 das hat nichts mit Django zu numpy.__file__
inspizieren.
@amehrdad88 das hat nichts mit Django zu
numpy.__file__
inspizieren.
Ok danke, ich werde es überprüfen, obwohl ich gerade den Python-Installer von der offiziellen Website verwendet habe, dann virtualenv und alles andere von pip, also sollte kein größeres Problem darstellen! Ich werde versuchen, alles neu zu installieren.
@rgommers scheint ein Problem mit anderen Paketen zu sein, aber nicht sicher, welches. Ich habe alles neu installiert und hatte das gleiche Problem, also habe ich gerade ein Test-Venv mit nur numpy und tensorflow erstellt; Tensorflow importieren funktioniert. Wenn ich dann die anderen Pakete (mit pip) aus einer Requirements.txt-Datei installiere, erscheint der Fehler erneut, wenn ich versuche, tensorflow zu importieren.
Könnte es sein, dass eines der geladenen Pakete einen Fehler in Bezug auf numpy enthält? Würde dieses Paket geladen werden, auch wenn ich nur Tensorflow importiere?
Hinweis: Ich hatte auch eine Warnung "FutureWarning: Die Konvertierung des zweiten Arguments von issubdtype von float
in np.floating
ist veraltet", die durch die Aktualisierung von h5py verschwunden ist
@amehrdad88 Dieses Problem ist geschlossen. Bitte dokumentieren Sie genau, welche Befehle Sie ausführen, und versuchen Sie nach jedem Schritt nach der Installation von tensorflow, tensorflow zu importieren. Wenn Sie immer noch der Meinung sind, dass das Problem bei NumPy und nicht bei einem anderen Paket liegt, öffnen Sie eine neue Ausgabe und hängen Sie die Dokumentation zusammen mit der Ausgabe an.
Könnte es sein, dass eines der geladenen Pakete einen Fehler in Bezug auf numpy enthält? Würde dieses Paket geladen werden, auch wenn ich nur Tensorflow importiere?
nein, das ist ziemlich unwahrscheinlich. was passiert, ist wahrscheinlich pip
numpy irgendwie neu zu installieren, weil es über requirements.txt
eingezogen wird. Oder Sie haben irgendwo ein Paket auf Ihrem PYTHONPATH. Oder
Ich fange an, dieses Verhalten beim Erstellen meiner Anwendung auf CircleCI zu bemerken. In der Schale:
Python 2.7.14 (default, Sep 18 2017, 00:00:00)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import pandas as pd
ImportError: No module named _multiarray_umath
ImportError: No module named _multiarray_umath
ImportError: No module named _multiarray_umath
ImportError: No module named _multiarray_umath
>>> np.__file__
'/usr/local/lib/python2.7/dist-packages/numpy/__init__.pyc'
>>> pd.__file__
'/usr/local/lib/python2.7/dist-packages/pandas/__init__.pyc'
Dieser Build hat vor 4 Tagen gut funktioniert, aber jetzt schlägt mein Build fehl, ohne dass sich die Datei requirements.txt ändert. Hat sich in letzter Zeit etwas geändert? Ich verwende Numpy 1.14.3 und Pandas 0.20.3
Nur als Fortsetzung, pip install
zuerst numpy (getrennt) und dann haben Pandas den Trick für mich gemacht ...
Ich fange an, dieses Verhalten beim Erstellen meiner Anwendung auf CircleCI zu bemerken. In der Schale:
Python 2.7.14 (default, Sep 18 2017, 00:00:00) [GCC 4.8.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy as np >>> import pandas as pd ImportError: No module named _multiarray_umath ImportError: No module named _multiarray_umath ImportError: No module named _multiarray_umath ImportError: No module named _multiarray_umath >>> np.__file__ '/usr/local/lib/python2.7/dist-packages/numpy/__init__.pyc' >>> pd.__file__ '/usr/local/lib/python2.7/dist-packages/pandas/__init__.pyc'
Dieser Build hat vor 4 Tagen gut funktioniert, aber jetzt schlägt mein Build fehl, ohne dass sich die Datei requirements.txt ändert. Hat sich in letzter Zeit etwas geändert? Ich verwende Numpy 1.14.3 und Pandas 0.20.3
Ich habe das gleiche Problem, vor 3 Tagen funktionierte alles einwandfrei. Jetzt kommt plötzlich dieser Importfehler, wenn ich versuche, eingelegte Dateien zu laden
Das c-Erweiterungsmodul _multiarray_umath
ist neu in numpy 1.16.0 und kann irgendwo auf eine Mischung von Versionen oder Versionserwartungen hinweisen. Beachten Sie, dass dieses Problem geschlossen ist. Wenn Sie glauben, dass ein Problem mit numpy vorliegt, öffnen Sie bitte ein neues Problem, in dem genau beschrieben wird, was Sie tun.
Ich erhalte ein ähnliches Problem, wenn ich versuche, eingelegte Dateien zu laden:
with open(fl[0], 'rb') as f:
pickle.load(f)
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-24-571299641ef6> in <module>
1 with open(fl[0], 'rb') as f:
----> 2 pickle.load(f)
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
Vielleicht sollte dies wieder geöffnet werden. Bin mir nicht sicher ob das relevant ist.
Dies wird auch angezeigt, wenn versucht wird, pd.read_pickle
:
Vollständige Rückverfolgung
pd.read_pickle('/path/to/a/dataframe/foo.df')
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in try_read(path, encoding)
165 # We want to silencce any warnings about, e.g. moved modules.
--> 166 return read_wrapper(lambda f: pkl.load(f))
167 except Exception:
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in read_wrapper(func)
148 try:
--> 149 return func(f)
150 finally:
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in <lambda>(f)
165 # We want to silencce any warnings about, e.g. moved modules.
--> 166 return read_wrapper(lambda f: pkl.load(f))
167 except Exception:
ImportError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in try_read(path, encoding)
170 return read_wrapper(
--> 171 lambda f: pc.load(f, encoding=encoding, compat=False))
172 # compat pickle
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in read_wrapper(func)
148 try:
--> 149 return func(f)
150 finally:
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in <lambda>(f)
170 return read_wrapper(
--> 171 lambda f: pc.load(f, encoding=encoding, compat=False))
172 # compat pickle
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/compat/pickle_compat.py in load(fh, encoding, compat, is_verbose)
211
--> 212 return up.load()
213 except:
~/anaconda3/envs/py35/lib/python3.5/pickle.py in load(self)
1042 assert isinstance(key, bytes_types)
-> 1043 dispatch[key[0]](self)
1044 except _Stop as stopinst:
~/anaconda3/envs/py35/lib/python3.5/pickle.py in load_stack_global(self)
1350 raise UnpicklingError("STACK_GLOBAL requires str")
-> 1351 self.append(self.find_class(module, name))
1352 dispatch[STACK_GLOBAL[0]] = load_stack_global
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/compat/pickle_compat.py in find_class(self, module, name)
134 module, name = _class_locations_map.get(key, key)
--> 135 return super(Unpickler, self).find_class(module, name)
136
~/anaconda3/envs/py35/lib/python3.5/pickle.py in find_class(self, module, name)
1391 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1392 __import__(module, level=0)
1393 if self.proto >= 4:
ImportError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in read_pickle(path, compression)
176 try:
--> 177 return try_read(path)
178 except:
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in try_read(path, encoding)
174 return read_wrapper(
--> 175 lambda f: pc.load(f, encoding=encoding, compat=True))
176 try:
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in read_wrapper(func)
148 try:
--> 149 return func(f)
150 finally:
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in <lambda>(f)
174 return read_wrapper(
--> 175 lambda f: pc.load(f, encoding=encoding, compat=True))
176 try:
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/compat/pickle_compat.py in load(fh, encoding, compat, is_verbose)
211
--> 212 return up.load()
213 except:
~/anaconda3/envs/py35/lib/python3.5/pickle.py in load(self)
1042 assert isinstance(key, bytes_types)
-> 1043 dispatch[key[0]](self)
1044 except _Stop as stopinst:
~/anaconda3/envs/py35/lib/python3.5/pickle.py in load_stack_global(self)
1350 raise UnpicklingError("STACK_GLOBAL requires str")
-> 1351 self.append(self.find_class(module, name))
1352 dispatch[STACK_GLOBAL[0]] = load_stack_global
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/compat/pickle_compat.py in find_class(self, module, name)
134 module, name = _class_locations_map.get(key, key)
--> 135 return super(Unpickler, self).find_class(module, name)
136
~/anaconda3/envs/py35/lib/python3.5/pickle.py in find_class(self, module, name)
1391 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1392 __import__(module, level=0)
1393 if self.proto >= 4:
ImportError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in try_read(path, encoding)
165 # We want to silencce any warnings about, e.g. moved modules.
--> 166 return read_wrapper(lambda f: pkl.load(f))
167 except Exception:
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in read_wrapper(func)
148 try:
--> 149 return func(f)
150 finally:
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in <lambda>(f)
165 # We want to silencce any warnings about, e.g. moved modules.
--> 166 return read_wrapper(lambda f: pkl.load(f))
167 except Exception:
ImportError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in try_read(path, encoding)
170 return read_wrapper(
--> 171 lambda f: pc.load(f, encoding=encoding, compat=False))
172 # compat pickle
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in read_wrapper(func)
148 try:
--> 149 return func(f)
150 finally:
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in <lambda>(f)
170 return read_wrapper(
--> 171 lambda f: pc.load(f, encoding=encoding, compat=False))
172 # compat pickle
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/compat/pickle_compat.py in load(fh, encoding, compat, is_verbose)
211
--> 212 return up.load()
213 except:
~/anaconda3/envs/py35/lib/python3.5/pickle.py in load(self)
1042 assert isinstance(key, bytes_types)
-> 1043 dispatch[key[0]](self)
1044 except _Stop as stopinst:
~/anaconda3/envs/py35/lib/python3.5/pickle.py in load_stack_global(self)
1350 raise UnpicklingError("STACK_GLOBAL requires str")
-> 1351 self.append(self.find_class(module, name))
1352 dispatch[STACK_GLOBAL[0]] = load_stack_global
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/compat/pickle_compat.py in find_class(self, module, name)
134 module, name = _class_locations_map.get(key, key)
--> 135 return super(Unpickler, self).find_class(module, name)
136
~/anaconda3/envs/py35/lib/python3.5/pickle.py in find_class(self, module, name)
1391 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1392 __import__(module, level=0)
1393 if self.proto >= 4:
ImportError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-44-2ad6813d006d> in <module>()
----> 1 pd.read_pickle('/Users/riley/main/build_0003/reps/lobsang/konami-api/src/app/v0/foo.df')
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in read_pickle(path, compression)
178 except:
179 if PY3:
--> 180 return try_read(path, encoding='latin1')
181 raise
182
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in try_read(path, encoding)
173 except:
174 return read_wrapper(
--> 175 lambda f: pc.load(f, encoding=encoding, compat=True))
176 try:
177 return try_read(path)
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in read_wrapper(func)
147 is_text=False)
148 try:
--> 149 return func(f)
150 finally:
151 for _f in fh:
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/io/pickle.py in <lambda>(f)
173 except:
174 return read_wrapper(
--> 175 lambda f: pc.load(f, encoding=encoding, compat=True))
176 try:
177 return try_read(path)
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/compat/pickle_compat.py in load(fh, encoding, compat, is_verbose)
210 up.is_verbose = is_verbose
211
--> 212 return up.load()
213 except:
214 raise
~/anaconda3/envs/py35/lib/python3.5/pickle.py in load(self)
1041 raise EOFError
1042 assert isinstance(key, bytes_types)
-> 1043 dispatch[key[0]](self)
1044 except _Stop as stopinst:
1045 return stopinst.value
~/anaconda3/envs/py35/lib/python3.5/pickle.py in load_stack_global(self)
1349 if type(name) is not str or type(module) is not str:
1350 raise UnpicklingError("STACK_GLOBAL requires str")
-> 1351 self.append(self.find_class(module, name))
1352 dispatch[STACK_GLOBAL[0]] = load_stack_global
1353
~/anaconda3/envs/py35/lib/python3.5/site-packages/pandas/compat/pickle_compat.py in find_class(self, module, name)
133 key = (module, name)
134 module, name = _class_locations_map.get(key, key)
--> 135 return super(Unpickler, self).find_class(module, name)
136
137 else:
~/anaconda3/envs/py35/lib/python3.5/pickle.py in find_class(self, module, name)
1390 elif module in _compat_pickle.IMPORT_MAPPING:
1391 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1392 __import__(module, level=0)
1393 if self.proto >= 4:
1394 return _getattribute(sys.modules[module], name)[0]
ImportError: No module named 'numpy.core._multiarray_umath'
@rileypeterson Dies kann ein Duplikat von Ausgabe Nr. 12837 sein. In jedem Fall werden die Beizprobleme mit 1.16.0 durch #12842 behoben (in #12869 auf 1.16.1 zurückportiert). Es wird mit der Version 1.16.1 behoben.
pip install --upgrade numpy
dies entfernt die vorherige Version und installiert die neuere Version .. dies hat das Problem für mich gelöst
Ich habe das gleiche Problem, numpy.core._multiarray_umath konnte nicht importiert werden
Ich finde es endlich heraus,Es liegt daran, dass die numpy-Version zu niedrig ist, aktualisiere numpy auf 1.16.2 und alles ist in Ordnung
Deinstallieren Sie numpy und aktualisieren und aktualisieren Sie es dann
pip install -U numpy upgrade numpy drauf
Das hat geklappt :)
pip install --upgrade numpy
in der Anaconda-Eingabeaufforderung:
pip uninstall numpy
dann:
pip install numpy
hat bei mir funktioniert!
Hallo,
Es gibt eine Reihe von Paketen, die ich installiere, die NumPy erfordern (z. B. TensorFlow), und ich kann sie aufgrund eines ImportError auf der Numpy-Seite anscheinend nicht installieren und importieren.
Dies geschieht sowohl bei der Pip-Installation als auch beim Erstellen aus der Quelle.
Beispiel für Reproduktionscode:
importiere numpy als np
Tensorflow als tf importieren
Fehlermeldung:
ImportError: numpy.core._multiarray_umath konnte nicht importiert werdenNumpy/Python-Versionsinformationen:
'1.16.0.dev0+cdbf35b'
Ich habe das gleiche Problem gehabt.
Ich habe das Problem gelöst, indem ich Theano, Tensorflow und Keras deinstalliert habe; installierte sie dann in dieser Reihenfolge:
Deinstallieren Sie numpy und aktualisieren und aktualisieren Sie es dann
Ich werde dich nehmen! Wenn jemand Fragen auf Englisch stellt, antwortet man auf Chinesisch!
@datanshi21 unsere offizielle sprache ist englisch. Der Google-Übersetzer sagt, dass Ihr Kommentar "Numpy deinstallieren und aktualisieren" lautet
Bedienen Sie sich einfach! Andere stellen Fragen auf Englisch, du antwortest auf Chinesisch!"
Bist du ein Bot?
pip install --upgrade numpy --user
hat mir den Fehler gegeben:
mxnet-mkl 1.4.0 has requirement numpy<1.15.0,>=1.8.2, but you'll have numpy 1.16.3 which is incompatible.
Alles funktionierte nach der Deinstallation von mxnet-mkl
.
Es begann für mich zu funktionieren, als ich Pandas installierte. Keine Ahnung warum.
https://github.com/numpy/numpy/issues/11871#issuecomment -487995082
Pandas installieren numpy als Abhängigkeit.
Hilfreichster Kommentar
pip install --upgrade numpy
dies entfernt die vorherige Version und installiert die neuere Version .. dies hat das Problem für mich gelöst