#58044 closed defect (invalid)
Importing numpy in Python3.7 fails
Reported by: | fmw42 (Fred Weinhaus) | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.5.4 |
Keywords: | Cc: | ||
Port: | py-numpy |
Description (last modified by mf2k (Frank Schima))
On Mac OSX Sierra, I can load Python3.7 interactively. But it will not import numpy (py37-numpy 1.15.4_0+gfortran)
I get the following:
python3.7 Python 3.7.2 (default, Dec 30 2018, 09:00:52) [Clang 9.0.0 (clang-900.0.39.2)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import numpy Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/core/__init__.py", line 16, in <module> from . import multiarray ImportError: cannot import name 'multiarray' from 'numpy.core' (/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/core/__init__.py) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module> from . import add_newdocs File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/add_newdocs.py", line 13, in <module> from numpy.lib import add_newdoc File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/lib/__init__.py", line 8, in <module> from .type_check import * File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/lib/type_check.py", line 11, in <module> import numpy.core.numeric as _nx File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/core/__init__.py", line 26, in <module> raise ImportError(msg) ImportError: Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy. If you're working with a numpy git repo, try `git clean -xdf` (removes all files not under version control). Otherwise reinstall numpy. Original error was: cannot import name 'multiarray' from 'numpy.core' (/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/core/__init__.py)
Can you identify if I am doing something wrong or is this an issue with numpy?
Change History (7)
comment:1 Changed 6 years ago by fmw42 (Fred Weinhaus)
Description: | modified (diff) |
---|
comment:2 Changed 6 years ago by fmw42 (Fred Weinhaus)
comment:3 Changed 6 years ago by michaelld (Michael Dickens)
What does echo $PYTHONPATH
return? It should either be empty, or contain directories that are specific to your Py37 install. If it contains the Py36 directories, then you need to update the PYTHONPATH accordingly for Py37.
comment:4 Changed 6 years ago by fmw42 (Fred Weinhaus)
Thanks. That did the trick. I edited my .profile file to change from 36 to 37 and then rebooted my system. Now I can import bumpy. Sorry for the false alarm. I did not recall that entry in my .profile file.
You may close this ticket.
comment:5 Changed 6 years ago by mf2k (Frank Schima)
Keywords: | python numpy removed |
---|---|
Port: | py-numpy added; numpy removed |
Resolution: | → invalid |
Status: | new → closed |
In the future, please use WikiFormatting, fill in the Port field with the actual port name and add the port maintainer(s) to Cc (port info --maintainers py37-numpy
), if any.
comment:6 Changed 6 years ago by mf2k (Frank Schima)
Description: | modified (diff) |
---|
comment:7 Changed 6 years ago by fmw42 (Fred Weinhaus)
I tried the WikiFormatting to add {{{ .....
}}}, but it seemed to show the braces in the viewed post. So I removed them. Here it seems to work. Not sure why it did not work in my post.
I tried to clean py37-numpy and reinstall it. But that did not help.
It looks perhaps like in it getting installed in python3.6 rather than python3.7 (from the error message) and is not importable from python3.7 when it is linked to python3.6. But that is just a guess on my part.