0

I would like to use it with Jupyter Lab, a virtual environment created using virtualenv in the Terminal of my computer.

When I want to use the environment in the Terminal, I run workon ami, ami is the name of the environment and it works fine. I have installed some modules such as matplotlib, which I can use inside this environment.

I have tried to use this environment in Jupyter Lab. I have run

python -m ipykernel install --user --name=ami

The name ami can be selected as a kernel in the Jupyter Lab session, but the matplotlib module is not installed. It seems the ami environment created is not the same as that used in the Terminal.

I have tried to install Jupyter Lab in the ami environment, but it does not have matplotlib installed.

I would like to use the environment in Jupyter Lab without installing the Python modules that I already installed.

user1993416
  • 698
  • 1
  • 9
  • 28
  • Possible duplicate of https://stackoverflow.com/questions/29900090/virtualenv-workon-doesnt-work ... but that's just the explanation of why it doesn't work. Is there a reason you don't simply `activate` your virtualenv? – tripleee Oct 10 '20 at 07:10
  • @tripleee Hi, My question is different to the post linked. My virtualenv works fine. I make `workon ami` and the modules load is correct. For example, I can import matplotlib. However, when I start `jupyter lab` and use `ami` kernel then the modules are not there and I cannot import them. – user1993416 Oct 10 '20 at 08:55
  • But `workon` requires a shell, and you don't run a shell inside Jupyter, do you? – tripleee Oct 10 '20 at 09:07
  • Possible duplicate of https://stackoverflow.com/questions/42449814/running-jupyter-notebook-in-a-virtualenv-installed-sklearn-module-not-available though probably not the accepted answer there. – tripleee Oct 10 '20 at 09:10
  • @tripleee Thank you. It does work fine if I do `workon ami` and then run `jupyter-notebook`. However, it does not work running the notebook in `jupiter lab`. Is there any way to use the environment in `jupyter lab` ?. The `ami` kernel I want to use is there but modules installed in the environment are not. – user1993416 Oct 10 '20 at 19:01

0 Answers0