Since these wheels are built as root inside the container, you may need to chown the files on the host to prevent permission issues later:

sudo chown $(id -un):$(id -gn) pip_packages/*

Adding third party packages to a virtualenv

Add the packages to requirements.txt. If the packages are not in pip_packages yet, add the packages to pip_packages.

Adding first party modules to a virtualenv's import path

“First party modules” refers to Chromium OS code (anything checked out by repo).

NOTE: Do not use this for third party dependencies (stuff not owned by Chromium OS)! This should only be used to set up imports for stuff we own. For example, importing python-MySQL SHOULD NOT use this, but importing chromite MAY use this.

There are two ways to do this:

Adding a relative symlink to venv.

Modifying sys.path in __init__.py.

Adding a symlink to venv is simple and should be self-explanatory. However, keep in mind that repo checkouts may not always have the same structure, and certain environments such as production servers may check out repositories in completely different locations. This method is not powerful enough to account for these environments.

Modifying sys.path is a lot more powerful. The way to do this is to add a small bit of code to the __init__.py of the package that needs the import.