Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Igor_F_Intel
Employee
10,303 Views

ModuleNotFoundError: No module named 'pandas'

Jump to solution

Still facing this issue even following the commands below:

 

!pip install pandas --user

import sys
sys.executable

!which python

/opt/intel/inteloneapi/intelpython/latest/bin/python
  

It happens in all environments (Python 3.7 oneAPI, Pytorch 1.4 AI Kit, etc.) 

Tags (1)
0 Kudos
1 Solution
ChithraJ_Intel
Moderator
10,273 Views

Hi Igor,

 

Thanks for reaching out to us. 

We will be very happy to help you with your issue. As going through the details you shared, the issue seems to be you are not installing pandas to the correct environment. This might be due to when we use ! in front of a Linux command, it will start a new terminal each time, so in this terminal your environment is not activated. 

Also, the sys.executable commands takes the python path to be executed from kernel.json, in your case it's pytorch path. But, which python commands returns intelpython path for your case. It's because of this ! symbol.

To avoid this conflicts, you can follow any of the below workarounds provided.

 

Method 1: Start a Jupyter cell by using bash magic(%%bash). Now, export the correct python path and install the package.

 

Commands to be executed in the cell:-

%%bash

which python

export PATH=/opt/intel/inteloneapi/pytorch/latest/bin/:$PATH

which python

pip install pandas --user

 

Method 2: Install the package from terminal

Step 1: Initialize the oneAPI environment

source /opt/intel/inteloneapi/setvars.sh

Step 2 : Activate the pytorch environment

conda activate pytorch

Step 3: Install pandas in the environment

pip install pandas --user

 

Now, open the Jupyterlab on your browser and start the pytorch kernel.

 

Hopes this will resolve your issue. Please feel free to reach out to us in case of any queries.

 

Regards,

Chithra

 

View solution in original post

4 Replies
ChithraJ_Intel
Moderator
10,274 Views

Hi Igor,

 

Thanks for reaching out to us. 

We will be very happy to help you with your issue. As going through the details you shared, the issue seems to be you are not installing pandas to the correct environment. This might be due to when we use ! in front of a Linux command, it will start a new terminal each time, so in this terminal your environment is not activated. 

Also, the sys.executable commands takes the python path to be executed from kernel.json, in your case it's pytorch path. But, which python commands returns intelpython path for your case. It's because of this ! symbol.

To avoid this conflicts, you can follow any of the below workarounds provided.

 

Method 1: Start a Jupyter cell by using bash magic(%%bash). Now, export the correct python path and install the package.

 

Commands to be executed in the cell:-

%%bash

which python

export PATH=/opt/intel/inteloneapi/pytorch/latest/bin/:$PATH

which python

pip install pandas --user

 

Method 2: Install the package from terminal

Step 1: Initialize the oneAPI environment

source /opt/intel/inteloneapi/setvars.sh

Step 2 : Activate the pytorch environment

conda activate pytorch

Step 3: Install pandas in the environment

pip install pandas --user

 

Now, open the Jupyterlab on your browser and start the pytorch kernel.

 

Hopes this will resolve your issue. Please feel free to reach out to us in case of any queries.

 

Regards,

Chithra

 

View solution in original post

ChithraJ_Intel
Moderator
10,229 Views

Hi Igor,


Has the solution provided helped for you? Please let us know if the issue still persists.


Regards,

Chithra


ChithraJ_Intel
Moderator
10,194 Views

Hi Igor,


Thanks for accepting the solution. We would discontinue monitoring this thread. Please feel free to raise a new thread if you have any further queries/issues.


Regards,

Chithra


stevejonn
Beginner
1,666 Views

In most cases this error in Python generally raised:

You haven't installed Pandas explicitly with pip install pandas.
You may have different Python versions on your computer and Pandas is not installed for the particular version you're using.

You can run the following command in your Linux/MacOS/Windows terminal.

pip install pandas

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

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

 

Reply