-1

I am currently trying to deploy a Yolo model to raspberry pi so I am trying to install Ultralytics and torch(which is included in Ultralytics I guess) but it shows an error every time.

the error shows this image

enter image description here the second image is the error I got when I tried to install Ultralytics

also, I tried to install it with the wheel file downloaded directly from pytorch website, but it had the same result.

The spec of my raspberry pi is raspberry pi 4, bullseye, aarch64, and using Python 3.9.2

That virtual environment 'tf' is completely new, and I just installed open-cv.›

Can anyone know how to fix it? It would be really helpful.

Sujith Kumar
  • 872
  • 6
  • 19
mangs
  • 29
  • 4
  • Maybe you need a version of Python other than 3.9.2. Looks like a version incompatibility. – duffymo Jun 01 '23 at 11:25
  • do you know which python version would be compatible? I've also tried on 3.7.2 but it falied also – mangs Jun 01 '23 at 11:32
  • Have you tried on a device other than Raspberry Pi? See if the issue is hardware. https://github.com/pytorch/pytorch/wiki/PyTorch-Versions – duffymo Jun 01 '23 at 12:04
  • https://linuxhint.com/install-pytorch-raspberry-pi/ – duffymo Jun 01 '23 at 12:05
  • Yes, i did tried that website's solution, and i've tried on my macbook M2, python 3.9.11 it didn't have any problem. I've also tried resetting my raspberry pi and tried again and also i have another raspberry pi 4 and also failed on that. – mangs Jun 01 '23 at 12:17
  • Sounds like a Raspberry Pi problem. – duffymo Jun 01 '23 at 12:26
  • At the bottom it says you need `torchvision >= 0.8.1`, did you try upgrading your Torchvision? `pip install --upgrade torchvision` – Brock Brown Jun 01 '23 at 13:50
  • If after you update torchvision, `import torchvision; print(torchvision.__version__)` still yields less than 0.8.1, you might have to do as @duffymo recommends and upgrade your Python. – Brock Brown Jun 01 '23 at 14:00
  • @BrockBrown I just tried that and reinstall torchvision, first i uninstalled and deleted pip cache and then ""pip install torchvision>=0.8.1"" then it shows this Warning and installed 0.1.6 instead ""WARNING: The candidate selected for download or install is a yanked version: 'torchvision' candidate (version 0.1.6 at https://www.piwheels.org/simple/torchvision/torchvision-0.1.6-py3-none-any.whl#sha256=5ec9edf604160b4dcf857a66bd499502173e74d4d7a83bd55b08244f6dacb9d7 (from https://www.piwheels.org/simple/torchvision/)) Reason for being yanked: "" – mangs Jun 01 '23 at 14:02
  • @BrockBrown I also tried on 3.10.11 environment. still the same.. – mangs Jun 01 '23 at 14:04
  • So, i just tried installing ultralytics again to see the dependency log, and now it doesn't say anything about torchvision, but it still saying i need torch>=1.7.0 but i can't install torch neither – mangs Jun 01 '23 at 14:06
  • Hmm I think the only other things I can think of trying are to downgrade your Python (3.8 maybe?) or just use Balenalib's Docker image for raspberry pi, it might behave less erratically. https://hub.docker.com/r/balenalib/raspberry-pi – Brock Brown Jun 01 '23 at 15:43
  • Torch installs just fine on your pi configuration. You should first make sure apt-get update and upgrade have been run. Then install with --upgrade your setuptools and pip. Finally just use pip for torch components . No need for extraurl parameter. You'll get latest for aarch64. 2.0.1 I think – dbmitch Jun 06 '23 at 15:19

1 Answers1

0

Raspberry has no GPU. Install the CPU version.

pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cpu

(instead of cu116)

blue_lama
  • 125
  • 7