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

[Feature Request] Python 3.12 support #17842

Closed
Tracked by #190
tonybaloney opened this issue Oct 9, 2023 · 11 comments
Closed
Tracked by #190

[Feature Request] Python 3.12 support #17842

tonybaloney opened this issue Oct 9, 2023 · 11 comments
Labels
feature request request for unsupported feature or enhancement

Comments

@tonybaloney
Copy link

Describe the feature request

this package cannot be installed using Python 3.12 and is only publishing wheels, so cannot be compiled from source/

Describe scenario use case

Please publish Python 3.12 wheels

@tonybaloney tonybaloney added the feature request request for unsupported feature or enhancement label Oct 9, 2023
@tonybaloney
Copy link
Author

Side note, if the maintainers haven't already checked out cibuildwheel, I think this project could use it and remove a lot of the scripts that have been written to accomplish the same thing (building lots of wheels and doing manylinux linking from a CMake project) https://github.com/pypa/cibuildwheel

@snnn
Copy link
Member

snnn commented Oct 9, 2023

Yeah, it is a great choice. onnxruntime-extensions packages are built with that tool.

I tried to enable it for this repo too:
a0af414

However, I didn't have enough time to finish the work. We need to let setup.py invoking tools/ci_build/build.py, not the reverse. And once we have that, we could also easily publish a sdist.

However, cibuildwheel tool has cons too. It needs to download a lot of things from the public internet. So I have reliability and security concerns on that.

@timbodeit
Copy link

[...] so cannot be compiled from source

Until ORT 1.17 is released, you can compile from source by following the build instructions.

To build for my arm-based Mac, I added a --build_wheel argument to the ./build.sh call, to build python wheels directly.
Afterwards you can find the .whl file under build/[...]/dist/.

Commands I used inside my 3.12 conda env on M3 Pro Mac:

./build.sh --config Release --build_shared_lib --parallel --enable_pybind --skip_tests --build_wheel  --update --build --cmake_extra_defines CMAKE_OSX_ARCHITECTURES=arm64
pip3 install --upgrade /Users/tim.bodeit/repos/onnxruntime/build/MacOS/Release/dist/onnxruntime-1.17.0-cp312-cp312-macosx_14_0_arm64.whl

@manuelseeger
Copy link

manuelseeger commented Jan 2, 2024

Thanks @timbodeit. Took me a while to get the build environment working under windows and had to build with --skip_tests (like you did) but in the end I could build 1.17 wheels.

I had to add the windows 10 SDK to the VS 2022 build tools. The build was still looking for the wrong version in C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC which I "solved" by copying the version I had to the one build was looking for.

@omasoud
Copy link

omasoud commented Jan 21, 2024

I tried to build for windows but it was building only onnxruntime-1.17.0-cp312-cp312-win32.whl until I added call "%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" amd64 just before the python call in build.bat. Then it generated onnxruntime-1.17.0-cp312-cp312-win_amd64.whl

@omasoud omasoud mentioned this issue Jan 21, 2024
@snnn
Copy link
Member

snnn commented Jan 22, 2024

I tried to build for windows but it was building only onnxruntime-1.17.0-cp312-cp312-win32.whl until I added call "%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" amd64 just before the python call in build.bat. Then it generated onnxruntime-1.17.0-cp312-cp312-win_amd64.whl

You might have two Pythons in your system. If you run the build with a 32-bit python, you will have a 32-bit wheel. If you run the build with a 64-bit python, you will have a 64-bit wheel.

@omasoud
Copy link

omasoud commented Jan 23, 2024

I only have one 64-bit python in my path (the Microsoft app one, which states "Architecture: x64")

vcvarsall.bat amd64 performs a lot of environment setup, some of which probably did the trick. Here's a diff of environment variable changes that occur after running it:
image

@ConnorBP
Copy link

[...] so cannot be compiled from source

Until ORT 1.17 is released, you can compile from source by following the build instructions.

To build for my arm-based Mac, I added a --build_wheel argument to the ./build.sh call, to build python wheels directly. Afterwards you can find the .whl file under build/[...]/dist/.

Commands I used inside my 3.12 conda env on M3 Pro Mac:

./build.sh --config Release --build_shared_lib --parallel --enable_pybind --skip_tests --build_wheel  --update --build --cmake_extra_defines CMAKE_OSX_ARCHITECTURES=arm64
pip3 install --upgrade /Users/tim.bodeit/repos/onnxruntime/build/MacOS/Release/dist/onnxruntime-1.17.0-cp312-cp312-macosx_14_0_arm64.whl

Is there a way of building onnxruntime-gpu with this? I cannot find any reference to this in the build docs

@snnn
Copy link
Member

snnn commented Jan 31, 2024

No. MacOS doesn't support CUDA.

@ConnorBP
Copy link

No. MacOS doesn't support CUDA.

I am building for windows

@snnn
Copy link
Member

snnn commented Feb 9, 2024

ONNX Runtime 1.17.0 is released with this new feature.

@snnn snnn closed this as completed Feb 12, 2024
atroyn added a commit to chroma-core/chroma that referenced this issue Feb 21, 2024
## Description of changes

Chroma did not support Python 3.12 because of our dependency on the ONNX
runtime for our default embedding function. As of version 1.17.0, ONNX
supports python 3.12:
microsoft/onnxruntime#17842 (comment)

This already automatically fixes the issue for Chroma users when they
install the new version of ONNX / reinstall Chroma. This PR is just to
update our test and release actions to also use python 3.12.

## Test plan

These are changes to test workers. 

## Documentation Changes
N/A
atroyn added a commit to csbasil/chroma that referenced this issue Apr 3, 2024
## Description of changes

Chroma did not support Python 3.12 because of our dependency on the ONNX
runtime for our default embedding function. As of version 1.17.0, ONNX
supports python 3.12:
microsoft/onnxruntime#17842 (comment)

This already automatically fixes the issue for Chroma users when they
install the new version of ONNX / reinstall Chroma. This PR is just to
update our test and release actions to also use python 3.12.

## Test plan

These are changes to test workers. 

## Documentation Changes
N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request request for unsupported feature or enhancement
Projects
None yet
Development

No branches or pull requests

6 participants