Installing Python Packages

Script and Server files run full Python 3.10 environments where you can install third-party Python packages.

To install a package, click the ‘Packages’ tab in the code editor to open the side panel. Here, you can enter a package name (as it appears in PyPI) and a version number. Leaving the version number blank will install the latest version of the package. Once you’ve added the package name (and optional version number), click “Add”, and the new Python environment will start building.

Adding the `numpy` package to a widget's Python environment.

Adding numpy from the Packages tab

Editing the requirements.txt directly

You can also add Python packages to your widget’s environment by editing its requirements.txt directly. uses pip for package management, so you can install packages from PyPI, a GitHub repository or a URL using pip’s Requirements File Format. Click “Edit requirements.txt directly” to switch to a text editor view where you can type in your package list directly, just as you would a requirements.txt file. This way, you can specify more nuance in your version dependencies, such as using the <= operator.

A screenshot of the text editor to edit the `requirements.txt` file from the Packages tab

Build output

Once you add a Python package to your environment, will start installing your packages and creating a new server environment. You’ll be able to see the output from this process if you click the caret next to ‘Building…’ (or ‘Built’ if the environment is built already!)

A screenshot of the build output in the Packages tab of a widget

The build output after installing Python packages

Possible errors

Sometimes, an error can occur during the build process, and displays the output from pip’s install process directly. The two most common causes of build failures happen when a requested package could not be found or when there is a conflict in dependency versions.

Package does not exist

ERROR: Could not find a version that satisfies the requirement `bad-package` (from versions: none)
ERROR: No matching distribution found for `bad-package`
Error: Build failed

This typically happens due to a typo. Double-check that the package you have requested is spelled correctly and that the requested version (if any) is correct.

Conflicting dependencies

ERROR: Cannot install pymongo==4.1.0 and pymongo==4.1.1 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit
Error: Build failed

This happens when the dependencies you have requested have incompatible requirements. For help resolving this, visit pip’s dependency conflict management page.


Once a server environment has been built, will use safety to check the installed dependencies of that environment for vulnerabilities. The output of this can be seen below the Build Output section.

If security vulnerabilities are detected, a button will appear. Click on this button to bring up the vunerability report

The environment has a security vunerability

The environment has a security vunerability

A vunerability report for a built Python environment

A vunerability report for a built Python environment

Do you still have questions?

Our Community Forum is full of helpful information and friendly experts.