Numpy: 没有名为“numpy.core._multiarray_umath”的模块

创建于 2019-02-16  ·  23评论  ·  资料来源: numpy/numpy

我刚刚在 anaconda3 中安装了 TensorFlow、Keras。

C:\conda create --name neuralnets python=3.7
C:\activate neuralnets

(neuralnets) C:\conda install theano
(neuralnets) C:\conda install mingw libpython
(neuralnets) C:\pip install tensorflow
(neuralnets) C:\pip install keras

重现代码示例:

执行了这个命令:

(neuralnets) C:\python -c "from keras import backend; print(backend._BACKEND)"

得到以下错误:

Traceback (most recent call last):
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py", line 16, in <module>
    from . import multiarray
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\overrides.py", line 6, in <module>
    from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import utils
  File "C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\lib\site-packages\keras\utils\__init__.py", line 2, in <module>
    from . import np_utils
  File "C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\lib\site-packages\keras\utils\np_utils.py", line 6, in <module>
    import numpy as np
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py", line 47, in <module>
    raise ImportError(msg)
ImportError:
import numpy as np
<< your code here >>

错误信息:

Numpy/Python 版本信息:

有人可以帮忙吗? 我是使用 keras 和 tensorflow 的新手。 我将它用于我本学期正在上的一门课。

谢谢

29 - InteAnaconda

最有用的评论

pip install tensorflow从 PyPI 中提取了 numpy。 尝试

pip uninstall numpy
conda install numpy

这可能会解决问题

所有23条评论

由于ContinuumIO/anaconda-issues#10628,可能是 #12957 的

anaconda 提供的额外支持库的位置与您从pip install获得的股票 numpy 提供的支持库的位置不同。 这需要调整PATH变量。 也许PATH调整在导入时失败。 site-packages\numpy\.libs目录是否存在并且它是否包含*.dll文件?如果是这样,您可以尝试在运行 python 之前将该目录添加到您的PATH

rem This fails
python -c "import numpy"

rem Does this succeed ??? 
PATH=path\to\site-packages\numpy\.libs;%PATH%
python -c "import numpy"

但是在您的情况下,情况有所不同,numpy 的路径缺少路径分隔符: C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core__init__.py应该是C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py 。 那是复制粘贴错误吗?

numpy 的路径缺少路径分隔符:

