11

I was able to run all scripts successfully which is using pandas , but suddenly all my PANDAS SCRIPTS are giving this error :

Traceback (most recent call last):

File "data_visulaization.py", line 5, in

import pandas as pd

File "/usr/lib64/python2.7/site-packages/pandas/init.py", line 18, in

raise ImportError("Missing required dependencies {0}".format(missing_dependencies))


ImportError: Missing required dependencies ['numpy']

Recently i have not installed or updated any new things.

Does anyone have a solution for this?

I uninstalled pandas and numpy and re-installed them but still facing the same issue.

ZombieChowder
  • 1,187
  • 12
  • 36
aAAAAAAa
  • 135
  • 1
  • 2
  • 9

9 Answers9

10

I got this issue on Rasberry PI and found that the root cause was missing library:

import numpy
...
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

Then it takes few minute to google the required library source:

sudo apt-get install libatlas-base-dev

I have not checked the solution on any other Linux-es but likely the same method should be applicable. So try to import the faulty library first and see what is missing.

Shtefan
  • 742
  • 12
  • 14
3

I faced the exact same error and found that I had created a file named 'random.pyc' by mistake in the same directory as that of my PyCharm environment ayush@ayush-VirtualBox:~/PycharmProjects/untitled$ where "untitled" refers to my project directory. I deleted it and everything fells into place. Hope this helps !

The reason for this was numpy Imports another file called Random by default for building its own dependencies and it mistook my 'random.pyc' for it and replaced it.

2

I had the same error. Fixed with the following:

python3 -m pip uninstall numpy

python3 -m pip install numpy==1.14.0

Moniba
  • 789
  • 10
  • 17
1

use"conda install numpy" in cmd-window if you used Anaconda in your machine. I had encount this problem also and I resolved it by this. May it can help U.

Aaron
  • 11
  • 1
0

I found the solution , the actual problem is if any of your recent python scripts have generated ".pyc" extension file this error will occur .

solution is to delete those files that's all.

aAAAAAAa
  • 135
  • 1
  • 2
  • 9
0

If you are using packages options and it contains pandas or some package depends numpy, you should add required dependencies to the packages.

Fatih1923
  • 2,665
  • 3
  • 21
  • 28
0
pip uninstall numpy

pip install numpy

It works

blacksheep
  • 483
  • 5
  • 7
0

This error will occur when multiple versions of numpy are installed. Check to make sure you only have one version of numpy installed. You can make a test file to check this if you don't want to look through the directories:

import numpy
print("Numpy imported")

If you get an error saying that multiple versions of numpy were detected, then you have multiple versions of numpy installed.

You can fix this by repeatedly calling (not just once) pip uninstall numpy until all versions are uninstalled and then use pip install numpy to get only the latest version.

clarked
  • 362
  • 1
  • 12
-2

try uninstalling pandas and numpy:

pip uninstall pandas pip uninstall numpy

and install them back:

pip install pandas pip install numpy

W Stokvis
  • 1,409
  • 8
  • 15