roboflow / notebooks

Examples and tutorials on using SOTA computer vision models and techniques. Learn everything from old-school ResNet, through YOLO and object-detection transformers like DETR, to the latest models like Grounding DINO and SAM.
https://roboflow.com/models
5.09k stars 788 forks source link

ERROR: Failed building wheel for onnx #80

Closed rodrigo-pedro closed 1 year ago

rodrigo-pedro commented 1 year ago

Search before asking

Notebook name

Track and Count Vehicles with YOLOv8 Notebook

Bug

The code block that installs Bytetrack throws an error:

Building wheels for collected packages: onnx, onnx-simplifier, lap, filterpy
  error: subprocess-exited-with-error

  × Building wheel for onnx (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  Building wheel for onnx (pyproject.toml) ... error
  ERROR: Failed building wheel for onnx
  Building wheel for onnx-simplifier (setup.py) ... done
  Created wheel for onnx-simplifier: filename=onnx_simplifier-0.3.5-py3-none-any.whl size=12877 sha256=998f36b8ec7c3e08b350b718e40975f291ff6e5fe7f79eb03f1e3aeaaf4bea22
  Stored in directory: /root/.cache/pip/wheels/84/cf/3e/05eb10ebcca1d2d42e43dcc10f9e1bc6fdae624a757f1f4019
  Building wheel for lap (setup.py) ... done
  Created wheel for lap: filename=lap-0.4.0-cp39-cp39-linux_x86_64.whl size=1655029 sha256=d64c1a692e5dd5d092f2691247e154ba4e7e7444394beb7eea541ba2223b0456
  Stored in directory: /root/.cache/pip/wheels/2f/8b/30/e7dd4f9dc44fb438381df571c9a6bddc35aafd1bf39c4f8911
  Building wheel for filterpy (setup.py) ... done
  Created wheel for filterpy: filename=filterpy-1.4.5-py3-none-any.whl size=110474 sha256=581d3e8b20c21a5873e80becbe752c4a52a0efa87cf11f7be66c7b83946244b6
  Stored in directory: /root/.cache/pip/wheels/53/e6/de/a09ea01e923aaf88b9f8c7c44329e857b2c1a31901167e55e6
Successfully built onnx-simplifier lap filterpy
Failed to build onnx
ERROR: Could not build wheels for onnx, which is required to install pyproject.toml-based projects

Environment

Minimal Reproducible Example

Run all code blocks. When the execution gets to "Installing Bytetrack", it throws an error and execution stops.

Additional

I managed to work around this issue by changing onnx version to 1.9.0 in the requirements.txt file in the Bytetrack directory.

[...]

# verified versions
onnx==1.9.0
onnxruntime==1.8.0
onnx-simplifier==0.3.5

Are you willing to submit a PR?

github-actions[bot] commented 1 year ago

👋 Hello @rodrigo-pedro, thank you for leaving an issue on Roboflow Notebooks.

🐞 Bug reports

If you are filing a bug report, please be as detailed as possible. This will help us more easily diagnose and resolve the problem you are facing. To learn more about contributing, check out our Contributing Guidelines.

If you require support with custom code that is not part of Roboflow Notebooks, please reach out on the Roboflow Forum or on the GitHub Discussions page associated with this repository.

💬 Get in touch

Do you have more questions about Roboflow that we haven't responded to yet? Feel free to ask them on the Roboflow Discuss forum. Our developer advocates and community team actively respond to questions there.

To ask questions about Notebooks, head over to the GitHub Discussions section of this repository.

litaldavar commented 1 year ago

I have the same problem; after a little digging, I found that ByteTrack is using ONNX, which was updated this Feb to a new version and now ByteTrack is thronging this error

SkalskiP commented 1 year ago

The most annoying thing is that we don't even need ONNX in our use case. Let me take a look at it.

SkalskiP commented 1 year ago

Hi, @rodrigo-pedro and @litaldavar 👋🏻!

I added the workaround you suggested to our notebook. Could you take a look if it works as expected?

rodrigo-pedro commented 1 year ago

@SkalskiP It works great now. It's not the most elegant solution, but it works well enough.

SkalskiP commented 1 year ago

Yup, I know... I was looking for something more elegant, but I could not find anything that would work (I only spent two hours researching that topic). For now I just want to make sure it won't stop others from exploring this notebook.

Ubeid02 commented 5 months ago

can bytetrack only be run on colab and notebook? because I try to install the bytetrack library there is always the same error message.

`Building wheels for collected packages: onnx Building wheel for onnx (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for onnx (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [123 lines of output] fatal: not a git repository (or any of the parent directories): .git C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\dist.py:476: SetuptoolsDeprecationWarning: Invalid dash-separated options !!

          ********************************************************************************
          Usage of dash-separated 'license-file' will not be supported in future
          versions. Please use the underscore name 'license_file' instead.

          By 2024-Sep-26, you need to update your project and remove deprecated calls
          or your builds will no longer be supported.

          See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
          ********************************************************************************

  !!
    opt = self.warn_dash_deprecation(opt, section)
  running bdist_wheel
  running build
  running build_py
  running create_version
  running cmake_build
  -- Building for: Visual Studio 17 2022
  CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.

  -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
  -- The C compiler identification is MSVC 19.39.33523.0
  -- The CXX compiler identification is MSVC 19.39.33523.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  CMake Warning (dev) at CMakeLists.txt:83 (find_package):
    Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
    are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
    the cmake_policy command to set the policy and suppress this warning.

  This warning is for project developers.  Use -Wno-dev to suppress it.

  -- Found PythonInterp: D:/pkm24/counter_vehicle/cV/Scripts/python.exe (found suitable version "3.9.1", minimum required is "3.9")
  CMake Warning (dev) at CMakeLists.txt:84 (find_package):
    Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
    are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
    the cmake_policy command to set the policy and suppress this warning.

  This warning is for project developers.  Use -Wno-dev to suppress it.

  -- Found PythonLibs: C:/Users/subha/AppData/Local/Programs/Python/Python39/libs/python39.lib (found suitable version "3.9.1", minimum required is "3.9")
  CMake Error at C:/Program Files/CMake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
    Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR)
  Call Stack (most recent call first):
    C:/Program Files/CMake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
    C:/Program Files/CMake/share/cmake-3.29/Modules/FindProtobuf.cmake:749 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
    CMakeLists.txt:141 (find_package)

  -- Configuring incomplete, errors occurred!
  Traceback (most recent call last):
    File "d:\pkm24\counter_vehicle\cv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "d:\pkm24\counter_vehicle\cv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "d:\pkm24\counter_vehicle\cv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\build_meta.py", line 410, in build_wheel
      return self._build_with_temp_dir(
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\build_meta.py", line 395, in _build_with_temp_dir
      self.run_setup()
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
      super().run_setup(setup_script=setup_script)
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 321, in <module>
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\__init__.py", line 104, in setup
      return distutils.core.setup(**attrs)
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
      return run_commands(dist)
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
      dist.run_commands()
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\dist.py", line 967, in run_command
      super().run_command(command)
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 368, in run
      self.run_command("build")
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\dist.py", line 967, in run_command
      super().run_command(command)
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
      self.run_command(cmd_name)
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\dist.py", line 967, in run_command
      super().run_command(command)
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "<string>", line 217, in run
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\dist.py", line 967, in run_command
      super().run_command(command)
    File "C:\Users\subha\AppData\Local\Temp\pip-build-env-am68g2bs\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "<string>", line 203, in run
    File "C:\Users\subha\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 373, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['C:\\Program Files\\CMake\\bin\\cmake.exe', '-DPYTHON_INCLUDE_DIR=C:\\Users\\subha\\AppData\\Local\\Programs\\Python\\Python39\\include', '-DPYTHON_EXECUTABLE=d:\\pkm24\\counter_vehicle\\cv\\scripts\\python.exe', '-DBUILD_ONNX_PYTHON=ON', '-DCMAKE_EXPORT_COMPILE_COMMANDS=ON', '-DONNX_NAMESPACE=onnx', '-DPY_EXT_SUFFIX=.cp39-win_amd64.pyd', '-DCMAKE_BUILD_TYPE=Release', '-DPY_VERSION=3.9', '-DONNX_USE_MSVC_STATIC_RUNTIME=ON', '-A', 'x64', '-T', 'host=x64', '-DONNX_ML=1', 'C:\\Users\\subha\\AppData\\Local\\Temp\\pip-install-xbadmqa_\\onnx_d34490b3b1114f64a504798f1b90a06a']' returned non-zero exit status 1.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for onnx Failed to build onnx ERROR: Could not build wheels for onnx, which is required to install pyproject.toml-based projects`

SkalskiP commented 5 months ago

Hi @Ubeid02 👋🏻 I'm not sure if we will be able to fix this issue. However, we created a refreshed version of this notebook using new supervision capabilities: https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-track-and-count-vehicles-with-yolov8-and-supervison.ipynb that should work without any problem.