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

Importing numpy: #13252

Closed
danhamill opened this issue Apr 2, 2019 · 6 comments
Closed

Importing numpy: #13252

danhamill opened this issue Apr 2, 2019 · 6 comments

Comments

@danhamill
Copy link

I am having trouble importing numpy using hydrogen (atom plugin). The remote kenel connects to fine and I can import other packages, but fails with the information below.

I can import numpy in a jupyter notebook, ipython, and a python interpretor.

Reproducing code example:

I installed python using Anaconda:

conda version : 4.6.9
conda-build version : 3.17.8

I installed numpy using

conda install numpy

My OS:

Windows/10 Windows/10.0.17134

Steps to reproduce:

import numpy as np

Error message:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
C:\Anaconda3\lib\site-packages\numpy\core\__init__.py in <module>
     39 try:
---> 40     from . import multiarray
     41 except ImportError as exc:

C:\Anaconda3\lib\site-packages\numpy\core\multiarray.py in <module>
     11 
---> 12 from . import overrides
     13 from . import _multiarray_umath

C:\Anaconda3\lib\site-packages\numpy\core\overrides.py in <module>
      5 
----> 6 from numpy.core._multiarray_umath import (
      7     add_docstring, implement_array_function, _get_implementing_args)

ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-2-0aa0b027fcb6> in <module>
----> 1 import numpy as np

C:\Anaconda3\lib\site-packages\numpy\__init__.py in <module>
    140     from . import _distributor_init
    141 
--> 142     from . import core
    143     from .core import *
    144     from . import compat

C:\Anaconda3\lib\site-packages\numpy\core\__init__.py in <module>
     69 Original error was: %s
     70 """ % (sys.executable, exc)
---> 71     raise ImportError(msg)
     72 finally:
     73     for envkey in env_added:

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:\Anaconda3\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.

Numpy/Python version information:

>>> np.__version__
'1.16.2'
@bv-research
Copy link

@danhamill I see that the file overrides.py and add_docstring function is in your output error message, may be related to the next issue: #13248

@mattip
Copy link
Member

mattip commented Apr 7, 2019

This error is not connected to add_docstring.

It may be due to how hydrogen and atom are initializing the anaconda environment, since ipython and jupyter notebook work. Can you open an issue there and xref this one (if they are on github you can use the numpy/numpy#13252 string in that issue which will link it back to here).

@danhamill
Copy link
Author

Update

This is an elusive problem that I would not wish on my worst enemy. Luckily I found a workaround that worked on my computer, but not likely for others.

pip uninstall numpy
pip uninstall pandas
pip install pandas

Re-installing pandas (which requires numpy) seemed to do the trick.

np.__version__
Out[2]: '1.16.2'

pd.__version__
Out[4]: '0.24.2'

I can now import numpy using Hydrogen with out any error.

@mattip
Copy link
Member

mattip commented Apr 10, 2019

Glad you solved it. Did you try pip uninstall numpy, pip install numpy before the solution you found?

@danhamill
Copy link
Author

Yes, I started with trying to directly uninstall/install numpy using pip.

This issue is related to hydrogen issue #1550. Initally I could not get Hydrogen to connect to the kernel created using ipykernel. After reinstalling pyzmq I could import base python base libraries, but not numpy.

At this point, I received the traceback presented in #1517. After uninstalling numpy with pip and reinstalling conda as suggested in #13009

conda uninstall numpy
pip install numpy

I came across the traceback that that encouraged me to open this ticket.

It was more dumb luck that I found uninstalling and reinstalling pandas would provide a viable workaround.

@alpmar
Copy link

alpmar commented Jun 11, 2019

Yes, an elusive problem it is. Installing pandas did not do it for me. Homebrew Python 3.7 in my case. I keep searching and may open a case too.

@mattip mattip closed this as completed Jul 17, 2019
@numpy numpy deleted a comment from kingsyard May 24, 2021
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

4 participants