Sublime Forum

How can I use pandas from within Sublime Text?

#1

For context, I am on macOS 11.4.
I have installed Python 3.9.5 from https://www.python.org/downloads/
I am running Sublime 4107.
Per recommendation of pandas.org, I have installed pandas and its dependencies via the Anaconda distribution. This gets installed in ~/opt.

When I create a python file in Sublime and import pandas as pd, I get error ModuleNotFoundError: No module named pandas

So then I think maybe the pandas in ~/opt is not visible to Sublime, so I follow advice here that I can install 3rd partly dependencies to Sublime Lib folders. I pip3 target install pandas directly to /Library/Application Support/Sublime Text 3/Lib/python38 and /Library/Application Support/Sublime Text 3/Lib/python33. This still yields error ModuleNotFoundError: No module named pandas.

I’m not sure what to try next. Any help is appreciated.

0 Likes

#2

The python shipped with Sublime Text is used exclusively for plugins and should not be used for running your own code. If it’s failing when using a build system (cmd+b) then that’s running the system python installation just like you would from the command line.

1 Like

#3

Yes, this is failing when using the Sublime Python3 build system. Sorry didn’t mention that. Your comment if is helpful. I was never sure if the Sublime Python(3) build systems ran the system python or Sublime’s python. Thank you for the clarification. My next step will be to look into why system python is not seeing pandas.

0 Likes