In this guide, we will install the YOLO Ultralytics Package using Conda. Recent updates to the package have caused problems with pip, generating the error: "resolution-too-deep". Conda is a more advanced installer and can be used to overcome these issues.

Transcript

In this guide, we'll be looking at how to install the Ultralytics YOLO vision package on a Raspberry Pi with Conda. This package will allow you to run nearly any YOLO vision model available on their site, and we’ll also provide some demo code to help you get started.

 

Now, this is not a guide on using YOLO models in your projects, but we do have other guides on that, and you can find those linked below. There is also AI hardware available for the Raspberry Pi, like the AI Hat and the AI Camera. This guide will not work with them either. It is specifically for running YOLO on the Pi 5’s CPU only. Running on the CPU is slower, but it’s easier to use and is still fast enough for most projects.

 

If you do want to use that extra AI hardware, chances are we already have a separate guide for you, linked below as well. One more thing before we start: we’ve made the installation instructions in this video fairly future‑proof. However, in the event that an update causes issues down the line, we also have a backup set of instructions in the written guide. Those instructions install a version that is known to work, but it may be a little older. Updates usually happen for a reason, so it’s best to follow the video guide first if you can.

 

To begin, you’ll need to use the Raspberry Pi Imager to install a 64‑bit version of Raspberry Pi OS Bookworm onto your SD card, which should be at least 32 gigabytes. Once that’s finished, insert it into your Pi, boot it up, and complete the setup as you normally would. Nothing special is needed during installation, just make sure you remember your username because we will need it later. Leaving it as “pi” will make life a little easier, and of course be sure to connect to the internet as well.

 

Now that the system is running, open a new terminal window and update the Pi. You’ll find all of the commands for this process in the written guide if you just want to copy and paste them.

 

Normally, you might think about using pip to install Ultralytics, but recent changes to the package mean it has become too complex for pip to manage properly on the Pi. There are too many dependencies and conflicts. Even if it does work, installation can take upwards of an hour. This is why we’re using Conda instead. Conda is a more advanced package manager that handles large, complex packages much more effectively, and generally installs faster too.

 

Unlike pip, Conda does not come pre‑installed on the Pi. To add it, we’ll use Miniforge, which is a Conda installer designed to work on ARM‑based systems like the Raspberry Pi. Once it’s installed, we’ll be able to use Conda to set everything up properly. During installation you’ll be asked whether you want Conda to be your default manager. Make sure to choose “no” at that step.

 

Once Conda has been installed, the next step is to activate it. Anytime you want to use Conda in the future, you’ll need to activate it first. After that, we’ll install something called the Libmamba Solver. This improves Conda’s ability to figure out dependencies and is very helpful when working with complex packages.

 

Now before installing anything else, we’ll create a virtual environment. This is like a separate workspace that contains only the packages you install inside of it. It keeps your system clean and prevents conflicts. We’ll name the environment “ultralytics‑env.” Once it’s created, you’ll know you’re working inside of it because the terminal will show the name in brackets. If you ever need to come back later, or if you accidentally close your terminal, just reactivate Conda and then reactivate the environment to jump back in.

 

With the environment active, we can go ahead and install the Ultralytics package. Conda will handle the process for us. Once that’s completed, we’ll also install PyTorch, which Ultralytics needs to function. At this stage, Ultralytics is installed.

 

Next we need to make sure the camera is supported. By default, the Raspberry Pi uses PyCamera2 to handle its cameras. Since PyCamera2 doesn’t install cleanly with Conda, instead we’ll link our new environment to the version that already comes with the Pi. You’ll just need to remember what your username is when adjusting that line. For most people it will simply be “pi.”

 

Now we run into a small issue. PyCamera2 relies on an older version of NumPy than the one Conda installed. To check which version it uses, open a brand‑new terminal window outside of the Conda environment and check the system version there. For example, my system reported version 1.24.2, while my Conda environment had already installed something much newer. Once you have that number, switch back into your environment and install that exact version of NumPy. This solves the conflict and allows both Ultralytics and PyCamera2 to work together.

 

At this point, we’ve successfully installed both the Ultralytics YOLO package and PyCamera2, and we’re ready to run YOLO on the Pi.

 

There’s just one more thing to do, and that is to set up Thonny so it uses the environment we just created instead of the default system Python. If this is your first time opening it, Thonny will start in simple mode, so switch it over to regular mode. After restarting, go up to “Run” and then “Configure Interpreter.” From there, under “Python Executable,” you’ll need to browse for the Conda environment we just created. Navigate into the Miniforge3 folder, then into environments, select the one we created called ultralytics‑env, and go into its bin folder. There, choose the Python file. Once that’s selected, Thonny will be using the environment we set up.

 

Now head over to the written guide, where you’ll find some demo code. The code captures video from a connected camera module and runs YOLO object detection on it. When you run it for the first time, YOLO will automatically download models and anything else it needs to get up and running. This is one of the big advantages of Ultralytics — once installed, it manages all those extras for you.

 

When the demo code is running, point your camera at something, and you should see bounding boxes appear around objects as they’re detected. If you see those detection boxes on screen, then congratulations: you’ve successfully installed and run YOLO Vision on your Raspberry Pi 5.

 

It may seem a little bit slow, since it’s running on CPU only, but it’s up and working and ready for you to build on in your projects.

Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.