Has anyone had luck getting USD to compile AND work with M1/arm64 native python?

I've been trying to build and use the USD command line toolchain pieces from source on an M1/arm64 Mac - and while I've gotten it to compile, I get a crash as python attempts to load up the USD internals:

    ------------------------------ python terminated -------------------------------
    python crashed. FATAL ERROR: Failed axiom: ' Py_IsInitialized() '
    in operator() at line 148 of /Users/heckj/src/USD/pxr/base/tf/pyTracing.cpp
    writing crash report to [ Sparrow.local:/var/folders/8t/k6nw7pyx2qq77g8qq_g429080000gn/T//st_python.79467 ] ... done.
    --------------------------------------------------------------------------------

I found a number of issues at Github, which hints that this is a potentially known and ongoing problem:

With some suggestions, but no clear resolutions.

I tried the build commands that are referenced in the release details for USDPython as available on developer downloads, and fiddling it a bit got it to compile:

python build_scripts/build_usd.py \
    --build-args TBB,arch=arm64 \
    --python --no-imaging --no-usdview \
    --prefer-safety-over-speed \
    --build-monolithic /opt/local/USD

But I'm repeatedly hitting the crash where python isn't initializing. I've tried Python 3 from home-brew, an Anaconda version of python (intel through Rosetta), the basing it on the python included with Xcode (universal binary), and the most recent trial was with miniforge3 arm-native python that's recommended from the Metal for Tensorflow marketing page.

WIth the warnings about Python disappearing from the default install, I'd like to get a mechanism in place that I'm comfortable with to get an install of USDtools, and ideally that are native to the M1 processor.

Accepted Reply

Version 22.08 of the USD tools dropped with explicit native M1 support, although there's some quirks IF you're installing it over a version of python that was set up and installed using Conda.

I wrote a blog post with the details at https://rhonabwy.com/2022/08/16/native-support-for-usd-tools-on-an-m1-mac/, but the core of the issue is that an additional build argument is needed: PXR_PY_UNDEFINED_DYNAMIC_LOOKUP=ON which you can pass through their build tooling:

python build_scripts/build_usd.py /opt/local/USD --build-args USD,"-DPXR_PY_UNDEFINED_DYNAMIC_LOOKUP=ON"

The details, and very helpful explanation for why this is required, is covered in the USD GitHub issue https://github.com/PixarAnimationStudios/USD/issues/1996

Replies

Version 22.08 of the USD tools dropped with explicit native M1 support, although there's some quirks IF you're installing it over a version of python that was set up and installed using Conda.

I wrote a blog post with the details at https://rhonabwy.com/2022/08/16/native-support-for-usd-tools-on-an-m1-mac/, but the core of the issue is that an additional build argument is needed: PXR_PY_UNDEFINED_DYNAMIC_LOOKUP=ON which you can pass through their build tooling:

python build_scripts/build_usd.py /opt/local/USD --build-args USD,"-DPXR_PY_UNDEFINED_DYNAMIC_LOOKUP=ON"

The details, and very helpful explanation for why this is required, is covered in the USD GitHub issue https://github.com/PixarAnimationStudios/USD/issues/1996