Numpy: Importing the numpy c-extensions failed.

Created on 27 Jan 2020  ·  5Comments  ·  Source: numpy/numpy

Issue

when importing pandas, the following error appears:


  File "D:\code\folder1\folder2\metadata\lidar_processing.py", line 17, in <module>
    import pandas as pd

  File "C:\Users\MyUserName\.conda\envs\EnvName\lib\site-packages\pandas\__init__.py", line 17, in <module>
    "Unable to import required dependencies:\n" + "\n".join(missing_dependencies)

ImportError: Unable to import required dependencies:
numpy: 

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.7 from "C:\Users\MyUserName\.conda\envs\EnvName\pythonw.exe",
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.17.5" 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: The specified module could not be found.

Installation of numpy

Installation was done via anaconda on win10:

conda create --name EnvName python=3.7 python-pdal geopandas --channel conda-forge  
conda activate MyEnv
conda install spyder-kernels

The conda list command shows for numpy:
numpy 1.17.5 py37hc71023c_0 conda-forge

Other info

  • windows 10 Version 1803 (OS Build 17134.706)
  • reinstalling numpy via conda install --force-reinstall numpy=1.17.5 does not solve the issue.
  • note that conda install numpy would provide an update to 1.18.1, but this leads to other import errors for geopandas (however, those errors do not directly mention numpy).
32 - Installation 33 - Question

All 5 comments

Starting from a clean install of ananconda3_2019_10 64-bit on windows 10 the commands you pasted work fine for me. I also get the same numpy, but I can import numpy and pandas without a problem.

> conda list | find "numpy"
numpy                     1.17.5           py37hc71023c_0    conda-forge

Note that conda/anaconda use MKL, xref gh-15343, gh-14888 and some others

I did some further testing. I removed all existing environments on the machine. I do unfortunately not remember if I did a conda update conda or not.
I then created a new environment via:
conda create --name pdal3 --channel conda-forge python=3.7 spyder-kernels python-pdal geopandas
Note that this command is not identical to the one in the original post (order of arguments, and spyder-kernels immediately integrated).
I got the following result:

  1. error in the console of spyder: see spyder github. This however seems to be a spyder issue.
  2. when I launch my program directly from console, it works.

So, I can continue my work for the time being, but not offer any insight in how I solved the issue.

This was a problem in Spyder caused by us not activating the conda env where our kernel lives before starting it. It was fixed in our 4.1.0 version, so this issue can be closed.

@ccordoba12 Thanks for the update.

I can confirm that the issue is no longer present. Thanks to both the numpy and spyder community for the time spent on it.

Was this page helpful?
0 / 5 - 0 ratings