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

Build script cannot detect a suitable python version #3803

Closed
UsdPadawan opened this issue Jun 4, 2024 · 12 comments
Closed

Build script cannot detect a suitable python version #3803

UsdPadawan opened this issue Jun 4, 2024 · 12 comments
Labels
help wanted Extra attention is needed

Comments

@UsdPadawan
Copy link

After trying to build with multiple arguments but build.py always fails with
Could NOT find Python3: Found unsuitable version "3.11", but required is exact version "3.11.2" (found C:\Python311\libs\python311.lib)
I have installed exactly version 3.11.2 and not 3.11.
The last command I have tried with is
python build.py --devkit-location "C:\extdevkit\Autodesk_Maya_2024_2_Update_DEVKIT_Windows\devkitBase" --maya-location "C:\Program Files\Autodesk\Maya2024" --no-materialx --pxrusd-location C:\extbuild\Usd_Build --generator "Visual Studio 16 2019" "C:/extbuild/MayaUsd_Build"

  • Windows 10
  • Visual Studio 2019 Developer Command Prompt v16.11.31
  • Maya 2024
  • Maya USD v0.27.0
  • Pixar USD v23.11
  • CMake version 3.16.9

I have also installed python 2.7.15 which is needed for the build as well.
I have tried with BUILD_WITH_PYTHON_3=ON and the needed python version according to the docs.

build_log.txt

installed_pythons

@UsdPadawan UsdPadawan added the help wanted Extra attention is needed label Jun 4, 2024
@seando-adsk
Copy link
Collaborator

Two things to note here:

  1. The python that you call build.py with is used to execute the build script. This can be a python 2 or 3.
  2. The python that is used to build the python bindings. This python version must match the python version of the Maya you are targeting. In your case Maya 2024 which uses python 3.10.

The best way is to tell the build.py script exactly which python to use by using the --build-args flag, something like this:
--build-args=-DPYTHON_INCLUDE_DIR=<maya_2024>/include/Python310/Python,-DPython_EXECUTABLE=<maya_2024>/bin/mayapy.exe,-DPYTHON_LIBRARIES=<maya_2024>/lib/python310.lib,-DBUILD_WITH_PYTHON_3=ON,-DBUILD_WITH_PYTHON_3_VERSION=3.10
where you replace <maya_2024> with the path to your Maya 2024, so probably C:\Program Files\Autodesk\Maya2024

See the help page build.md which has a table that shows the various dependencies (such as python).

Sean

@UsdPadawan
Copy link
Author

UsdPadawan commented Jun 4, 2024

Thank you for your quick response.

After adding the build-args parameter to build.py as you advised I get

CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find Python (missing: Interpreter) (Required is exact version
  "3.10.0")

build_log.txt

@seando-adsk
Copy link
Collaborator

Sorry I think I might have forgotten the " around the -build-args, try

--build-args="-DPYTHON_INCLUDE_DIR=<maya_2024>/include/Python310/Python,-DPython_EXECUTABLE=<maya_2024>/bin/mayapy.exe,-DPYTHON_LIBRARIES=<maya_2024>/lib/python310.lib,-DBUILD_WITH_PYTHON_3=ON,-DBUILD_WITH_PYTHON_3_VERSION=3.10"

You can see the problem by looking at the output of build_log.txt. You'll see -DPython_EXECUTABLE=C:/Program Files/Autodesk/Maya2024/bin/mayapy.exe - notice the space in the path. These paths needs to be surrounded by quotes.

Sean

@UsdPadawan
Copy link
Author

I had placed "" around build-args but still got the same error.

Now I have replaced the paths with paths of a shortcut that has not spaces. Still the same error. Strange. Sorry if I am missing something.

I have also tried with 3.10.0 instead of 3.10.

@seando-adsk
Copy link
Collaborator

Could you send your build.py line and the latest build_log again?

Thanks,
Sean

@UsdPadawan
Copy link
Author

I have tried with many variations of arguments for the build.py but let's say this is the final one.

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
cd c:\extbuild\maya-usd
python build.py --devkit-location "C:\otzad_nagore\Autodesk_Maya_2024_2_Update_DEVKIT_Windows\devkitBase" --maya-location "C:\Program Files\Autodesk\Maya2024" --no-materialx --pxrusd-location C:\extbuild\Usd_Build --generator "Visual Studio 16 2019" --build-args="-DPYTHON_INCLUDE_DIR=C:/Users/Delian/Desktop/temp/Python,-DPython_EXECUTABLE=C:/Users/Delian/Desktop/temp/mayapy.exe,-DPYTHON_LIBRARIES=C:/Users/Delian/Desktop/temp/python310.lib,-DBUILD_WITH_PYTHON_3=ON,-DBUILD_WITH_PYTHON_3_VERSION=3.10" "C:/extbuild/MayaUsd_Build" 

Where
C:/Users/Delian/Desktop/temp/Python is a shortcut to "C:\Program Files\Autodesk\Maya2024\include\Python310\Python"
C:/Users/Delian/Desktop/temp/mayapy.exe is a shortcut to "C:\Program Files\Autodesk\Maya2024\bin\mayapy.exe"
C:/Users/Delian/Desktop/temp/python310.lib is a shortcut to "C:\Program Files\Autodesk\Maya2024\lib\python310.lib"
I have replaced the actual paths with their shortcuts to remove any possible errors due to spaces in them.
build_log_1.txt

I have also tried with the paths themselves.

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
cd c:\extbuild\maya-usd
python build.py --devkit-location "C:\otzad_nagore\Autodesk_Maya_2024_2_Update_DEVKIT_Windows\devkitBase" --maya-location "C:\Program Files\Autodesk\Maya2024" --no-materialx --pxrusd-location C:\extbuild\Usd_Build --generator "Visual Studio 16 2019" --build-args="-DPYTHON_INCLUDE_DIR=C:/Program Files/Autodesk/Maya2024/include/Python310/Python,-DPython_EXECUTABLE=C:/Program Files/Autodesk/Maya2024/bin/mayapy.exe,-DPYTHON_LIBRARIES=C:/Program Files/Autodesk/Maya2024/lib/python310.lib,-DBUILD_WITH_PYTHON_3=ON,-DBUILD_WITH_PYTHON_3_VERSION=3.10.0" "C:/extbuild/MayaUsd_Build"

build_log_2.txt

Thank you for your attention so far.

@seando-adsk
Copy link
Collaborator

Okay I think I've found the problem. I tested this locally and both solutions worked for me. The problem is the spaces in those paths. Even with the shortcut the real path still has a space. There are two solutions:

  1. escape the spaces with \

python build.py --devkit-location "C:\otzad_nagore\Autodesk_Maya_2024_2_Update_DEVKIT_Windows\devkitBase" --maya-location "C:\Program Files\Autodesk\Maya2024" --no-materialx --pxrusd-location C:\extbuild\Usd_Build --generator "Visual Studio 16 2019" --build-args="-DPYTHON_INCLUDE_DIR=C:/Program\ Files/Autodesk/Maya2024/include/Python310/Python,-DPython_EXECUTABLE=C:/Program\ Files/Autodesk/Maya2024/bin/mayapy.exe,-DPYTHON_LIBRARIES=C:/Program\ Files/Autodesk/Maya2024/lib/python310.lib,-DBUILD_WITH_PYTHON_3=ON,-DBUILD_WITH_PYTHON_3_VERSION=3.10" "C:/extbuild/MayaUsd_Build"

  1. Adding escaped quotes \" around each path:

python build.py --devkit-location "C:\otzad_nagore\Autodesk_Maya_2024_2_Update_DEVKIT_Windows\devkitBase" --maya-location "C:\Program Files\Autodesk\Maya2024" --no-materialx --pxrusd-location C:\extbuild\Usd_Build --generator "Visual Studio 16 2019" --build-args="-DPYTHON_INCLUDE_DIR=\"C:/Program Files/Autodesk/Maya2024/include/Python310/Python\",-DPython_EXECUTABLE=\"C:/Program Files/Autodesk/Maya2024/bin/mayapy.exe\",-DPYTHON_LIBRARIES=\"C:/Program Files/Autodesk/Maya2024/lib/python310.lib\",-DBUILD_WITH_PYTHON_3=ON,-DBUILD_WITH_PYTHON_3_VERSION=3.10.0" "C:/extbuild/MayaUsd_Build"

Sean

@UsdPadawan
Copy link
Author

That fixed it! Thank you a lot, Sean.

But I now face the following error

CMake Error at cmake/jinja.cmake:27 (message):
  MARKUPSAFE_LOCATION not set
Call Stack (most recent call first):
  cmake/jinja.cmake:55 (init_markupsafe)
  CMakeLists.txt:118 (include)

I have read this issue
I have only one python version installed - 3.10.
After running
c:\extbuild\maya-usd>pip freeze
I get the following

Jinja2==3.1.4
MarkupSafe==2.1.5
PyOpenGL==3.1.7
PySide2==5.15.2.1
PySide6==6.7.1
PySide6_Addons==6.7.1
PySide6_Essentials==6.7.1
PyYAML==6.0.1
shiboken2==5.15.2.1
shiboken6==6.7.1

Can you please help me with this one as well?

Regards, Delian

@seando-adsk
Copy link
Collaborator

Glad to hear the python problem is fixed.

Jinja and Markupsafe are required when building the schemas. Since you are passing in the maya python to use, it is there that you need to install these two modules. Open a windows command prompt and navigate to your Maya 2024 folder. Then run:

mayapy -m pip install MarkupSafe==1.1.1
mayapy -m pip install Jinja2==2.11.1

This will install those specific versions. I believe you can use newer, but internally I know these are the versions we use.

Sean

@UsdPadawan
Copy link
Author

Thank you so much for helping with this too!
But now a third problem arises...

CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:141 (set):
  Syntax error in cmake code at

    C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:141

  when parsing string

    Could NOT find Python3: Found unsuitable version "3.11", but required is exact version "3.11.2" (found C:\Python311\libs\python311.lib)

build_log.txt

I have installed Python 3.11.2 but with no change in build process.
image

Regards, Delian

@seando-adsk
Copy link
Collaborator

It looks like you built your own USD. That USD build also needs to use the python from maya (for bindings and schema) since you are using it for MayaUsd. You need to tell the USD build which python to use (mayapy) by using the build.py flag --build-python-info

  --build-python-info PYTHON_EXECUTABLE PYTHON_INCLUDE_DIR PYTHON_LIBRARY PYTHON_VERSION
                        Specify a custom python to use during build

Sean

@UsdPadawan
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants