Open twiecki opened 2 months ago
For some reason it was using clang++
from a different conda environment. Setting it manually fixed the issue. But not sure why it's not selecting clang++ from the currently active env.
For me it was selecting clang++ from the environment, but what got me going again was moving that out of the way so it got the version from /usr/bin, i.e. the one from Xcode dev tools, as suggested here: https://discourse.pymc.io/t/pytensor-compilation-error/11047/13
CC @lucianopaz
This makes very little sense. To set cxx to "clang++"
, pytensor simply tries to run clang++ -v
on a subprocess. If it succeeds, then cxx is set to "clang++"
, if it fails, it tries to call shutil.which("clang++")
which should set the full path to the clang++ that has highest precedence in the environments path search order. The only reason you might get a clang++
that is not part of your active env, is that something went wrong with the environment activation and it didn't set the proper values to some environment variables.
On the other hand, what @tigretigre is pointing at is different. He says that he had to use the system's clang instead of the one that came with the conda, mamba or anaconda environment. That usually happens when a mamba env clang that was installed under one OS version is migrated into a newer OS version. Sometimes, some of the header files have #include <stdlib.h>
or #include <unistd.h>
. These precompiler directives attempt to include headers that should be in the compiler's default include path. Sometimes, these get messed up or vary slightly with OS updates. Sometimes, these problems go away if you uninstall and then reinstall conda/mamba/etc. I've seen reports of people saying that reinstalling the environment alone didn't help, but reinstalling conda did. I don't know why, to be honest.
The last part is that these problems usually seem to pop out in VSCode. I have absolutely no idea why that happens, and what VSCode does with the env activation that can lead to so much trouble down the line. My last suggestion is that if you're seeing this problem in VSCode, first try to check if the problem is also present in a regular shell or jupyter kernel.
I have absolutely no idea why that happens, and what VSCode does with the env activation that can lead to so much trouble down the line.
I have a suspicion. In order for a Conda environment to be properly activated, there are scripts in $CONDA_PREFIX/etc/conda/activate.d/
that must be executed. Often laziness gets in the way, a few directories are added to $PATH
, and then whatever tool calls it good.
This is not so easy to diagnose, since if you run
!source "$CONDA_PREFIX"/etc/conda/activate.d/*.sh
in Jupyter this launches in a subshell where all the changes to your environment will be forgotten after the subshell is terminated.
But it would be interesting to check this directory for anything related to clang.
Describe the issue:
On current PyMC (5.16.2) and PyTensor (2.25.4) on OSX 15.0 Beta (24A5327a) all compilation fails. This was also reported in https://discourse.pymc.io/t/environment-not-working-anymore-on-macos/14210.
Reproducable code example:
Error message:
PyTensor version information:
Context for the issue:
No response