0

I'm running my Jupyter Notebook in a virtual environment.

I've installed pandas in it with pip3 install pandas (I've tried with sudo python3 -m pip install pandas in other venv and without sudo, too, like this other post suggests)

I've tried doing export PYTHONPATH=/home/myuser/Notebooks/venv/lib/python3.8/site-packages

but the error remains (I've restarted the notebook kernel, as well). Any idea?

Palinuro
  • 184
  • 1
  • 1
  • 15
  • Does this answer your question? [ImportError: No module named 'pandas' (inside virtualenv)](https://stackoverflow.com/questions/45666097/importerror-no-module-named-pandas-inside-virtualenv) – user40 Mar 23 '21 at 14:02
  • No. I've tried all of that and still doesn't work – Palinuro Mar 23 '21 at 14:18
  • @Palinuro [This new answer worked for me](https://stackoverflow.com/a/72657392/6474744) – Pedram Jun 17 '22 at 10:31

2 Answers2

0

Maybe your are not installing pandas into the virtual environment correctly.

If you have access to a shell, you can possibly cd into the .venv folder. Then you can run source ./bin/activate, after this there should be a (.venv) prefix in your shell window.

Now run your pip3 install pandas commando once again, this time it will install pandas into your virtual environment instead of your global python environment.

Ramon Vermeulen
  • 112
  • 2
  • 9
-1

Installing packages from Notebook running this cell:

! pip install --user numpy
! pip install --user pandas

changing the kernel reselecting Python3 in Kernel -> Change kernel and restarting it, the problem was fixed!

Palinuro
  • 184
  • 1
  • 1
  • 15