Using Pandas inside Maya python shell

Using Pandas inside Maya python shell

jeremyraven
Enthusiast Enthusiast
2,449 Views
4 Replies
Message 1 of 5

Using Pandas inside Maya python shell

jeremyraven
Enthusiast
Enthusiast

Im trying to setup the python environment so that I can import the pandas framework.

I installed pandas using Anaconda that has installed pandas at ".opt/anaconda3/lib/python3.8/site-packages"

so inside a python shell in Maya Ive written this code...

import sys
sys.path.append (".opt/anaconda3/lib/python3.8/site-packages")

import pandas

but  Im getting this message:

# Error: ImportError: file <maya console> line 4: No module named pandas #

 

I've CD'd into this directory and printed the directory contents out and sure enough pandas is definitely inside there and if I print out the PYTHONPATH ".opt/anaconda3/lib/python3.8/site-packages" is on that list.

Any ideas as to what I can do to fix this?

 

Many thanks

0 Likes
Accepted solutions (1)
2,450 Views
4 Replies
Replies (4)
Message 2 of 5

bradley_henke
Enthusiast
Enthusiast
Accepted solution

Looks like that is the python 3 version of pandas. Maya ships with python 2.7, so you will probably need a different version of pandas, numpy, etc.

 

I'm also assuming that you probably meant to type "/opt" instead of ".opt". That may be the reason that the module is not being found.

0 Likes
Message 3 of 5

jeremyraven
Enthusiast
Enthusiast

Thanks Bradley,

you are right, I was using a version of pandas which was not compatible with python 2.7.

 

Many thanks

0 Likes
Message 4 of 5

183110675Z7WVZ
Community Visitor
Community Visitor

Hello Jeremy, could you please let me know which pandas version you installed?

Thank you in advance.

-Abigail Jimenez

0 Likes
Message 5 of 5

stevejonn
Community Visitor
Community Visitor

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'

 

0 Likes