Ultralytics YOLO27: Join the waitlist.
Get Started

How to Install Ultralytics YOLO with Conda#

Ultralytics package for Conda from conda-forge

This guide walks through setting up a Conda environment for your Ultralytics projects. Conda is an open-source package and environment management system and an alternative to pip for installing packages and dependencies. Its isolated environments make it particularly well-suited for data science and machine learning work.

Conda Version Conda Downloads Conda Recipe Conda Platforms

This guide covers how to create an environment with Ultralytics, run inference, use the Conda Docker image, and speed up installs with libmamba.

Prerequisites#

You should have Anaconda or Miniconda installed on your system. If not, download and install it from Anaconda or Miniconda.

Installing Ultralytics#

Create a new Conda environment with Ultralytics from the conda-forge channel, then activate it. Install Python, Ultralytics, and torchvision (not a dependency of the conda-forge package) in the same command so conda resolves current, compatible versions together:

conda create --name ultralytics-env -c conda-forge python=3.11 ultralytics torchvision -y
conda activate ultralytics-env
Installing in a CUDA environment

If you're working in a CUDA-enabled environment, add the conda-forge pytorch-gpu metapackage to the same command so conda resolves a CUDA-enabled PyTorch build:

conda create --name ultralytics-env -c conda-forge python=3.11 ultralytics torchvision pytorch-gpu -y
conda activate ultralytics-env

Note on ROCm Environment (AMD GPU, Linux)#

For AMD GPU acceleration on Linux using ROCm, PyTorch ROCm wheels are not available via Conda and must be installed with pip. Use a Conda environment for isolation, then install PyTorch ROCm and Ultralytics via pip:

conda create --name ultralytics-rocm python=3.12 -y
conda activate ultralytics-rocm
pip install "torch[device-all]" "torchvision[device-all]" --index-url https://stable.repo.amd.com/rocm/whl-next/
pip install ultralytics

See the PyTorch Get Started page for supported ROCm versions and the AMD GPU guide for MIGraphX inference setup, which requires Python 3.11 or newer on Linux x86_64.

Using Ultralytics#

With Ultralytics installed, you can run object detection, instance segmentation, and other vision tasks. For example, to run inference on an image:

from ultralytics import YOLO

model = YOLO("yolo26n.pt")  # initialize model
results = model("path/to/image.jpg")  # perform inference
results[0].show()  # display results for the first image

Ultralytics Conda Docker Image#

The Conda Dockerfile uses conda-forge PyTorch 2.13, torchvision 0.28, and CUDA 13.0. Conda-forge releases can lag the PyTorch pip releases used by the standard GPU image. Automated publishing of latest-conda is disabled, so build the current image locally:

git clone https://github.com/ultralytics/ultralytics
cd ultralytics
t=ultralytics-conda:local
sudo docker build -f docker/Dockerfile-conda -t $t .

Run the image:

# Run the Ultralytics image in a container with GPU support
sudo docker run -it --ipc=host --device nvidia.com/gpu=all $t                         # all GPUs
sudo docker run -it --ipc=host --device nvidia.com/gpu=2 --device nvidia.com/gpu=3 $t # specify GPUs

On Linux, CDI device requests require Docker >= 28.2.0 and NVIDIA Container Toolkit >= 1.18. The legacy --gpus all flag can lose GPU access after host daemon reloads, so upgrade older Linux hosts and use --device instead. See the Docker Quickstart Guide for details.

Speeding Up Installation with Libmamba#

libmamba is a fast, cross-platform, dependency-aware solver that replaces Conda's classic solver. Conda 23.10 and later already use libmamba as the default solver, so most installations are faster out of the box.

If you're on an older Conda version, you can enable libmamba manually:

  1. First, install the conda-libmamba-solver package:

    conda install conda-libmamba-solver
  2. Next, configure Conda to use libmamba as the solver:

    conda config --set solver libmamba

You have successfully set up a Conda environment, installed the Ultralytics package, and are now ready to explore its features. For more advanced tutorials and examples, see the Ultralytics documentation.

