Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named 'pandas' Using Ubuntu

$ pip3 install pandas
Requirement already satisfied (use --upgrade to upgrade): pandas in /usr/local/lib/python3.4/dist-packages
Requirement already satisfied (use --upgrade to upgrade): python-dateutil>=2 in /usr/local/lib/python3.4/dist-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in /usr/local/lib/python3.4/dist-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.0 in /usr/local/lib/python3.4/dist-packages (from pandas)

I am getting Import error while my system has already satisfied all requirements.

like image 836
Ashish Odich Avatar asked May 17 '17 04:05

Ashish Odich


People also ask

What does “no module named Pandas” mean?

The error “No module named pandas ” will occur when there is no pandas library in your environment IE the pandas module is either not installed or there is an issue while downloading the module right. Let’s see the error by creating an pandas dataframe. We will discuss how to overcome this error.

How to install pandas in Python?

Pandas are distributed through pip as a wheel, which means you need to install wheel first and then pandas: The recommended way to install the pandas module is using pip or pip3 for Python3 if you have installed pip already. Alternatively, if you have easy_install in your system, you can install pandas using the below command.

Where can I find the pandas description in Python?

Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (1.1.5) To get the pandas description in our environment we can use the show command. This can help keep track of the module and its installation. Summary: Powerful data structures for data analysis, time series, and statistics

How to update pandas to latest version?

You can update to the latest version of pandas (along with other modules) using conda: You can also create virtual environments and other useful things... The problem this solves, over pip, is that there are issues in software dependencies of some modules (scipy especially is tricky) or versions compiled against an incorrect version of numpy.


2 Answers

To be sure you are not having multiple Python versions that are confusing, you should run these commands

python -m pip install pandas
python -c 'import pandas'

It installs pandas and imports it with the same python version.

Of course, you have to update the python program in the above commands, in case it is not directly python.

If you have a python3 executable, you can try

python3 -m pip install pandas
python3 -c 'import pandas'

You can even use absolute path, that would be returned by which python, which python2 or which python3, ...

like image 91
Guillaume Jacquenot Avatar answered Sep 20 '22 00:09

Guillaume Jacquenot


I believe you have multiple python3's. If everything else suggested doesn't work for you, a easy/hacky way is to do this before you import pandas, it will guarantee the usage of the correct interpreter. Do this just once, after its successfully installed, you no longer need to do that:

import pip
pip.main(['install','pandas'])
import pandas
like image 28
Taku Avatar answered Sep 22 '22 00:09

Taku