Python Packages

Learn to install the PyTorch Image Model package and its Python dependencies via different methods.

This lesson will guide us while we set up and install the PyTorch Image Model library and its Python dependencies in our virtual environment.


Install from PyPi

We can easily install the stable version from PyPi by using the following command:

pip install timm

PyTorch Image Model depends on the following Python packages:

  • torch >= 1.4.0
  • torchvision >= 0.5.0
  • pyyaml

The command above will install these dependencies based on our operating system and our version of Python.

Install via Git clone

We can also clone the official repository and install it locally. First, clone it by entering the following:

git clone https://github.com/rwightman/pytorch-image-models

Modify the working directory to pytorch-image-models.

cd pytorch-image-models

Then, run the following command to install it in editable mode:

pip install -e .

Note: This method will install the latest version instead of the stable version, depending on the repository cloned.

Install via Git URL

Alternatively, we can install it directly via Git URL. Simply prefix the URL to the repository with git+.

pip install git+https://github.com/rwightman/pytorch-image-models@v0.5.4

Install via Conda

There’s also support for Anaconda. We can install the PyTorch environment by installing the dependencies as follows:

Get hands-on with 1200+ tech skills courses.