0

In my "base" environment, installing pandas and then importing it using the Spyder IDE works just fine.

However, this is no longer the case when working under a virtual environment. In my terminal, I created a Python 2.7 environment named bodhi:

conda create -n bodhi python=2.7

I activated it:conda activate bodhi

I then installed spyder: sudo -i apt-get install spyder

And finally I installed pandas: conda install pandas

Typing conda list confirms that pandas 0.24.2 was installed properly.

After opening Sypder, typing import pandas in the IPython console returns the following ImportError: No module named pandas.

What am I doing wrong? I am fairly new to virtual environments so I apologize if the question seems obvious!

Sheldon
  • 4,084
  • 3
  • 20
  • 41
  • 1
    I think you need to install Spyder in your environment with conda instead of apt-get because the latter install it globally. – Carlos Cordoba Mar 20 '19 at 20:08
  • That was it! Removing Spyder and then reinstalling it using conda did the trick. Thanks a lot, Carlos! – Sheldon Mar 20 '19 at 20:34

1 Answers1

0

Your conda env isn't the same as your kernel. Open an IPython console Ctrl-T and do your installs and environment management there as described here.

You can also work with your kernel from the console using some of the commands described here: https://stackoverflow.com/a/28840041/10553976

Importantly: path/to/python -m ipykernel install <options>

Charles Landau
  • 4,187
  • 1
  • 8
  • 24