question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Numpy conda package broken inside tox on Windows, Python 3.7/3.8

See original GitHub issue

The conda-package for numpy does not work on Windows inside a tox environment (using tox-conda):

Steps to reproduce are:

The result in an error such as

Traceback (most recent call last):
  File "C:\projects\2020-02-06-numpy-on-appveyor\.tox\envdir\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
    from . import multiarray
  File "C:\projects\2020-02-06-numpy-on-appveyor\.tox\envdir\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
    from . import overrides
  File "C:\projects\2020-02-06-numpy-on-appveyor\.tox\envdir\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\projects\2020-02-06-numpy-on-appveyor\.tox\envdir\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "C:\projects\2020-02-06-numpy-on-appveyor\.tox\envdir\lib\site-packages\numpy\core\__init__.py", line 54, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
  1. Check that you expected to use Python3.8 from "C:\projects\2020-02-06-numpy-on-appveyor\.tox\envdir\python.exe",
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.18.1" 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

- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.

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 while importing _multiarray_umath: The specified module could not be found.

ERROR: InvocationError for command 'C:\projects\2020-02-06-numpy-on-appveyor\.tox\envdir\python.exe' -c 'import numpy; print(numpy.__version__)' (exited with code 1)

The error occurs for Python versions 3.7 and 3.8, but not 3.6. It also only occurs when installing the numpy package inside of tox (as opposed to just the default conda environment directly)

I’ve set up a repository at https://github.com/goerz-testing/2020-02-06_numpy_on_appveyor that illustrates several variations of the problem. In that repository, the tox.ini defines a run-cmd environment to execute arbitrary commands inside the environment. In .appveyor.yml I then invoke tox to run

python.exe -c "import numpy; print(numpy.__version__)"

inside the environment.

The repository reproduces the error on AppVeyor, but I’ve observed the same behavior “manually” on a standard Windows 10 installation.

Variations of things that do and don’t work are branches in the repository:

It’s not clear whether numpy or tox-conda or a weird interaction between the two is responsible for the problem.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
isurufcommented, Feb 16, 2020

not anaconda_activated

os.getenv("CONDA_PREFIX") == sys.prefix

1reaction
mattipcommented, Feb 8, 2020

Do you need to activate your conda environment?

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Numpy is installed but still getting error - Stack Overflow
I am trying to run jupyter notebook and getting following error. I am using Win 7 with anaconda python 3.7. ImportError : Something...
Read more >
tox-conda - PyPI
tox -conda is a plugin that provides integration with the conda package and environment manager for the tox automation tool. It's like having...
Read more >
Tox - :: Anaconda.org
Tox is a generic virtualenv management and test command line tool you can use for - checking your package installs correctly with different...
Read more >
Untitled
Related: rhbz#1947937 [6.7-10] - Fix problem in shell code found by ShellCheck in ... partitons detection broken on systems not including the parent...
Read more >
Use Tox With Anaconda - deparkes
Without going into too much detail, a virtualenv creates a link to an existing python installation – e.g. C:\python 2.7 in windows or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found