Context

When a new version of a python package is available on PyPI but not conda-forge, we will want to grab it from PyPI and install it. But because our production services are mostly air-gapped, a simple pip install command will not work as it won't be able to access PyPI to retrieve the package or any other dependencies.

Note that while following the steps in this document will result in a successful install, make sure you have an approved CATER before doing this so everyone will be aware of upcoming changes to the environment.


The Simple Case

For a package whose installation is self-contained, the following steps may be taken. PyDM will be used as an example:


  • Grab the source for the latest version from PyPI, substituting the name of the package needed: https://pypi.org/project/pydm/#files
  • scp the tar file into production from mcclogin, let's say to /home/softegr/jesseb/new_pydm
  • pip install --upgrade --no-deps /home/softegr/jesseb/new_pydm/pydm-version.tar.gz
  • pip show pydm  (verifies the installation)


A More Complicated Case

When the package you are trying to install contains dependencies that must be pulled in from elsewhere and then built, the above steps will not work.

If you are unsure if this is the case or not, trying to follow the above instructions first will let you know as it will fail while trying to pull in the external dependencies. In this case the following steps can be followed, using p4p as an example:


  • On a dev machine, create a file called requirements.txt and list the package and version you need. For this example it will contain only one line: p4p==3.5.5
  • Run the following pip command which will download (but not install) all required wheel files and source code to build the package
  • pip download -r requirements.txt
  • Copy all downloaded files that are not yet in our current environment onto production from mcclogin, let's say to /home/softegr/jesseb/new_p4p.
  • Remove the existing version of p4p from the conda environment, using one of the following 2 commands:
  • If built with conda: /usr/local/lcls/package/anaconda/2020.11/bin/conda remove --force --offline p4p  
  • If built with pip: pip uninstall p4p
  • Now install the new version using this command, though modify to point to the location of the download files from above:
  • pip install --no-index --find-links /home/softegr/jesseb/new_p4p/ -r requirements.txt
  • pip show p4p (verifies the installation)





  • No labels