microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
13.91k stars 2.81k forks source link

[Build] #16283

Closed ghost closed 1 year ago

ghost commented 1 year ago

Describe the issue

I am building ONNX Runtime for DirectML EP I am using this command: build.bat --config RelWithDebInfo --build_shared_lib --parallel --cmake_generator "Visual Studio 17 2022" --use_dml --build_wheel --skip_tests --cmake_extra_defines CMAKE_OSX_ARCHITECTURES=x86_64

my python is 64 bits my Windows OS is 64 bits

the generated wheel is named onnxruntime_directml-1.16.0-cp310-cp310-win32.whl and I get this error when I pip install it:

>pip install C:\data\lavoro\MachineLearning\onnx\test2\onnxruntime\build\Windows\RelWithDebInfo\RelWithDebInfo\dist\onnxruntime_directml-1.16.0-cp310-cp310-win32.whl ERROR: onnxruntime_directml-1.16.0-cp310-cp310-win32.whl is not a supported wheel on this platform.

also tried with the following option --cmake_extra_defines CMAKE_OSX_ARCHITECTURES=x86_64 but nothing changes

Urgency

yes unfortunately this is urgent

Target platform

Windows 64 bits, Python 3.10 64 bits

Build script

build.bat --config RelWithDebInfo --build_shared_lib --parallel --cmake_generator "Visual Studio 17 2022" --use_dml --build_wheel --skip_tests --cmake_extra_defines CMAKE_OSX_ARCHITECTURES=x86_64

Error / output

ERROR: onnxruntime_directml-1.16.0-cp310-cp310-win32.whl is not a supported wheel on this platform.

Visual Studio Version

Visual Studio 17 2022

GCC / Compiler Version

No response

snnn commented 1 year ago

CMAKE_OSX_ARCHITECTURES is for macOS/iOS/tvOS/... . Do not use it on other platforms. See https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_ARCHITECTURES.html

snnn commented 1 year ago

If you want a 32-bit Win32 build, please make sure you have installed a 32-bit python and it is the only python in PATH.

ghost commented 1 year ago

Hi, I want the build for win 64 bits. But the generated wheel is for win32 How to make a wheel for win 64? This is the command I have run: build.bat --config RelWithDebInfo --build_shared_lib --parallel --cmake_generator "Visual Studio 17 2022" --use_dml --build_wheel --skip_tests

Il giorno 8 giu 2023, alle ore 18:48, Changming Sun @.***> ha scritto:

 Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

If you want a 32-bit Win32 build, please make sure you have installed a 32-bit python and it is the only python in PATH.

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/onnxruntime/issues/16283#issuecomment-1583018965, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYTFUHTBKGXDVCH4PW67VHTXKH67DANCNFSM6AAAAAAY642D5E. You are receiving this because you authored the thread.Message ID: @.***>

ghost commented 1 year ago

Hi, it is not answered

Il giorno 8 giu 2023, alle ore 18:48, Changming Sun @.***> ha scritto:

 Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Closed #16283https://github.com/microsoft/onnxruntime/issues/16283 as completed.

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/onnxruntime/issues/16283#event-9474939879, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYTFUHS3LTUXY22ANAMK373XKH63XANCNFSM6AAAAAAY642D5E. You are receiving this because you authored the thread.Message ID: @.***>

snnn commented 1 year ago

If you want a 64-bit Windows build, please make sure you have installed a 64-bit python and it is the only python in PATH.

ghost commented 1 year ago

Hi, I have also tried without this option but the result is the same. Please have you tried to reproduce the issue? Thanks Giovanni

Il giorno 8 giu 2023, alle ore 18:48, Changming Sun @.***> ha scritto:

 Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

CMAKE_OSX_ARCHITECTURES is for macOS/iOS/tvOS/... . Do not use it on other platforms. See https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_ARCHITECTURES.html

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/onnxruntime/issues/16283#issuecomment-1583017970, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYTFUHSEGAHVRWGVLSSPYETXKH63VANCNFSM6AAAAAAY642D5E. You are receiving this because you authored the thread.Message ID: @.***>

ghost commented 1 year ago

Yes, I have python 64 bits and windows 64 bits. I will check if any other python is in the path. This is a good hint. Thanks

Il giorno 8 giu 2023, alle ore 20:09, Changming Sun @.***> ha scritto:

 Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

If you want a 64-bit Windows build, please make sure you have installed a 64-bit python and it is the only python in PATH.

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/onnxruntime/issues/16283#issuecomment-1583114905, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYTFUHUUM5M2UMZP3REPZMDXKIINHANCNFSM6AAAAAAY642D5E. You are receiving this because you authored the thread.Message ID: @.***>

ghost commented 1 year ago

Hi @snnn I have double checked: this is the only python in PATH: and in anaconda I only have 64 bits python: (base) C:\Users\gguasti>python Python 3.10.9 | packaged by Anaconda, Inc. | (main, Mar 1 2023, 18:18:15) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import struct print(struct.calcsize("P") * 8) 64

(base) C:\Users\gguasti>wmic os get osarchitecture OSArchitecture 64-bit

but when I build using the command build.bat --config RelWithDebInfo --build_shared_lib --parallel --cmake_generator "Visual Studio 17 2022" --use_dml --build_wheel --skip_tests

the generated wheel is named onnxruntime_directml-1.16.0-cp310-cp310-win32.whl

and if I try to install it using pip I get the error message ERROR: onnxruntime_directml-1.16.0-cp310-cp310-win32.whl is not a supported wheel on this platform.

I suspect there is a bug. Have you tried to reproduce the issue? how to force the build of a win64 wheel? thanks

omasoud commented 7 months ago

This worked for me.

lishixlnx commented 3 months ago

omasoud's comment is the only correct answer;

To make it easy, I just test : setting below 3 variable in shell window will stop the "win32.whl" producing and let "win64.whl" producing.

set Platform=x64 set VSCMD_ARG_HOST_ARCH=x64 set VSCMD_ARG_TGT_ARCH=x64