Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing requirements in IPython Notebook?

I am a Python programmer, new to IPython Notebook. I have started a notebook that uses numpy.

If I was publishing the same code as a standalone Python script, I'd include a requirements.txt file with numpy and its version, so that other users can install the same version into a virtualenv when they run the script.

What is the equivalent of this for iPython Notebook? I can't find anything about managing requirements in the documentation, only about the dependencies required to install IPython itself.

My requirements are that I'd like to make sure that the notebook is using a particular version of numpy, and I want to make sure that I can publish the notebook with the same version specified.

like image 743
Richard Avatar asked Nov 03 '15 04:11

Richard


1 Answers

If you have Jupyter in your requirements.txt and you activate that environment (I recommend Virtualenv), install, and run Jupyter, you'll have all the specific versions you want. So:

  1. python3 -m venv venv

  2. source venv/bin/activate (different command on Windows)

  3. pip install -r requirements.txt

  4. jupyter lab (or jupyter notebook)

like image 191
Boris Yakubchik Avatar answered Sep 20 '22 22:09

Boris Yakubchik