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

ImportError failure with NumPy 1.15.4 #9

Closed
mdickinson opened this issue Jan 20, 2020 · 3 comments · Fixed by #8
Closed

ImportError failure with NumPy 1.15.4 #9

mdickinson opened this issue Jan 20, 2020 · 3 comments · Fixed by #8
Labels
bug Something isn't working

Comments

@mdickinson
Copy link
Member

mdickinson commented Jan 20, 2020

With NumPy 1.15.4, I see an ImportError when trying to execute the tests.

Here's a transcript from a session using Python 3.8.1 (from Macports) and NumPy 1.15.4:

mirzakhani:ibm2ieee mdickinson$ python3.8 -m venv ~/.venvs/ibm2ieee
mirzakhani:ibm2ieee mdickinson$ source ~/.venvs/ibm2ieee/bin/activate
(ibm2ieee) mirzakhani:ibm2ieee mdickinson$ pip install "numpy==1.15.4" six packaging
Collecting numpy==1.15.4
  Using cached https://files.pythonhosted.org/packages/2d/80/1809de155bad674b494248bcfca0e49eb4c5d8bee58f26fe7a0dd45029e2/numpy-1.15.4.zip
Collecting six
  Using cached https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Collecting packaging
  Using cached https://files.pythonhosted.org/packages/d8/5b/3098db49a61ccc8583ffead6aedc226f08ff56dc03106b6ec54451e27a30/packaging-20.0-py2.py3-none-any.whl
Collecting pyparsing>=2.0.2 (from packaging)
  Using cached https://files.pythonhosted.org/packages/5d/bc/1e58593167fade7b544bfe9502a26dc860940a79ab306e651e7f13be68c2/pyparsing-2.4.6-py2.py3-none-any.whl
Installing collected packages: numpy, six, pyparsing, packaging
  Running setup.py install for numpy ... done
Successfully installed numpy-1.15.4 packaging-20.0 pyparsing-2.4.6 six-1.14.0
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(ibm2ieee) mirzakhani:ibm2ieee mdickinson$ pip install -e .
Obtaining file:///Users/mdickinson/Enthought/Projects/ibm2ieee
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: numpy in /Users/mdickinson/.venvs/ibm2ieee/lib/python3.8/site-packages (from ibm2ieee==1.0.1) (1.15.4)
Installing collected packages: ibm2ieee
  Running setup.py develop for ibm2ieee
Successfully installed ibm2ieee
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(ibm2ieee) mirzakhani:ibm2ieee mdickinson$ pip list
Package    Version Location                                     
---------- ------- ---------------------------------------------
ibm2ieee   1.0.1   /Users/mdickinson/Enthought/Projects/ibm2ieee
numpy      1.15.4  
packaging  20.0    
pip        19.2.3  
pyparsing  2.4.6   
setuptools 41.2.0  
six        1.14.0  
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(ibm2ieee) mirzakhani:ibm2ieee mdickinson$ python -m unittest discover .
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
E
======================================================================
ERROR: ibm2ieee (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: ibm2ieee
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/loader.py", line 470, in _find_test_path
    package = self._get_module_from_name(name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/Users/mdickinson/Enthought/Projects/ibm2ieee/ibm2ieee/__init__.py", line 9, in <module>
    from ._ibm2ieee import ibm2float32, ibm2float64
ImportError: numpy.core.multiarray failed to import


----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)
@mdickinson mdickinson added the bug Something isn't working label Jan 20, 2020
@mdickinson
Copy link
Member Author

This is an issue resulting from our use of build environments and pyproject.toml. The package gets built against the latest NumPy version available from PyPI, and then installed in an environment containing whatever NumPy version is on the system.

Related: pypa/pip#6144

Using --no-build-isolation may be a solution for the CI for now, but we may want to reevaluate whether we want to use pyproject.toml at all.

@mdickinson
Copy link
Member Author

Using --no-build-isolation may be a solution for the CI for now

Used this in #8. It's a solution for the CI, but it's not a solution for the hapless Python user who installs ibm2ieee into a Python environment that already has NumPy installed. I think it's clear that removing pyproject.toml is the only sane approach.

I've opened #10 for the action of removing pyproject.toml.

@mdickinson
Copy link
Member Author

Also related: numpy/numpy#5888

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant