FS#57926 - Cannot import numpy: AttributeError
Attached to Project:
Arch Linux
Opened by Alex Seiler (aexl) - Friday, 23 March 2018, 12:02 GMT
Last edited by Eli Schwartz (eschwartz) - Friday, 23 March 2018, 13:10 GMT
Opened by Alex Seiler (aexl) - Friday, 23 March 2018, 12:02 GMT
Last edited by Eli Schwartz (eschwartz) - Friday, 23 March 2018, 13:10 GMT
|
Details
Description: Importing numpy in a python console leads to
the following:
Python 3.6.4 (default, Jan 5 2018, 02:35:40) [GCC 7.2.1 20171224] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numpy Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module> from . import add_newdocs File "/usr/lib/python3.6/site-packages/numpy/add_newdocs.py", line 13, in <module> from numpy.lib import add_newdoc File "/usr/lib/python3.6/site-packages/numpy/lib/__init__.py", line 8, in <module> from .type_check import * File "/usr/lib/python3.6/site-packages/numpy/lib/type_check.py", line 11, in <module> import numpy.core.numeric as _nx File "/usr/lib/python3.6/site-packages/numpy/core/__init__.py", line 35, in <module> from . import _internal # for freeze programs File "/usr/lib/python3.6/site-packages/numpy/core/_internal.py", line 18, in <module> from .numerictypes import object_ File "/usr/lib/python3.6/site-packages/numpy/core/numerictypes.py", line 960, in <module> _register_types() File "/usr/lib/python3.6/site-packages/numpy/core/numerictypes.py", line 955, in _register_types numbers.Integral.register(integer) AttributeError: module 'numbers' has no attribute 'Integral' Additional info: * python-numpy-1.14.2-1, the same applies to python2-numpy-1.14.2-1 Steps to reproduce: Start python. Type "import numpy" and press Enter. |
This task depends upon
Closed by Eli Schwartz (eschwartz)
Friday, 23 March 2018, 13:10 GMT
Reason for closing: Not a bug
Additional comments about closing: user had a bad "numbers" module in their current working directory
Friday, 23 March 2018, 13:10 GMT
Reason for closing: Not a bug
Additional comments about closing: user had a bad "numbers" module in their current working directory
python -c 'import numbers; print(numbers.__file__)'
?
Here is the output:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: bad magic number in 'numbers': b'\x03\xf3\r\n'
Python 3.6.4 (default, Jan 5 2018, 02:35:40)
[GCC 7.2.1 20171224] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/usr/lib/python3.6/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python3.6/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/lib/python3.6/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/lib/python3.6/site-packages/numpy/core/__init__.py", line 35, in <module>
from . import _internal # for freeze programs
File "/usr/lib/python3.6/site-packages/numpy/core/_internal.py", line 18, in <module>
from .numerictypes import object_
File "/usr/lib/python3.6/site-packages/numpy/core/numerictypes.py", line 87, in <module>
import numbers
ImportError: bad magic number in 'numbers': b'\x03\xf3\r\n'
One question: Is it expected behavior, that having a python file with a unlucky name can break the numpy package?