只是一个 github 格式问题,用```包裹起来就消失了

@bsathyan :您没有向我们展示完整的错误信息。 您也可以粘贴最后一个ImportError之后的部分吗?

下面附上的@eric-wieser 是完整的错误线程。 如果您需要其他任何东西,请告诉我。

谢谢 :)

(neuralnets) C:\Users\Z0035HPP>python -c "from keras import backend; print(backend._BACKEND)"
Traceback (most recent call last):
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py", line 16, in <module>
    from . import multiarray
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\overrides.py", line 6, in <module>
    from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import utils
  File "C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\lib\site-packages\keras\utils\__init__.py", line 2, in <module>
    from . import np_utils
  File "C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\lib\site-packages\keras\utils\np_utils.py", line 6, in <module>
    import numpy as np
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "C:\Users\Z0035HPP\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py", line 47, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
  your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
  1. Check that you are using the Python you expect (you're using C:\Users\Z0035HPP\AppData\Local\Continuum\anaconda3\envs\neuralnets\python.exe),
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy versions you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

     Note: this error has many possible causes, so please don't comment on
     an existing issue about this - open a new one instead.

Original error was: No module named 'numpy.core._multiarray_umath'

我也面临同样的问题。

Traceback (most recent call last):
  File "F:\Anaconda\envs\Final_Project\lib\site-packages\numpy\core\__init__.py", line 16, in <module>
    from . import multiarray
  File "F:\Anaconda\envs\Final_Project\lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "F:\Anaconda\envs\Final_Project\lib\site-packages\numpy\core\overrides.py", line 9, in <module>
    from numpy.core._multiarray_umath import add_docstring, ndarray
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "F:/Python Programs/Final Project/scratch_6.py", line 1, in <module>
    import tensorflow as tf
  File "F:\Anaconda\envs\Final_Project\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "F:\Anaconda\envs\Final_Project\lib\site-packages\tensorflow\python\__init__.py", line 47, in <module>
    import numpy as np
  File "F:\Anaconda\envs\Final_Project\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "F:\Anaconda\envs\Final_Project\lib\site-packages\numpy\core\__init__.py", line 47, in <module>
    raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
Here is how to proceed:
- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.
- If you are simply trying to use the numpy version that you have installed:
  your installation is broken - please reinstall numpy.
- If you have already reinstalled and that did not fix the problem, then:
  1. Check that you are using the Python you expect (you're using F:\Anaconda\envs\Final_Project\python.exe),
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy versions you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

     Note: this error has many possible causes, so please don't comment on
     an existing issue about this - open a new one instead.

Original error was: DLL load failed: The specified module could not be found.

上面评论中建议的修复有帮助吗? 这是 Anaconda 的一个已知问题。

不,路径对我来说已经是正确的。 是的,这是 anaconda 的问题。 我对相同的代码使用了虚拟环境,它运行得很好。 anaconda 似乎有问题。

pip install tensorflow从 PyPI 中提取了 numpy。 尝试

pip uninstall numpy
conda install numpy

这可能会解决问题

你好,
我遇到了同样的问题并按照建议使用 pip 卸载 numpy 并使用 conda 再次安装它 - 但没有成功。
但是,我试图让tensorboard使用以下 ImportError 运行,不完全相同,但可能相关:

ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
SystemError: <class '_frozen_importlib._ModuleLockManager'> returned a result with an error set
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
2019-02-26 21:41:23.671349: F tensorflow/python/lib/core/bfloat16.cc:675] Check failed: PyBfloat16_Type.tp_base != nullptr 
Abort trap: 6

你好,
我遇到了同样的问题并按照建议使用 pip 卸载 numpy 并使用 conda 再次安装它 - 但没有成功。
但是,我试图让tensorboard使用以下 ImportError 运行,不完全相同,但可能相关:

ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
SystemError: <class '_frozen_importlib._ModuleLockManager'> returned a result with an error set
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
2019-02-26 21:41:23.671349: F tensorflow/python/lib/core/bfloat16.cc:675] Check failed: PyBfloat16_Type.tp_base != nullptr 
Abort trap: 6

您是否使用 3.6 python 运行 tensorlow ? Tensorflow 根本不适用于 python 3.7。
我建议你这样做:

  1. 创建一个新的 3.6 python 环境,你可以通过从终端运行它来做到这一点,假设你有 anaconda:
    conda create --name tensorflow python=3.6

    1. 激活张量流:

      激活张量流

  2. 激活后,尝试安装所有软件包。

@mjahmad
感谢您的回复。 事实上,我在我的环境中运行 Python 3.6.7

好的,我现在明白了。 只是为了分享以防万一可能对您有用。
我再次卸载了tensorflow并且只安装了张量板的1.12版本:
pip install tensorboard==1.12
现在工作

你好!
我在python3.7中成功安装了tensorflow

  • 首次安装失败消息:ModuleNotFoundError:没有名为“numpy.core._multiarray_umath”的模块
  • ModuleNotFoundError :没有名为“numpy.core._multiarray_umath”的模块

pip卸载numpy
pip 安装 numpy
pip卸载张量流
pip 安装张量流

将张量流导入为 tf
成功:> 谢谢

pip install tensorflow从 PyPI 中提取了 numpy。 尝试

pip uninstall numpy
conda install numpy

这可能会解决问题

这解决了我的问题,谢谢

你好,

我有同样的问题并在 3.7 和 3.6 环境中尝试过。 但是仍然出现以下错误:

从 keras.models 导入顺序

使用 TensorFlow 后端。

ModuleNotFoundError 追溯(最近一次调用最后一次)
ModuleNotFoundError:没有名为“numpy.core._multiarray_umath”的模块

!pip uninstall numpy
不起作用。 它运行和运行没有任何结果。

谢谢!

好的,对不起,我解决了这个问题。 也许它会帮助你:
更新到最新版本的 numpy :D
!pip install --upgrade numpy


你好
谢谢你给我寄来这封邮件。
互相帮助,互相分享解决难题
我们开始做吧。 今天过得愉快。
世界是你的。 :D
- - -原始信息 - - -
来自:“马里奥”通知@ github.com
至:“numpy/numpy” [email protected]
抄送:“kobilinux” [email protected] ; "评论" [email protected] ;
发送时间:2019-03-14 (목) 06:21:15 (GMT+09:00)
主题:回复:[numpy/numpy] 没有名为“numpy.core._multiarray_umath”的模块 (#12977)

你好,
我有同样的问题并在 3.7 和 3.6 环境中尝试过。 但是仍然出现以下错误:
从 keras.models 导入顺序

使用 TensorFlow 后端。

ModuleNotFoundError 追溯(最近一次调用最后一次)
ModuleNotFoundError:没有名为“numpy.core._multiarray_umath”的模块
!pip 卸载 numpy
不起作用。 它运行和运行没有任何结果。
谢谢!

好的,对不起,我解决了这个问题。 也许它会帮助你:
更新到最新版本的 numpy :D
!pip install --upgrade numpy

您收到此消息是因为您发表了评论。
直接回复此邮件,在 GitHub 上查看,或将线程静音。

关闭。 希望这些问题已经在 Anaconda 方面得到解决,这里的一些建议似乎并不理想。 最好的解决方案似乎是

pip uninstall numpy
conda install numpy

你好!
我在python3.7中成功安装了tensorflow

  • 首次安装失败消息:ModuleNotFoundError:没有名为“numpy.core._multiarray_umath”的模块
  • ModuleNotFoundError :没有名为“numpy.core._multiarray_umath”的模块

pip卸载numpy
pip 安装 numpy
pip卸载张量流
pip 安装张量流

将张量流导入为 tf
成功:> 谢谢

这对我有用,谢谢

你好
我在访问 tensorflow 时遇到同样的错误,如下所示。

ModuleNotFoundError 追溯(最近一次调用最后一次)ModuleNotFoundError:没有名为“numpy.core._multiarray_umath”的模块

解决方案:- 使用最新版本更新 Numpy

setp 更新 numpy 如下

setp1 打开 cmd
setp2 写 pip install numpy== leatest version然后按 Enter
示例 pip install numpy==1.16.2

pip install tensorflow从 PyPI 中提取了 numpy。 尝试

pip uninstall numpy
conda install numpy

这可能会解决问题

这对我也有用。 看起来安装 tensorflow 的 pip 添加了第二个版本的 numpy

我遇到了同样的错误,我通过使用 anaconda 创建虚拟环境,然后安装必要的库来解决它,它起作用了。

我遇到了同样的问题,并通过运行以某种方式解决了它
``
pip卸载numpy
康达安装numpy
pip 安装 numpy

看起来这个错误是因为在您的特定环境中没有正确安装多个软件包。 对我来说,jupyter notebook 没有安装在那个特定的虚拟环境中。 我按照上面的评论:

pip uninstall numpy
conda install numpy
pip install numpy 

然后以下修复了它:

conda install jupyter
conda install -c conda-forge matplotlib 
conda install -c anaconda pandas

现在,当您从环境中打开 jupyter notebook 并编写以下内容时:

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow as tf

没有错误。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

astrofrog picture astrofrog  ·  4评论

qualiaa picture qualiaa  ·  3评论

ghost picture ghost  ·  4评论

inducer picture inducer  ·  3评论

Foadsf picture Foadsf  ·  3评论