Skip to content

pandas not found when it's supposed to be installed #11604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
datomnurdin opened this issue Nov 14, 2015 · 27 comments
Closed

pandas not found when it's supposed to be installed #11604

datomnurdin opened this issue Nov 14, 2015 · 27 comments
Labels
Build Library building on various platforms

Comments

@datomnurdin
Copy link

datomnurdin commented Nov 14, 2015

I got this error message. Already installed pandas.

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

SOLUTION (by @datapythonista)

This error happens when Python can't find pandas in the list of available libraries. Python has internally a list of directories where it'll look for packages. These directories can be obtained with import sys; sys.path.

In one machine you can (and should) have several Python installations. Meaning that you can have pandas installed in one, and be using another Python installation (this is likely the case here).

In Linux/Mac you can run which python and will tell you which is the Python you're using. If it's something like /usr/bin/python, you're using the Python from the system, which is not a great practice, and rarely used in the Python community.

If you used Python before you may have used virtual environments and pip. While this is fine for many Python projects (e.g. Django), when using data projects (pandas, numpy, tensorflow...) this is discouraged. It's easy that you have installation errors, and also the libraries can run much slower when using pip.

The widely used solution to this problem is to use conda. You can find simple installation instructions for pandas in this document: https://dev.pandas.io/getting_started.html

For more advanced users, installing miniconda, and then manually install pandas (and any other required package) with conda can be preferred (but avoid this if you're starting, since you'll probably have errors of missing dependencies when using many of the pandas features).

@jreback
Copy link
Contributor

jreback commented Nov 14, 2015

you don't have pandas installed

see instructions here

you are also not showing what you did, nor your platform, so impossible to advise anything

@jreback jreback closed this as completed Nov 14, 2015
@jreback jreback added the Build Library building on various platforms label Nov 14, 2015
@datomnurdin
Copy link
Author

I already installed Pandas and I'm using Centos 7.

@jreback
Copy link
Contributor

jreback commented Nov 14, 2015

if you can't import it then its not installed. and you shouldn't be pathing at all. this indicates a problem with how you installed things.

@datomnurdin
Copy link
Author

datomnurdin commented Nov 14, 2015

edit from @TomAugspurger: Don't use sudo pip install.

You can check my output message here after I run sudo pip install pandas.

sudo pip install pandas
Requirement already satisfied (use --upgrade to upgrade): pandas in /usr/lib64/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/lib/python2.7/site-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in /usr/lib/python2.7/site-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.0 in /usr/lib64/python2.7/site-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /usr/lib/python2.7/site-packages (from python-dateutil->pandas)

@jreback
Copy link
Contributor

jreback commented Nov 14, 2015

same answer. you probably have multiple pythons installed. pls read the installation instructions and follow them.

@s-celles
Copy link
Contributor

I'm facing a similar issue.

Could you have a look here ?
https://travis-ci.org/scls19fr/pandas_confusion/builds
https://github.com/scls19fr/pandas_confusion

@am-firnas
Copy link

I also had the same issue and had both python3, python versions installed.

@pavankat
Copy link

pavankat commented Jul 25, 2017

edit from @TomAugspurger: Don't use sudo pip install

@datomnurdin @scls19fr @AMFIRNAS

sudo pip3 install pandas

try that it worked for me.

@gfyoung
Copy link
Member

gfyoung commented Jul 25, 2017

sudo pip3 install pandas

The original issue is for Python 2.x, so unfortunately, this suggestion is moot. On Linux, do the following:

which python
which pip

and see where each is pointing to. Something tells me you'll find a discrepancy. If not, chase down where your "existing" pandas installation is located and see whether it is actually installed there.

@vinrok
Copy link

vinrok commented Jan 15, 2018

I am facing the following issue in my code:

`ImportError Traceback (most recent call last)
in ()
----> 1 import pandas as pd
2
3 import numpy as np
4
5 import matplotlib.pyplot as plt

ImportError: No module named pandas`

Even though I have installed pandas.

