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
ImportError is misleading when importing an old multiarray in NumPy 1.16.1 #12976
Comments
@mattip I think we should try using |
@charris what error scenario would that mitigate? It would not help in this case. |
Pretty sure that the description of |
@eric-wieser The documentation is for Python 3.7.2. What we need is a way to replicate the problem so we can test things. |
The description of this issue provides one. Faster way: use your regular in-place dev build, and just copy in a |
@rgommers So the problem is duplicate files with different extensions in the same directory? |
Unless I'm missing something, yes. It's this: https://github.com/numpy/numpy/pull/12850/files Reports on this stuff are daily, I think we need a better solution here. I didn't follow very closely though, there were multiple proposed solutions but no water tight ones yet. |
The daily reports are a different issue altogether. Anaconda recently broke setting os.environ['PATH']. |
@mattip you're right, that one is worse. This is also common though, e.g. gh-12938, gh-12736, gh-12826, #12957 (comment) |
I had this error. It was due to multiple instances of numpy. It seems python is looking for numpy packages not numpy installations. Following the advice from the error handler in bash and uninstalling numpy won't remove the error because python can still see the uninstalled packages. |
that isn't a well-defined distinction
then the uninstall was incomplete. uninstall with pip should remove both |
If you use conda, you can update numpy by |
Use pip uninstall numpy |
Try repeatedly until you purge all numpy versions. |
For Ubuntu: I solve it by |
I install NumPy from source. I recently checked out the 1.16.1 tag and when I imported the built and installed NumPy, I get
The directory pointed there is the directory of the currently installed NumPy. When I looked in
numpy/core/__init__.py
, I saw the other error message, which includes thegit clean -xdf
command. When I ran this in the git repo, I could build and install successfully. So I believe it would be useful for both of those cases to include the instructions that normally occur whenmultiarray
can't be imported. (line 19 incore/__init__.py
).Alternatively, we could detect if the path given by
sys.modules['numpy'].__path__
is the same as the one we would get by looking at__file__
to determine if it is a weird version error or just an oldmultiarray
sticking around.Reproducing code example:
Check out an old release like 1.15.1 and build from source. Check out 1.16.1, build again and install. Then
Error message:
Numpy/Python version information:
The text was updated successfully, but these errors were encountered: