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

ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' #73

Closed
ckyleda opened this issue Jan 8, 2019 · 30 comments
Closed

Comments

@ckyleda
Copy link

ckyleda commented Jan 8, 2019

When attempting to run the q01 example the following error occurs:

ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

Traceback (most recent call last):
File "/home/[REMOVED]/.local/share/virtualenvs/q01-9tU7-qwB/bin/pylivetrader", line 7, in
from pylivetrader.main import main
File "/home/[REMOVED]/.local/share/virtualenvs/q01-9tU7-qwB/lib/python3.6/site-packages/pylivetrader/init.py", line 16, in
from pylivetrader import api # noqa
File "/home/[REMOVED]/.local/share/virtualenvs/q01-9tU7-qwB/lib/python3.6/site-packages/pylivetrader/api.py", line 24, in
from pylivetrader.finance import execution, commission, slippage, cancel_policy
File "/home/[REMOVED]/.local/share/virtualenvs/q01-9tU7-qwB/lib/python3.6/site-packages/pylivetrader/finance/execution.py", line 22, in
import pylivetrader.misc.math_utils as zp_math
File "/home/[REMOVED]/.local/share/virtualenvs/q01-9tU7-qwB/lib/python3.6/site-packages/pylivetrader/misc/math_utils.py", line 53, in
nanmean = bn.nanmean
AttributeError: module 'bottleneck' has no attribute 'nanmean'

This is in a fresh pipenv after running pipenv install inside the example directory.

This could be due to the version of numpy (1.14.6) required not containing this module. However, official documentation on what _multiarray_umath actually is or when it was added is very sparse.

Testing numpy versions myself, I can import this module when using numpy 1.16.0rc2. Which dependency requires this version of numpy?

Has anyone run into this and resolved it?

@ckyleda
Copy link
Author

ckyleda commented Jan 8, 2019

This seems to be because bottleneck and bcolz aren't interacting correctly with the pipenv environment.

Installing them both manually via pip fixes this issue, but obviously you cannot do this on a heroku instance.

@umitanuki
Copy link
Contributor

Recently someone else also reported numpy install issue in Heroku elsewhere. Something like heroku/heroku-buildpack-python#704 is closest. There might be an issue in their CLI or something.

@ckyleda
Copy link
Author

ckyleda commented Jan 8, 2019

@umitanuki This issue actually also occurs locally as well, I don't think it's purely a heroku issue.

@ttt733
Copy link
Contributor

ttt733 commented Jan 9, 2019

quantopian/zipline#997

It looks like this is a known issue that can be caused by several things. If a clean install isn't working for you, can you walk us through the installation path you're using? It could be a cached wheel like someone mentioned there, or it could somehow be switching numpy versions unexpectedly.

@ckyleda
Copy link
Author

ckyleda commented Jan 10, 2019

@ttt733

I'm simply running 'pipenv install' inside the q01 folder.

I did manage to resolve this by using pipenv to generate a requirements.txt and installing using pip, after which I was able to proceed.

@bibinmjose
Copy link

I have the same problem when I try to load a pickled file

     19 def load_pickle(path):
     20     with open(path, 'rb') as handle:
---> 21         return pickle.load(handle)
     22 
     23 

ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

@zchen0420
Copy link

zchen0420 commented Jan 20, 2019

I have the same problem when I try to load a pickled file

     19 def load_pickle(path):
     20     with open(path, 'rb') as handle:
---> 21         return pickle.load(handle)
     22 
     23 

ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

I had the same error with numpy=1.16
But safe with numpy=1.15

@batrlatom
Copy link

Had the same issue. Upgraded to numpy==1.16 and it works

@bibinmjose
Copy link

bibinmjose commented Jan 21, 2019

I have tried both and even checked out numpy's code. I can't find that module ('numpy.core._multiarray_umath') anywhere in numpy. Has anyone tried that?

@wingkitlee0
Copy link

      I have tried both and even checked out numpy's code. I can't find that module ('numpy.core._multiarray_umath') anywhere in numpy. Has anyone tried that?

I found a few shared library files (*.so) in numpy/core/ , such as multiarray.cpython-36m-x86_64-linux-gnu.so .

@saforem2
Copy link

@bibinmjose For what it's worth, same issue here when using pickle.load (pickle=4.0) with numpy=1.15.

@bibinmjose
Copy link

bibinmjose commented Jan 22, 2019

@saforem2 Me too noticed the problem when i try to unpickle a pickled bumpy array from another computer. I got around it by using python's statistics functions instead of numpy's. I tried to install numpy==16 but the story is the same. I was not able to upgrade numpy-base from 1.14 since it uninstalls a lot of dependencies.

@bibinmjose
Copy link

bibinmjose commented Jan 22, 2019

@saforem2 are you picking any numpy objects ? Try using another library. That might work.

@saforem2
Copy link

