Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Pandas - Missing required dependencies ['numpy'] 1

Since yesterday I've had this error when I try to import packages on anaconda :

ImportError: Missing required dependencies ['numpy']

I have tried un-installing Anaconda and Python, switching to Python 2.7 but nothing works it's still the same error, here is the code I get :

enter image description here

Any help is really appreciated thanks !

like image 934
saib Avatar asked Jan 25 '17 19:01

saib


People also ask

What are the dependencies of NumPy?

NumPy doesn't depend on any other Python packages, however, it does depend on an accelerated linear algebra library - typically Intel MKL or OpenBLAS. Users don't have to worry about installing those (they're automatically included in all NumPy install methods).

Why is my import NumPy not working?

Python import numpy is not working that means eithers the module is not installed or the module is corrupted. To fix the corrupted module, uninstall it first then reinstall it.


13 Answers

I had this same issue immediately after upgrading pandas to 0.19.2. I fixed it with the following install/uninstall sequence from the windows cmd line:

pip uninstall pandas -y
pip uninstall numpy -y
pip install pandas
pip install numpy

This also broke my matplotlib install so I uninstalled/installed that as well.

Very odd behavior for a seemingly routine upgrade.

like image 80
fireitup Avatar answered Oct 04 '22 16:10

fireitup


What happens if you try to import numpy?

Have you tried'

pip install --upgrade numpy
pip install --upgrade pandas
like image 29
McKenzie Avatar answered Oct 04 '22 16:10

McKenzie


I had to install this other package:

sudo apt-get install libatlas-base-dev

Seems like it is a dependency for numpy but the pip or apt-get don't install it automatically for whatever reason.

like image 29
dashnick Avatar answered Oct 04 '22 16:10

dashnick


I had this problem with last version of numpy 1.16.x

Problem resolved with

python3 -m pip uninstall numpy

python3 -m pip install numpy==1.14.0

like image 45
veaceslav.kunitki Avatar answered Oct 04 '22 17:10

veaceslav.kunitki


Did you install miniconda and pandas without dependencies?

Try installing numpy first with conda install numpy or pip install numpy.

If you're on Windows you can get pre-compiled versions of most libraries that require compilation from here.

like image 38
Dennis Sakva Avatar answered Oct 04 '22 17:10

Dennis Sakva


The data manipulation capabilities of pandas are built on top of the numpy library. In a way, numpy is a dependency of the pandas library. If you want to use pandas, you have to make sure you also have numpy. When you install pandas using pip, it automatically installs numpy. If it doesn't, try the following

pip install -U numpy pandas

For conda

conda install numpy pandas

like image 29
Harshavardhan Reddy Avatar answered Oct 04 '22 16:10

Harshavardhan Reddy


I also faced the same issue. It happened to me after I upgraded my numpy library. It was resolved in my case by upgrading my pandas library as well after upgrading my numpy library using the below command:

pip install --upgrade pandas
like image 33
ace_racer Avatar answered Oct 04 '22 16:10

ace_racer


On Windows 10 Anaconda3-5.3.0-Windows-x86_64 I had the Missing required dependencies ['numpy'] error when running scripts as so, %HOMEPATH%\AppData\Local\Continuum\anaconda3\python.exe pandas_script_foo.py.

In my case the error was caused by missing Anaconda package PATH definitions when running Anaconda python.exe in a windows cmd.exe session. The numpy package is not missing. It just can't be found on the PATH.

The Anaconda installation includes windows shortcuts that give examples of configuring the PATH per script run. See the shortcuts in the %HOMEPATH%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit) directory for examples. See the %HOMEPATH%\AppData\Local\Continuum\anaconda3\cwp.py script to see how Anaconda configures PATH.

Below is an example windows BAT file that calls cwp.py to setup PATH, and then run a python script. Its a copy of the commands the Anaconda jupyter-lab shortcut executes.

%HOMEPATH%\AppData\Local\Continuum\anaconda3\python.exe ^
%HOMEPATH%\AppData\Local\Continuum\anaconda3\cwp.py ^
%HOMEPATH%\AppData\Local\Continuum\anaconda3 ^
%HOMEPATH%\AppData\Local\Continuum\anaconda3\python.exe ^
%HOMEPATH%\AppData\Local\Continuum\anaconda3\Scripts\jupyter-lab-script.py

If you need to execute python scripts on Anaconda with the conveniance of running a BAT file, the above BAT file example should do the trick.

like image 23
user1243477 Avatar answered Oct 04 '22 17:10

user1243477


Try:

    sudo apt-get install libatlas-base-dev

It should work now.

Else, try uninstall and reinstall numpy and pandas.

like image 26
Luigi Bungaro Avatar answered Oct 04 '22 18:10

Luigi Bungaro


I had the same issue. It was because I had multiple versions of numpy installed. Remove all versions by repeatedly using:

pip uninstall numpy

Then re-install it with the command:

pip install numpy

like image 32
Julian013 Avatar answered Oct 04 '22 18:10

Julian013


First, try to import numpy on it's own, like so:

import numpy as np

I got this message:

ImportError: Something is wrong with the numpy installation. While importing 
we detected an older version of numpy in 
['/home/michael/.local/lib/python3.6/site-packages/numpy']. One method of 
fixing this is to repeatedly uninstall numpy until none is found, then 
reinstall this version.

So do what it says, keep uninstalling numpy until there is none, and then reinstall.

This worked for me.

like image 25
maj Avatar answered Oct 04 '22 17:10

maj


I had the same issue while using Microsoft Visual Code with Python 3.7.3 64-bit('base':conda)as my python interpreter. Before running any code type the following three commands:

C:/ProgramData/Anaconda3/Scripts/activate #activate conda Scripts directory
conda activate base                       #activate conda
& C:/ProgramData/Anaconda3/python.exe     #to run python
like image 26
Crotonix Avatar answered Oct 04 '22 17:10

Crotonix


I have same problem. I have got two version of numpy 1.16.6 and 1.15.4, fresh installed pandas did not work correctly. I fixed it by uninstalling all versions of numpy and pandas and install the last versions.

$ pip uninstall  numpy pandas -y
Uninstalling numpy-1.16.6:
  Successfully uninstalled numpy-1.16.6
Uninstalling pandas-0.24.2:
  Successfully uninstalled pandas-0.24.2
$ pip uninstall  numpy pandas -y
Uninstalling numpy-1.15.4:
  Successfully uninstalled numpy-1.15.4
Cannot uninstall requirement pandas, not installed
$ pip uninstall  numpy pandas -y
Cannot uninstall requirement numpy, not installed
$ pip install  numpy pandas
like image 40
Oleg_C Avatar answered Oct 04 '22 17:10

Oleg_C