Question

Python packages in Paperspace notebooks

What’s the “right” way to install python packages in a Paperspace PyTorch Notebook? If I just use pip, it works, but I get a warning recommending that I use a virtual environment. That makes sense, but presumably the notebook won’t just automatically use it if I create one, so additional steps would be needed.

Is this explained somewhere in the documentation that I’m missing? (docs.digitalocean.com/products/paperspace/notebooks/)

Do I:

  • Just use pip and ignore the warning? (pip install --user ... has the same warning because the user is root.) By the way, this would need to be done every time the machine is started.
  • Or… Create a virtual environment, and then do something to get the notebook to use it (or I need to forgo the pre-installed notebook and set up a new one in the venv)? What are the exact steps?
  • Or… Figure out what packages are needed before creating the notebook in Paperspace, then fork the container image it would’ve used, and add the package(s) to that? (And if you find out later you need another package or need to upgrade, you have to start from scratch again, or use pip anyway, every time you start the machine?)
  • Or… Something else?

It seems odd to me that this isn’t a common need that would be documented somewhere. (Or that they wouldn’t at least say to ignore the warning, if plain old pip is what to use.) Am I totally missing something, or asking the wrong question?

Even if I didn’t need to install a new package, if down the road I need to upgrade existing packages, how is that done? Like I said, it seems that anything I do with regular pip has to be redone each time the machine is started.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.