Shortcuts

Installation

TorchGeo is simple and easy to install. We support installation using the pip, conda, and spack package managers.

pip

Since TorchGeo is written in pure-Python, the easiest way to install it is using pip:

$ pip install torchgeo

If you want to install a development version, you can use a VCS project URL:

$ pip install git+https://github.com/microsoft/torchgeo.git

or a local git checkout:

$ git clone https://github.com/microsoft/torchgeo.git
$ cd torchgeo
$ pip install .

By default, only required dependencies are installed. TorchGeo has a number of optional dependencies for specific datasets or development. These can be installed with a comma-separated list:

$ pip install torchgeo[datasets]
$ pip install torchgeo[style,tests]

See the setup.cfg for a complete list of options. See the pip documentation for more details.

conda

If you need to install non-Python dependencies like PyTorch, it’s better to use a package manager like conda. First, you’ll want to configure conda to only use the conda-forge channel:

$ conda config --add channels conda-forge
$ conda config --set channel_priority strict

Now, you can install the latest stable release using:

$ conda install torchgeo

Conda does not directly support installing development versions, but you can use conda to install our dependencies, then use pip to install TorchGeo itself.

$ git clone https://github.com/microsoft/torchgeo.git
$ cd torchgeo
$ conda env create --file environment.yml
$ conda activate torchgeo
$ pip install .

Note

The above method will not work on Windows. Windows users are recommended to create a conda environment and install dependencies via pip.

Conda does not directly support optional dependencies. If you install from conda-forge, only required dependencies will be installed by default. Optional dependencies can be installed afterwards using pip. If you install using the environment.yml file, all optional dependencies are installed by default.

See the conda-forge documentation for more details.

spack

If you are working in an HPC environment or want to install your software from source, the easiest way is with spack:

$ spack install py-torchgeo
$ spack load py-torchgeo

Our Spack package has a main version that can be used to install the latest commit:

$ spack install py-torchgeo@main
$ spack load py-torchgeo

Optional dependencies can be installed by enabling build variants:

$ spack install py-torchgeo+datasets
$ spack install py-torchgeo+style+tests

Run spack info py-torchgeo for a complete list of variants.

See the spack documentation for more details.

Read the Docs v: v0.2.0
Versions
latest
stable
v0.2.0
v0.1.1
v0.1.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources