PyTensor fails to compile model after upgrading to mac OS 15.4

I just upgraded my macbook and hit these problems. Just changing the clang path was not sufficient to get things back up and running. Here is a record of all the steps I took to get back to work. I have no idea which are necessary.

  1. Reinstall xcode commandline tools
sudo rm -rf /Library/Developer/CommandLineTools/
xcode-select --install
  1. Clear old SDKs
    ls /Library/Developer/CommandLineTools/SDKs showed a bunch of flotsam and jetsam. The only SDK that is needed is the latest one, MacOSX15.4.sdk. I did rm -rf on all the others.

At this point, which clang++ correctly showed /usr/bin/clang++, so the change to .pytensorrc was not necessary.

Other diagnostics that seem important are:

  • xcrun --show-sdk-path should show /Library/Developer/CommandLineTools/SDKs/MacOSX15.4.sdk
  • xcode-select -p should show `/Library/Developer/CommandLineTools

Back to pytensor steps:

  1. Nuke and reinstall all environments
    I also hit some errors with pandas and numpy, so this was necessary.

  2. Purge pytensor cache
    From an active environment with pytensor installed, do:

pytensor-cache purge
  1. Uninstall other clang tools installed by conda
    When conda installed pytensor, it also brought along a bunch of clang compilers. I removed all of these with:
conda list clang

# Name                    Version                   Build  Channel
clang                     18.1.8          default_h474c9e2_9    conda-forge
clang-18                  18.1.8          default_hf90f093_9    conda-forge
clang_impl_osx-arm64      18.1.8              h2ae9ea5_24    conda-forge
clang_osx-arm64           18.1.8              h07b0088_24    conda-forge
clangxx                   18.1.8          default_h1ffe849_9    conda-forge
clangxx_impl_osx-arm64    18.1.8              h555f467_24    conda-forge
clangxx_osx-arm64         18.1.8              h07b0088_24    conda-forge
libclang-cpp18.1          18.1.8          default_hf90f093_9    conda-forge
conda remove clang clang-18 clang_impl_osx-arm64 clang_osx-arm64 clangxx clangxx_impl_osx-arm64 clangxx_osx-arm64 libclang-cpp18.1 --force

After this, things were working again.

3 Likes