tweag / jupyenv

Declarative and reproducible Jupyter environments - powered by Nix
https://jupyenv.io/
MIT License
655 stars 136 forks source link

How to add packages from Pypi that aren't present in nixpkgs? #193

Closed malteneuss closed 2 years ago

malteneuss commented 2 years ago

I want to use the fastbook package from pypi in jupyter. That package has a lot of transitive dependencies that aren't available in nixpkgs, which are so many that i'm unable to manually package all of them. However, i can easily install all dependencies within a .venv folder, which works outside of jupyter. The problem is that jupyters' python kernel is unaware of those installed packages, and i can't find a way to make those available. Is there a solution or know workaound?

guaraqe commented 2 years ago

I would say the easiest way is to follow the example in examples/Python, which uses Poetry to setup dependencies, and Poetry2Nix to bring them to Nix. If you take the notebook you will see that you are able to import bs4 in it, and access beatifulsoup, which is in the list of deps.

malteneuss commented 2 years ago

Alright, thanks. I'll give it a try.