Pip

Rez is language agnostic. But since python is so prevalent in the VFX industry (and outside), rez knows how to convert/translate Pip packages into rez packages. It does this using the rez-pip command.

Warning

This command will not translate rez packages into Pip packages.

Hint

We are planning to introduce a new rez-pip implemented as a plugin that will overcome most of the current rez-pip limitations and annoyances.

Usage

See rez-pip.

Which Pip will be used?

rez-pip uses a fallback mechanism to find which Pip will be used to run the commands. The logic is as follows:

  1. Search for Pip in the rezified python package specified with --python-version, or the latest version if not specified;

  2. If found, use it;

  3. If not found, search for pip in the rezified pip package (this is for backwards compatibility);

  4. If rezified pip is found, use it;

  5. If not found, fall back to Pip installed in rez’s own virtualenv.

Note

In all of these options, we also check if the version of Pip is greater or equal than 19.0. This is a hard requirement of rez-pip.

Note that rez-pip output should tell you what it tries and which Pip it will use.

It is extremely important to know which Pip is used and understand why it is used. Pip packages define which python version they are compatible with. When you install a Pip package, Pip checks which python version it is currently running under to determine if a package can be downloaded and installed. It also checks which python implementation is used (CPython, PyPy, IronPython, etc), the architecture python was built with, and other variables. So the thing you really need to know first is which python you want to use and from there you should know which Pip is used. Knowing the Pip version is of secondary importance.

At some point, we supported a --pip-version argument, but considering what was just said above, we decided to remove it. Pip is too tightly coupled to the python version/interpreter it is installed with for us to support having Pip as a rez package. We just can’t guarantee that Pip can be installed once in a central way and work with multiple different python version, and potentially different implementations.

How should I install Pip?

Following the Which Pip will be used? section, we recommend you install Pip inside your python packages. For Python 2, this can be done when you compile it with the --with-ensurepip flag of the configure script. This will install a version older than 19.0 though, so you will need to upgrade it. For Python 3, it is already installed by default. Though your mileage may vary for the version installed, depending on which Python version you installed. So check the Pip version and update it if necessary. We also encourage you to install wheel and possibly update setuptools. pip, setuptools and wheel are perfectly fine when installed in the interpreter directly as they are pretty core packages and all have no dependencies (and that’s what virtualenv does by default too).

Tip

When installing something in an interpreter, make sure you really install in this interpreter. That means using something like:

$ /path/to/python -E -s -m pip install <package>

-E will force any PYTHON* environment variables to be ignored, and -s will remove your user site from the equation.

Install/Release

You have two options when you want to convert a Pip package to a rez package. You can install it, or release it. Install means that it will install in your local_packages_path, while release means it will be installed in your release_packages_path. You can also specify a custom installation location using --prefix (or -p).

You can (and we recommend) use --python-version to choose for which python version you want to install a given package. This will make rez-pip resolve the given version of the python rez package and use it to run the pip install. See Which Pip will be used? for more details. If the Pip package is not pure (so contains .so for example), you will need to run rez-pip for each python version you want to install the Pip package for.

Tip

See How should I install Pip? on how we recommend to install pip.