Pandas: Missing required dependencies ['numpy'] on pandas 0.24.1

Created on 14 Feb 2019  Â·  6Comments  Â·  Source: pandas-dev/pandas

Code Sample with obtained output

import pandas as pd
# --------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-7dd3504c366f> in <module>
----> 1 import pandas as pd

~/.local/lib/python3.6/site-packages/pandas/__init__.py in <module>
     17 if missing_dependencies:
     18     raise ImportError(
---> 19         "Missing required dependencies {0}".format(missing_dependencies))
     20 del hard_dependencies, dependency, missing_dependencies
     21 

ImportError: Missing required dependencies ['numpy']

pip3 show outputs

➜ pip3 show pandas
Name: pandas
Version: 0.24.1
Summary: Powerful data structures for data analysis, time series, and statistics
Home-page: http://pandas.pydata.org
Author: None
Author-email: None
License: BSD
Location: /home/skeletrox/.local/lib/python3.6/site-packages
Requires: numpy, python-dateutil, pytz

➜ pip3 show numpy
Name: numpy
Version: 1.16.1
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: /home/skeletrox/.local/lib/python3.6/site-packages
Requires: 

System

  • Linux Mint 19.1 Tessa
  • pip3 --version output: pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

Problem description

Recently updated pandas using pip3 install -U pandas and tried running the code again, leading to the above issue.

Attempted Fixes

Tried reinstalling both numpy and pandas, and cleared cache so as to force pip3 to pull from remote.

➜ pip3 uninstall pandas && pip3 uninstall numpy && pip3 install numpy && pip3 install pandas

yet the issue remains consistent.

Expected result

Successful import of pandas

Most helpful comment

Issue fixed; was an issue with multiple instances of numpy installed. Resolving that issue by repeatedly running pip3 uninstall numpy until none remained and then running pip3 install numpy allowed pandas to import it without any issues

All 6 comments

Issue fixed; was an issue with multiple instances of numpy installed. Resolving that issue by repeatedly running pip3 uninstall numpy until none remained and then running pip3 install numpy allowed pandas to import it without any issues

I'm facing the same problem. However, the workaround is not working.

$ pip3 show pandas
Name: pandas                                                                                                                                                                                                      
Version: 0.24.2                                                                                                                                                                                                   
Summary: Powerful data structures for data analysis, time series, and statistics                                                                                                                                  
Home-page: http://pandas.pydata.org                                                                                                                                                                               
Author: None                                                                                                                                                                                                      
Author-email: None                                                                                                                                                                                                
License: BSD                                                                                                                                                                                                      
Location: /home/helder/.local/lib/python3.6/site-packages                                                                                                                                                         
Requires: pytz, python-dateutil, numpy                                                                                                                                                                            

$ pip3 show numpy
Name: numpy                                                                                                                                                                                                       
Version: 1.16.2                                                                                                                                                                                                   
Summary: NumPy is the fundamental package for array computing with Python.                                                                                                                                        
Home-page: https://www.numpy.org                                                                                                                                                                                  
Author: Travis E. Oliphant et al.                                                                                                                                                                                 
Author-email: None                                                                                                                                                                                                
License: BSD                                                                                                                                                                                                      
Location: /home/helder/.local/lib/python3.6/site-packages                                                                                                                                                         
Requires:

Any thoughts?

I fixed it!

First I had to uninstall pandas and numpy:
$ pip3 uninstall numpy && pip3 uninstall pandas

and then I went to the folder: /home/helder/.local/lib/python3.6/site-packages/
and removed all folders of pandas and numpy.

Finally I installed all them again:
$ pip3 install numpy && pip3 install pandas

After that everything is working!

This issue is especially annoying, because the standard venvs in Travis CI have a pre-installed version of numpy==1.13.3. Using pandas within Travis is therefore broken out-of-the box. The problem seems to apply to 0.24.2 as well.

To make Travis work again, I had to prefix all jobs with pip uninstall -y -q numpy; don't forget the -y otherwise pip prompts for verification and the job gets stuck.

This issue is especially annoying, because the standard venvs in Travis CI have a pre-installed version of numpy==1.13.3. Using pandas within Travis is therefore broken out-of-the box. The problem seems to apply to 0.24.2 as well.

To make Travis work again, I had to prefix all jobs with pip uninstall -y -q numpy; don't forget the -y otherwise pip prompts for verification and the job gets stuck.

I fixed it!

First I had to uninstall pandas and numpy:
$ pip3 uninstall numpy && pip3 uninstall pandas

and then I went to the folder: /home/helder/.local/lib/python3.6/site-packages/
and removed all folders of pandas and numpy.

Finally I installed all them again:
$ pip3 install numpy && pip3 install pandas

After that everything is working!

Thank you @helco88.
This solution works, however, if there are multiple versions of python3 installed i.e., python3.6 and python3.8 or similar then this will not work no matter how many times we try this. It is better to install these packages for the specific or the current python version in use.

python --version
python3.8 -m pip install pandas
python3.8 -m pip install numpy 

I just uninstalled my only numpy and reinstalled it and now everything works !! thanks a lot !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matthiasroder picture matthiasroder  Â·  3Comments

scls19fr picture scls19fr  Â·  3Comments

amelio-vazquez-reina picture amelio-vazquez-reina  Â·  3Comments

jaradc picture jaradc  Â·  3Comments

swails picture swails  Â·  3Comments