FAQ#

  • Create the environment with Python and Ultralytics from the conda-forge channel in one command, so conda resolves them together, then activate it:

    conda create --name ultralytics-env -c conda-forge python=3.11 ultralytics torchvision -y
    conda activate ultralytics-env
  • Conda is a package and environment management system that offers several advantages over pip. It manages dependencies efficiently and ensures that all necessary libraries are compatible. Conda's isolated environments prevent conflicts between packages, which is crucial in data science and machine learning projects. Additionally, Conda supports binary package distribution, speeding up the installation process.

  • Yes. Create the environment with ultralytics and the conda-forge pytorch-gpu metapackage in the same command so a CUDA-enabled PyTorch build is resolved alongside it:

    conda create --name ultralytics-env -c conda-forge python=3.11 ultralytics torchvision pytorch-gpu -y
    conda activate ultralytics-env

    This setup enables GPU acceleration, crucial for intensive tasks like deep learning model training and inference. For more information, visit the Ultralytics installation guide.

  • The Conda Dockerfile provides an isolated conda-forge environment with CUDA-enabled PyTorch. Follow the local build instructions, then run it with the GPU options shown there. The standard published GPU image and other alternatives are listed in the Docker guide.

  • Conda 23.10 and later already use the fast libmamba solver by default. On older Conda versions, you can enable it manually by first installing the conda-libmamba-solver package:

    conda install conda-libmamba-solver

    Then configure Conda to use libmamba as the solver:

    conda config --set solver libmamba

    This setup provides faster and more efficient package management.

Comments6

Ask a question, share your results, or help someone else.

  1. najwazkiyahhnajwazkiyahhGitHub

    Hi! I'm the new to using YOLO. I have python 3.12 on my laptop because my previous exam need it-the latest version of python. I want to install ultralytics YOLOv11, should I downgrade my python version from 3.12 into 3.11? Or I should downgrade my python version to the recommended requirement, 3.8? Thank you, hope you (anybody) can answer my confusion.

    1. Glenn JocherGlenn JocherUltralytics

      @najwazkiyahh you don't need to downgrade your system Python! 😊 Simply create a Conda environment with Python 3.11 using conda create --name yolo_env python=3.11, then activate it and install Ultralytics. This keeps your existing Python 3.12 intact while giving you a compatible YOLO11 environment. For full steps, see the Conda Quickstart Guide for Ultralytics.

      We recommend this approach as it maintains version isolation while allowing you to work with both Python versions seamlessly. Welcome to the YOLO community! 🚀

  2. MalvinlamMalvinlamGitHub

    Hi is there a way to install the yolov8 dependencies using Anaconda prompt to the virtual environment other than pip install ultralytics? For example I already downloaded the ultralytics package from GitHub and opened it as project folder using PyCharm. Is there a way to only install the required libraries?

    1. Glenn JocherGlenn JocherUltralytics(edited)

      @Malvinlam hi there! 👋

      Absolutely, you can install the required dependencies for Ultralytics using Conda without relying on pip install ultralytics. Here's a step-by-step guide to help you set up your Conda environment and install the necessary libraries:

      1. Create a New Conda Environment: First, create a new Conda environment with Python 3.11 (or your preferred version):

        conda create --name ultralytics-env python=3.11 -y
      2. Activate the Environment: Activate your newly created environment:

        conda activate ultralytics-env
      3. Install Required Libraries: The repository no longer has a requirements.txt; its dependencies are declared in pyproject.toml. From the root of your cloned repository, run:

        pip install -e .

        Alternatively, if you want to install specific packages manually, you can use:

        conda install -c conda-forge numpy pandas matplotlib opencv scikit-learn
        conda install -c pytorch pytorch torchvision torchaudio
      4. Note on CUDA Environment: If you're working in a CUDA-enabled environment, it's a good practice to install pytorch and pytorch-cuda together to resolve any conflicts:

        conda install -c pytorch -c nvidia -c conda-forge pytorch torchvision torchaudio pytorch-cuda=11.8
      5. Using Ultralytics: With the dependencies installed, you can now start using Ultralytics. For example, to perform inference with YOLO26:

        from ultralytics import YOLO
        
        model = YOLO("yolo26n.pt")  # initialize model
        results = model("path/to/image.jpg")  # perform inference
        results[0].show()  # display results for the first image

      For more detailed instructions, you can refer to our Conda Quickstart Guide.

      If you encounter any issues or have further questions, feel free to ask. Happy coding! 😊

  3. nadinatornadinatorGitHub

    Does the python version have to be 3.8? Can it be a newer version? What would/wouldn't break if we used 3.11, for example (I'm thinking of the [ray]tuning feature)?

    1. Glenn JocherGlenn JocherUltralytics

      Hey there! 😊

      You can definitely use Python versions newer than 3.8, including 3.11. However, it's important to note that while most features should work fine, there might be some compatibility issues with newer Python versions, especially with external libraries or specific features like [ray] tuning.

      If you're keen on using Python 3.11, I'd recommend testing the key functionalities you plan to use in your project to ensure everything runs smoothly. For the [ray] tuning feature, you might want to check Ray's documentation or GitHub issues for any known compatibility concerns with Python 3.11.

      Here's a quick example of how you might set up your environment with Python 3.11:

      conda create --name ultralytics-env python=3.11 -y
      conda activate ultralytics-env
      conda install -c conda-forge ultralytics

      And remember, if you encounter any issues, the Ultralytics community is here to help! 🚀