Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove bytetracker dependency from requirements.txt of /runtime/python/detection_with_tracker/ #322

Open
sebastianfis opened this issue Nov 14, 2024 · 3 comments

Comments

@sebastianfis
Copy link

The bytetracker package includes dependencies on very old versions of torch and lap packages. That raises compatibility issues with python versions >= 3.11 (it's not impossible getting it to run, but it's not easy and certanily not straightforward). The way I see it, the code does not make use of the bytetracker package (anymore?), but instead uses the byte track implementation of supervision. I suggets to remove this dependency to make installation on newer python versions easier.

@hailocs
Copy link
Collaborator

hailocs commented Nov 20, 2024

Hi @sebastianfis,

Supervision requires bytracker, so it would still be a dependency.
But we plan on upgrading the supervision/bytetracker version in the near future.

@sebastianfis
Copy link
Author

sebastianfis commented Nov 20, 2024

Hi @hailocs,

Are you sure this is true for version 0.19.0? I checked the pyproject.toml of this release:
https://github.com/roboflow/supervision/blob/55f93a85b6a76c710c764f4f96dfb4d8cc73bb90/pyproject.toml
I could not find bytetracker in the packages section. I also did an experiment on my Raspi 5 with a freshly setup venv:
Installation with unchanged requirements.txt results in (due to incomapatibility of bytetracker with python 3.11 on bullseye:

(.env) pi@raspberrypi:~/Hailo-Application-Code-Examples/runtime/python/detection_with_tracker $ pip install -r requirements.txt 
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting bytetracker
  Downloading https://www.piwheels.org/simple/bytetracker/bytetracker-0.3.2-py3-none-any.whl (11 kB)
Collecting supervision==0.19.0
  Downloading https://www.piwheels.org/simple/supervision/supervision-0.19.0-py3-none-any.whl (97 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.1/97.1 kB 730.6 kB/s eta 0:00:00
Collecting loguru
  Downloading https://www.piwheels.org/simple/loguru/loguru-0.7.2-py3-none-any.whl (62 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 kB 105.6 kB/s eta 0:00:00
Collecting tqdm
  Downloading https://www.piwheels.org/simple/tqdm/tqdm-4.67.0-py3-none-any.whl (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.6/78.6 kB 632.2 kB/s eta 0:00:00
Collecting requests
  Downloading https://www.piwheels.org/simple/requests/requests-2.32.3-py3-none-any.whl (64 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.9/64.9 kB 679.6 kB/s eta 0:00:00
Collecting opencv-python
  Downloading opencv_python-4.10.0.84-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (41.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.7/41.7 MB 1.3 MB/s eta 0:00:00
Collecting defusedxml<0.8.0,>=0.7.1
  Downloading https://www.piwheels.org/simple/defusedxml/defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Collecting matplotlib>=3.6.0
  Downloading matplotlib-3.9.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.2/8.2 MB 1.7 MB/s eta 0:00:00
Collecting numpy>=1.21.2
  Downloading numpy-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.9/13.9 MB 1.7 MB/s eta 0:00:00
Collecting opencv-python-headless>=4.5.5.64
  Downloading opencv_python_headless-4.10.0.84-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (29.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 29.3/29.3 MB 1.3 MB/s eta 0:00:00
Collecting pillow>=9.4
  Downloading pillow-11.0.0-cp311-cp311-manylinux_2_28_aarch64.whl (4.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 1.8 MB/s eta 0:00:00
Collecting pyyaml>=5.3
  Downloading PyYAML-6.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (736 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 736.8/736.8 kB 1.8 MB/s eta 0:00:00
Collecting scipy<2.0.0,>=1.10.0
  Downloading scipy-1.14.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (35.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 35.6/35.6 MB 1.5 MB/s eta 0:00:00
Collecting lap==0.4.0
  Downloading lap-0.4.0.tar.gz (1.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 1.5 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting bytetracker
  Downloading https://www.piwheels.org/simple/bytetracker/bytetracker-0.3.1-py3-none-any.whl (11 kB)
  Downloading https://www.piwheels.org/simple/bytetracker/bytetracker-0.3.0-py3-none-any.whl (11 kB)
  Downloading https://www.piwheels.org/simple/bytetracker/bytetracker-0.2.5-py3-none-any.whl (11 kB)
  Downloading https://www.piwheels.org/simple/bytetracker/bytetracker-0.2.4-py3-none-any.whl (10 kB)
Collecting cython-bbox==0.1.3
  Downloading cython_bbox-0.1.3.tar.gz (41 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.3/41.3 kB 1.7 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-1q2aqt5r/cython-bbox_69c60d8158174eba9326e3f7bc05a302/setup.py", line 10, in <module>
          from Cython.Build import cythonize
      ModuleNotFoundError: No module named 'Cython'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Removing bytetracker from requirements.txt results in the package installation working just fine (some packages are now cached from previous installatoin attempt:

(.env) pi@raspberrypi:~/Hailo-Application-Code-Examples/runtime/python/detection_with_tracker $ pip install -r requirements.txt 
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting supervision==0.19.0
  Using cached https://www.piwheels.org/simple/supervision/supervision-0.19.0-py3-none-any.whl (97 kB)
Collecting loguru
  Using cached https://www.piwheels.org/simple/loguru/loguru-0.7.2-py3-none-any.whl (62 kB)
Collecting tqdm
  Using cached https://www.piwheels.org/simple/tqdm/tqdm-4.67.0-py3-none-any.whl (78 kB)
Collecting requests
  Using cached https://www.piwheels.org/simple/requests/requests-2.32.3-py3-none-any.whl (64 kB)
Collecting opencv-python
  Using cached opencv_python-4.10.0.84-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (41.7 MB)
Collecting defusedxml<0.8.0,>=0.7.1
  Using cached https://www.piwheels.org/simple/defusedxml/defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Collecting matplotlib>=3.6.0
  Using cached matplotlib-3.9.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.2 MB)
Collecting numpy>=1.21.2
  Using cached numpy-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.9 MB)
Collecting opencv-python-headless>=4.5.5.64
  Using cached opencv_python_headless-4.10.0.84-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (29.3 MB)
Collecting pillow>=9.4
  Using cached pillow-11.0.0-cp311-cp311-manylinux_2_28_aarch64.whl (4.2 MB)
Collecting pyyaml>=5.3
  Using cached PyYAML-6.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (736 kB)
Collecting scipy<2.0.0,>=1.10.0
  Using cached scipy-1.14.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (35.6 MB)
Collecting charset-normalizer<4,>=2
  Downloading charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (138 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 138.2/138.2 kB 1.4 MB/s eta 0:00:00
Collecting idna<4,>=2.5
  Downloading https://www.piwheels.org/simple/idna/idna-3.10-py3-none-any.whl (70 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 70.4/70.4 kB 701.0 kB/s eta 0:00:00
Collecting urllib3<3,>=1.21.1
  Downloading https://www.piwheels.org/simple/urllib3/urllib3-2.2.3-py3-none-any.whl (126 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 126.3/126.3 kB 1.2 MB/s eta 0:00:00
Collecting certifi>=2017.4.17
  Downloading https://www.piwheels.org/simple/certifi/certifi-2024.8.30-py3-none-any.whl (167 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 167.3/167.3 kB 237.6 kB/s eta 0:00:00
Collecting contourpy>=1.0.1
  Downloading contourpy-1.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (313 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 313.0/313.0 kB 1.6 MB/s eta 0:00:00
Collecting cycler>=0.10
  Downloading https://www.piwheels.org/simple/cycler/cycler-0.12.1-py3-none-any.whl (8.3 kB)
Collecting fonttools>=4.22.0
  Downloading fonttools-4.55.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.9/4.9 MB 1.7 MB/s eta 0:00:00
Collecting kiwisolver>=1.3.1
  Downloading kiwisolver-1.4.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 1.8 MB/s eta 0:00:00
Collecting packaging>=20.0
  Downloading https://www.piwheels.org/simple/packaging/packaging-24.2-py3-none-any.whl (65 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.5/65.5 kB 629.6 kB/s eta 0:00:00
Collecting pyparsing>=2.3.1
  Downloading https://www.piwheels.org/simple/pyparsing/pyparsing-3.2.0-py3-none-any.whl (106 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 106.9/106.9 kB 975.8 kB/s eta 0:00:00
Collecting python-dateutil>=2.7
  Downloading https://www.piwheels.org/simple/python-dateutil/python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 229.9/229.9 kB 821.2 kB/s eta 0:00:00
Collecting six>=1.5
  Downloading https://www.piwheels.org/simple/six/six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: urllib3, tqdm, six, pyyaml, pyparsing, pillow, packaging, numpy, loguru, kiwisolver, idna, fonttools, defusedxml, cycler, charset-normalizer, certifi, scipy, requests, python-dateutil, opencv-python-headless, opencv-python, contourpy, matplotlib, supervision
Successfully installed certifi-2024.8.30 charset-normalizer-3.4.0 contourpy-1.3.1 cycler-0.12.1 defusedxml-0.7.1 fonttools-4.55.0 idna-3.10 kiwisolver-1.4.7 loguru-0.7.2 matplotlib-3.9.2 numpy-2.1.3 opencv-python-4.10.0.84 opencv-python-headless-4.10.0.84 packaging-24.2 pillow-11.0.0 pyparsing-3.2.0 python-dateutil-2.9.0.post0 pyyaml-6.0.2 requests-2.32.3 scipy-1.14.1 six-1.16.0 supervision-0.19.0 tqdm-4.67.0 urllib3-2.2.3

@sebastianfis
Copy link
Author

For everyone who is also trying to run this on a RPi 5 and is stuck at the same point:

  1. You have to download and install hailort v 4.18 FIRST:
pip install ~/Downloads/hailort-4.18.0-cp311-cp311-linux_aarch64.whl
  1. Then remove bytetracker from the 1st line of requirements.txt (e.g. using nano). And install requirements via pip:
pip install -r requirements.txt 

This will result in a compatibility issue, as hailort==4.18 requires numpy==1.23.3, but requirements.txt does not define a certain numpy version, so the packages that require it will install the newest one:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
hailort 4.18.0 requires numpy==1.23.3, but you have numpy 2.1.3 which is incompatible.
  1. The min. Version of numpy for all other pacakges except hailort is numpy==1.23.5. Luckily the detection with tracker example also works with numpy==1.23.5, so you can just fix it with
pip install numpy==1.23.5

Alternatively, you can just add a line numpy==1.23.5 to requirements.txt in step 2 to force this version already during requirements installation.

Afterwards the example runs smoothly on my RPi5. Note that the HEF file included in the example might not work. I recommend using either yolov8m.hef or yolov10b.hef from the Hailo model zoo and run by using:

python detection_with_tracker.py -i input_video.mp4 -o output_video.mp4 -l coco.txt -s 0.5 -n ~/Downloads/yolov10b.hef

Happy coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants