question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pandas not found when it's supposed to be installed

See original GitHub issue

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).

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:27 (8 by maintainers)

github_iconTop GitHub Comments

94reactions
jrebackcommented, Nov 14, 2015

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

94reactions
jrebackcommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: No module named pandas - Stack Overflow
It turns out the problem happens when you're installing Pandas to a version of python and trying to run the program using another...
Read more >
No Module Named Pandas – How To Fix - Data Independent
“no module named pandas” happens because because your current python environment cannot find the pandas library. Here's a list of the common reasons...
Read more >
How to Fix ImportError: No module named pandas [Mac/Linux ...
Quick Fix: Python raises the ImportError: No module named pandas when it cannot find the Pandas installation. The most frequent source of this...
Read more >
ImportError: No module named pandas - Net-Informations.Com
You haven't installed Pandas explicitly with pip install pandas. · You may have different Python versions on your computer and Pandas is not...
Read more >
How to Fix: No module named pandas - GeeksforGeeks
The error “No module named pandas ” will occur when there is no pandas library in your environment IE the pandas module is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found