I was following a tutorial for removing backgrounds in images with python and came across an issue when running pip install rembg on a Raspberry Pi.

The issue appears to be wit a requirement to install onnxruntime.

The Error I am getting is the following:

    Code: Select all
    ERROR: Cannot install rembg==2.0.28, rembg==2.0.29, rembg==2.0.30, rembg==2.0.31, rembg==2.0.32, rembg==2.0.33, rembg==2.0.34, rembg==2.0.35, rembg==2.0.36, rembg==2.0.37, rembg==2.0.38, rembg==2.0.39, rembg==2.0.40, rembg==2.0.41 and rembg==2.0.43 because these package versions have conflicting dependencies.
    The conflict is caused by:
        rembg 2.0.43 depends on onnxruntime
        rembg 2.0.41 depends on onnxruntime
        rembg 2.0.40 depends on onnxruntime
        rembg 2.0.39 depends on onnxruntime>=1.14.1
        rembg 2.0.38 depends on onnxruntime>=1.14.1
        rembg 2.0.37 depends on onnxruntime>=1.14.1
        rembg 2.0.36 depends on onnxruntime>=1.14.1
        rembg 2.0.35 depends on onnxruntime>=1.14.1
        rembg 2.0.34 depends on onnxruntime>=1.14.1
        rembg 2.0.33 depends on onnxruntime>=1.14.1
        rembg 2.0.32 depends on onnxruntime>=1.13.1
        rembg 2.0.31 depends on onnxruntime>=1.13.1
        rembg 2.0.30 depends on onnxruntime~=1.13.1
        rembg 2.0.29 depends on onnxruntime==1.13.1
        rembg 2.0.28 depends on onnxruntime==1.13.1

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

Here is what I am using: Raspberry Pi 4 B with Raspberry Pi OS (64-bit)

Here is what I have tried to do to fix the issue:

When attempting to

  1. running pip install onnxruntime
  2. loosen the range of package versions you've specified
  3. remove package versions to allow pip attempt to solve the dependency conflict
  4. Followed these instructions to build and run as an IoT

I get the same error.

However, if I change the Micro SD card with another OS such as Ubuntu Desktop 23.04 (64-bit) or Ubuntu MATE pip install rembg works. No errors with onnxruntime. I also tested this with a couple virtual machines and I get the same results leading me to believe it has something to do with the RaspberryPi OS. But I am not sure what it is.

My questions to the community:

  1. What could be causing the issue of installing onnxruntime on the Raspberry Pi OS (64-bit) OS and not with Ubuntu if it still the same board?
  2. What could be a fix or best way to start looking into the root cause?

I also posted this on https://forums.raspberrypi.com/viewtopic.php?p=2111963#p2111963

1 Answer 1


I was using a 32Bit system instead of 64Bit. Imaged the MicroSD to a 64BIT and it worked. Desktop vm was also 32. I see in the documentation that 32BIT is possiblee if built manually.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.