Cant import pandas in Blender

Viewed 230

I am trying to import pandas in blender but it's not finding the module. I have checked that Blender has the correct paths and looks like it is.

This is my output in blender:

>>> print(sys.path)
['/usr/share/blender/2.93/scripts/startup', '/usr/share/blender/2.93/scripts/modules', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/usr/lib/python3.9/site-packages', '/usr/lib/python3.9/site-packages/evtk-2.0.0-py3.9.egg', '/usr/share/blender/2.93/scripts/freestyle/modules', '/usr/share/blender/2.93/scripts/addons/modules', '/home/jjcasmar/.config/blender/2.93/scripts/addons/modules', '/usr/share/blender/2.93/scripts/addons', '/home/jjcasmar/.config/blender/2.93/scripts/addons', '/usr/share/blender/2.93/scripts/addons_contrib']

>>> print(sys.version)
3.9.7 (default, Aug 31 2021, 13:28:12) 
[GCC 11.1.0]

>>> print(sys.path)
['/usr/share/blender/2.93/scripts/startup', '/usr/share/blender/2.93/scripts/modules', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/usr/lib/python3.9/site-packages', '/usr/lib/python3.9/site-packages/evtk-2.0.0-py3.9.egg', '/usr/share/blender/2.93/scripts/freestyle/modules', '/usr/share/blender/2.93/scripts/addons/modules', '/home/jjcasmar/.config/blender/2.93/scripts/addons/modules', '/usr/share/blender/2.93/scripts/addons', '/home/jjcasmar/.config/blender/2.93/scripts/addons', '/usr/share/blender/2.93/scripts/addons_contrib']

>>> import pandas
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
ModuleNotFoundError: No module named 'pandas'

And this is the output if I just launch a python environment from my virtual terminal

[jjcasmar@archlinux ~]$ python
Python 3.9.7 (default, Aug 31 2021, 13:28:12) 
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.version)
3.9.7 (default, Aug 31 2021, 13:28:12) 
[GCC 11.1.0]
>>> print(sys.path)
['', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/home/jjcasmar/.local/lib/python3.9/site-packages', '/usr/lib/python3.9/site-packages', '/usr/lib/python3.9/site-packages/evtk-2.0.0-py3.9.egg']
>>> import pandas as pd
>>> 

My blender environment has the correct paths and the versions are the same, but it fails to import pandas. What is wrong here?

2 Answers

Have you installed the lib? Try pip install pandas

Have you activated your virtual environment?

Maybe you could try to install pandas directly from the blender's pip environment ?

Open a python interactive console in blender then:

import pip
pip.main(['install','pandas==1.4.0'])

Then as you did you can try to import pandas to see if it works:

import pandas as pd

(On my side i tested on MacosX only but it works)

Related