Site packages location not shared between Python and Jupyter Lab

I appreciate the fact that Jupyter runs in an isolated mode. I read several posts about it by now.

What I don't understand is why the JUPYTER_PATH variable is ignored as well as appending manually (as a proof of concept) the path of the current site packages from my brewed Python dir. I couldn't find any documentation specific for the Lab so I assumed this should have worked out of the box.

Any idea on how to avoid installing all the necessary packages via a !{sys.executable} -m pip install .... from within Jupyter?

Of course modifying the sys.path from within the environment is one option, but this has to be done on a per notebook basis, which is not ideal.

I'd like to install things from command line via pip and be able to use them immediately.

Thanks

Topic pip jupyter

Category Data Science


A new version of Python was released, and yet again I lost all my libraries by the the time Brew dropped in the new release.

I, therefore, spent some time to look into the best options out of there, and I believe the best is to use a Python Environment management package.

I decided to stick on PyEnv.

enter image description here

A simple %pip -V demonstrates how the command is now run from the shim's directory, which makes me confident whatever I'm now going to install will persist in the 3.8.2 folder and will be movable at a later stage.

Guess that moving packages will be not as easy as 1-2-3, but at least I may not necessarily have to download all of them rather than copy/move. Any more expert advice here is welcome.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.