unable to import module named pandas
Asked Answered
W

4

6

I have python 2.7 and python 3 installed.

I also have pip2.7 and pip3 installed.

I use IPython Notebook in the Jupyter console. Using the console I can use every module I want but I'm trying to use the terminal :

python script.py arg1 arg2

I have installed pandas 0.17.1 in both versions of python.

Then I launch my script in the terminal and I get the following error:

Traceback (most recent call last):                                                                                                             
  File "script.py", line 21, in <module>                                                                                                
     import pandas as pd                                                                                                                        
 ImportError: No module named pandas

and yet when running

pip install pandas
pip2.7 install pandas

it says:

 requirement already satisfied

How can I enable pandas to be imported in my script running in Terminal ? Any ideas ?

Thank you.

Walford answered 18/1, 2016 at 11:38 Comment(4)
Are you using virtualenv? Are you sure that one of your pip commands actually belongs to one of your listed python versions?Rosaline
What OS are you using? How did you install IPython notebook and Jupyter?Steady
I am working on a cluster, not a virtual environment. The cluster is working on Linux Redhat. How can I check that pip commands belong to one of my python versions ?Walford
Check if pip3 install pandas makes the import work.Domiciliate
M
0

try first to uninstall pandas

pip uninstall pandas
pip2.7 uninstall pandas

and then try to reinstall it.

Monah answered 18/1, 2016 at 11:58 Comment(0)
I
0
    pip install numpy
    pip install pandas

pip install django-pandas

django-pandas supports Django (>=1.4.5)

In some cases it is required to install numpy in your virtual

Including answered 18/1, 2016 at 12:4 Comment(0)
I
0

try the below command(this is for ubuntu 16.04)

sudo apt-get install python-pandas
Insolence answered 21/2, 2018 at 6:16 Comment(0)
E
0

Some time when you are using env named pandas this error might happend.

Employer answered 15/1, 2021 at 13:41 Comment(1)
Please go through how to answer. Be sure to add essential details/steps in you answer.Rosalbarosalee

© 2022 - 2024 — McMap. All rights reserved.