Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jupyter notebook library versions check

I want to share a jupyter notebook, and I want the recipients to know what version of libraries I imported on my system, and so I want to make sure they are aware of the versions used for my python notebook.

What sort of commands I can use or tricks I can employ to automatically provide the requirement and versions of the imported libraries on my system.

Thanks

like image 435
user1780424 Avatar asked Oct 21 '25 00:10

user1780424


1 Answers

Fundamentally, what you want to do is this;

Install and start using virtualenv and virtualenvwrapper (there are lots of web tutorials for this). This will sandbox your projects so that the packages you install will only exist in the context of your project. Aside from fixing dependency issues, it will allow you to create a true list of libraries used.

At any time, you can create a file that defines your libraries with;

pip freeze > requirements.txt

This requirements document should be included with your project so others can use it to do exactly what you ask - know what to install. On the other end (from within a virtualenv), they can type;

pip install -r requirements.txt

And they will get the libraries they need.

Later you can get more advanced with setup tools and other installation utilities, but for most cases, the above will work just fine for you.

Your requirements.txt doc will look something like;

arrow==0.10.0
assertpy==0.12
beautifulsoup4==4.6.0
begins==0.9
bleach==2.1.1
certifi==2017.11.5
cffi==1.11.2
chardet==3.0.4
cycler==0.10.0
dateparser==0.6.0
decorator==4.1.2
entrypoints==0.2.3
future==0.15.2
html5lib==1.0b10
idna==2.6
ipykernel==4.6.1
ipython==6.2.1
ipython-genutils==0.2.0

SteveJ

like image 170
SteveJ Avatar answered Oct 23 '25 15:10

SteveJ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!