@bibinmjose I believe the error occurred when trying to load a normal dictionary (containing some numpy arrays as values). I switched to a different conda environment with numpy.__version__=1.16.0 and pickle.format_version=4.0 and it seems to work fine so I was able to get around the issue.

@jainraje
Copy link

jainraje commented Feb 2, 2019

I have this error recently since a few changes on my MAC. I followed all the best practices and can't seem to resolve this error.

  1. Upgraded to MAC High Sierra (10.13.6)

  2. installed both python 3.6 and python 3.7 to run side by side using home-brew and followed the guidelines presented here:
    https://stackoverflow.com/questions/51726203/installing-python3-6-alongside-python3-7-on-mac

  3. setup new virtual env to use python 3.6.5 and a bunch of other modules.

This error occurs in the virtual environment. Both notebooks and command line python code generate the error. The python code runs 100% correctly with no other errors than this message.

python my_py_file.py
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

I deleted and recreated the venv but the error persists. Likely all the code continues to run without any other errors.

I'm not sure what to do next. I do not like this error message. Any suggestions will be welcome.

@jainraje
Copy link

jainraje commented Feb 2, 2019

FYI, I just resolved this issue by forcing a reinstall of numpy and pandas as follows:

pip install --upgrade --force-reinstall numpy==1.14.5
pip install --upgrade --force-reinstall pandas==0.22.0

No more error message.

@wishvivek
Copy link

wishvivek commented Feb 4, 2019

Inside a new conda virtual environment,

  1. Solved it by using pip install numpy==1.16
  2. Was using conda install numpy before that. The conda install option was throwing the same issue.

@TshepoMK
Copy link

Inside a new conda virtual environment,

  1. Solved it by using pip install numpy==1.16
  2. Was using conda install numpy before that. The conda install option was throwing the same issue.

Thanks man, I installed numpy 1.16 and it fixed the issue.

@Memento1990
Copy link

Inside a new conda virtual environment,

  1. Solved it by using pip install numpy==1.16
  2. Was using conda install numpy before that. The conda install option was throwing the same issue.

Thanks man, it solves the problem.

@ttt733
Copy link
Contributor

ttt733 commented Mar 8, 2019

I've updated the numpy requirement to 1.16 across our various pylivetrader releases, and we'll try to keep the required numpy version as updated as possible, so this issue should not crop up anymore.

@ttt733 ttt733 closed this as completed Mar 8, 2019
@Adarshsng
Copy link

Adarshsng commented Mar 8, 2019

upgrade numpy to latest version it solves the problem ^.^

@live-wire
Copy link

pip install --upgrade numpy

@bibinmjose
Copy link

@live-wire Problem is most often upgrading numpy will cause broken dependencies in other packages

#73 (comment)

@ninofiliu
Copy link

@bibinmjose How come? I though that 1.15 -> 1.16 = minor update = no breaking changes

@bibinmjose
Copy link

@ninofiliu There was some compatibility issue with my tensorflow version and it was not upgrading numpy citing conflicts. Anyways, I have moved on and it's no longer an issue for me.

#73 (comment)

@VineetJain22
Copy link

I am facing a similar issue when trying to load a pickled file. Code, error & versions below.
Code:
infile = open('_test_suite.pkl','rb')
new_dict = pickle.load(infile)
infile.close()
Error:
ModuleNotFoundError Traceback (most recent call last)
in ()
1 infile = open('_test_suite.pkl','rb')
----> 2 new_dict = pickle.load(infile)
3 infile.close()

ModuleNotFoundError: No module named 'core'
Version:
Numpy 1.16.2
Pandas 0.24.2
Pickle 4.0

Tried pandas.read_pickle() too. It gives a similar No module named 'core' error.

Any suggestion will be helpful.

@AmanOswal
Copy link

Had the same issue. Reinstalling numpy fixed it

@13540148299
Copy link

Same issue. Upgrading numpy to 1.16 fixed it,thanks

@Hedibouchelliga
Copy link

Hedibouchelliga commented Apr 6, 2020

for future readors , this how i fixed it :
pip uninstall numpy
then delete the folder with the name numpy
conda install -c anaconda numpy
and that's how it works

@zhangleibo
Copy link

--- import sys ---
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core_init_.py", line 22, in
from . import multiarray
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\multiarray.py", line 12, in
from . import overrides
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core\overrides.py", line 7, in
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 "./Python\func.py", line 5, in
from modSymmetryLanding import modSymmetryLanding
File "./Python\modSymmetryLanding.py", line 6, in
import numpy as np
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy_init_.py", line 140, in
from . import core
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\core_init_.py", line 48, in
raise ImportError(msg)
ImportError:

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

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  • The Python version is: Python3.6 from "D:\worker\LGAS\LandingGearsAnalysisSystem..\bin\Debug\LGAnalysisSystem.exe"
  • The NumPy version is: "1.19.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

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

2020-09-24 16:07:54:027 [Inf]CInterface::CallPython,Line=166 ******************** Python end ****

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