I am using Jupyter notebook.

@RANAJITGIT
Copy link

I am facing the same issue.
I have python 3.6 and panda installed
import pandas as pd is working fine in jupyter notebook.
but I am getting error in python shell.
Please help...............

@gfyoung
Copy link
Member

gfyoung commented Feb 14, 2018

Do you have multiple python versions installed? Try this in the Python shell:

import sys
print(sys.version_info)

@gfyoung
Copy link
Member

gfyoung commented Feb 14, 2018

Do you have multiple python versions installed? Try this in the Python shell:

import sys
print(sys.version_info)

@ram1421
Copy link

ram1421 commented Mar 6, 2018

is the issue with fixed. How ?

Traceback (most recent call last):
  File "e:\Learn\TensorFlow\script.py", line 5, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'

@dduque10
Copy link

It is better to use a virtual environment to avoid these trouble https://stackoverflow.com/questions/49265260/pandas-unrecognized-by-python3/49265845#49265845

@RANAJITGIT
Copy link

RANAJITGIT commented Mar 17, 2018 via email

@gbabic
Copy link

gbabic commented Apr 20, 2018

I ran into this issue in my virtual environment.

pip install pandas in my virtualenv ran fine. No errors. Dropping into my python shell though I could not import it and pip freeze did not report it as installed.

To get around it I had to delete and recreate my python virtual environment, re-installed my pip requirements from my requirements.txt, pip install pandas and all was good.

Still a mystery to me....

@thomasschijf
Copy link

thomasschijf commented May 1, 2018

edit from @TomAugspurger: don't use sudo pip install

for python 2:

sudo pip2 install pandas

@TomAugspurger
Copy link
Contributor

caskroom/cask/panda looks like a different piece of software.

@thomasschijf in general, you'll want to avoid sudo pip. That has a tendency to mess up your system's python install.

@AmnaKhan1
Copy link

My problem resolved by using pip3 install pandas. Python version was 3.5.*.

@Sonupival6
Copy link

Sonupival6 commented Aug 12, 2018

I am looking for simulation of KNN algorithm for temperature in python or in MATLAB . IF any one can provide me the code than that will be great.
cheers.
Please mail : [email protected]

@mrparsaeian
Copy link

You probably have some .py files in your working directory with the same name as one of the modules you're trying to use. The names of modules should not be used as file names in your project.

@siposm
Copy link

siposm commented Nov 6, 2018

pip2 install pandas worked for me. i'm planning to clear out everything and get rid of the plenty of different versions and use only one (or virtual environments as a lot of ppl suggested:))

@RobStelling
Copy link

If you installed pandas (with pip/conda) and it doesn't show up in python then probably the python in your path is not the same that pip/conda are updating.
Double check your conda directory (Usually: /home//anaconda3/bin/) and run the python instance on this folder. If pandas is installed there (and I bet it will be) then add this folder to the beginning of your path.

@Wessi
Copy link

Wessi commented Jan 11, 2019

I fixed the same problem with the below commands...
Type python on your terminal. If you see python version 2.x then run these two commands to install pandas: sudo python -m pip install wheel and sudo python -m pip install pandas. Else if you see python version 3.x then run these two commands to install pandas: sudo python3 -m pip install wheel and sudo python3 -m pip install pandas. Good Luck!

@Wessi
Copy link

Wessi commented Jan 11, 2019

I am facing the same issue.
I have python 3.6 and panda installed
import pandas as pd is working fine in jupyter notebook.
but I am getting error in python shell.
Please help...............

#11604 (comment)

@akun1
Copy link

akun1 commented Jan 29, 2019

Just wanted to add to the answer provided by @pavankat

What he suggested worked for me, but I had to download Python 3.7 first!

@pandas-dev pandas-dev locked and limited conversation to collaborators Jan 29, 2019
@datapythonista datapythonista changed the title ImportError: No module named pandas pandas not found when it's supposed to be installed Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Build Library building on various platforms
Projects
None yet
Development

No branches or pull requests