0

I am trying to run a python script and I am getting the following error;

import pandas as pd
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/__init__.py", line 18, in <module>
    raise ImportError("Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']

both numpy and pandas were successfully installed using pip. How can I fix this?

6
  • It is said numpy dependency is missing. You need to install it beforehand Commented Feb 13, 2017 at 15:50
  • @user2682877 I installed numpy but It's still giving the same error. Commented Feb 13, 2017 at 15:53
  • Did you install numpy for Python2 or Python3? What happens, if you do import numpy? Commented Feb 13, 2017 at 15:57
  • @tommy.carstensen I am using python 2.7. If import numpy nothing happens, It displays that error when I import with pandas as well Commented Feb 13, 2017 at 16:04
  • thank you @tommy.carstensen and @user2682877, it is now working. I decided to add import numpy before import pandas. Somehow it started working though I still need to know what caused the error Commented Feb 13, 2017 at 16:07

2 Answers 2

2

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 pip uninstall numpy until all versions are uninstalled and then use pip install numpy to get only the latest version.

Sign up to request clarification or add additional context in comments.

Comments

0

Similar thing happened to me. Here is what I did:

Use a .whl file to install numpy+KML KML is important and I believe was not getting installed when I got a similar error. After that use another .whl file to install pandas. I used the following for the files: link

A quick search will get you the right method to install whl files.

Make sure to get the correct whl files.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.