Skip to content

Support for Python 3.12 #127

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

Closed
1 of 2 tasks
liopeer opened this issue Apr 8, 2025 · 6 comments
Closed
1 of 2 tasks

Support for Python 3.12 #127

liopeer opened this issue Apr 8, 2025 · 6 comments
Labels
bug Something isn't working

Comments

@liopeer
Copy link

liopeer commented Apr 8, 2025

Search before asking

  • I have searched the RF-DETR issues and found no similar bug report.

Bug

Hi,
I struggle to get rfdetr installed under Python 3.12, because of the onnxsim dependency. That package does not officially support Python 3.12 and they therefore does not ship any pre-built wheels for it & my cmake seems also not able to build the package (Ubuntu 22.04, cmake 3.22.1 and macOS Sequoia, cmake 4.0.0).

With it being annoying to install, it would be really nice to see one of the following solutions implemented:

  1. Provide installation instructions for newer Python versions (which cmake to use etc.).
  2. Distribute your own wheels for onnxsim and Python 3.12 (and eventually 3.13).
  3. (preferred) Make all onnx dependencies optional. Many people don't need the onnx export in every installation, i.e. if onnx support is desired, one could install rfdetr as pip install "rfdetr[onnxexport]"

Environment

  • OS: Ubuntu 22.04.05 LTS
  • cmake 3.22.1
  • Python 3.12

Minimal Reproducible Example

pip install rfdetr or pip install onnxsim

Additional

The issue of missing wheels is also mentioned here: daquexian/onnx-simplifier#334

Are you willing to submit a PR?

  • Yes, I'd like to help by submitting a PR!
@liopeer liopeer added the bug Something isn't working label Apr 8, 2025
@SkalskiP
Copy link
Collaborator

SkalskiP commented Apr 8, 2025

Hi @liopeer! 👋🏻 Thanks so much for your interest in RF-DETR. I ran into the same issues locally using Python 3.13. I agree—the third option seems like the cleanest solution to me as well.

@probicheaux @isaacrob-roboflow do we have a specific reason for including onnx, onnxsim, and onnx_graphsurgeon in the core dependencies for training and inference? If not, I’d suggest moving them to optional extras.

@yutong-xiang-97
Copy link

yutong-xiang-97 commented Apr 8, 2025

Same problem here as well! Doesn't work with Ubuntu24.04 + Python3.12.3 + cmake3.28.3

I second to @liopeer's suggestions to make all onnx dependencies optional. To be honest, the onnxruntime is not actually optional as stated in the pyproject.toml - it is required by onnxsim, otherwise I got the following errors:

Traceback (most recent call last):
  File "~/.venv-3.10/lib/python3.10/site-packages/onnxsim/onnx_simplifier.py", line 19, in <module>
    import onnxruntime as rt  # type: ignore
ModuleNotFoundError: No module named 'onnxruntime'

and also, as pointed out, onnx is not needed for every situtaion.

@SkalskiP
Copy link
Collaborator

SkalskiP commented Apr 8, 2025

Good point @yutong-xiang-97 !

@isaacrob-roboflow
Copy link
Collaborator

I am happy to see them moved to optional!

@SkalskiP
Copy link
Collaborator

SkalskiP commented Apr 8, 2025

@isaacrob-roboflow I'm working on PR now

@SkalskiP
Copy link
Collaborator

SkalskiP commented Apr 8, 2025

I've just merged the fix into the develop branch. This update isn't yet available as a PyPI package, but you can access it by installing directly from the source using the command: pip install git+https://github.com/roboflow/rf-detr.git. I'll close this issue for now. Please feel free to reopen it if you encounter any further problems.

@SkalskiP SkalskiP closed this as completed Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants