Pm.sample fails with multiple errors on Mac M2

When running pm.sample() on my MacBook Air M2, I get the error as in the screenshot (also WARNING at the beginning):

I installed pymc using mamba with an environment.yml file.

Running “mamba list” shows me this:

Anyone know how to fix this problem?


In general, it is advisable to install PyMC using the official procedure described here. That being said, @aloctavodia may have a different recommendation to get that specific set of packages installed on your machine.

The warning you are getting upon import of PyMC suggests that the relevant C toolchain is not being install correctly and should be fixed before trying to do much of anything.

Namely installing a more recent version of pymc/pymc-bart/PyTensor may automatically solve all the problems

Following the official procedure wth adding “-c nodefaults” and setting “pymc=3.10.0”, I created a fresh environment. However, I still get the pytensor.tensor.blas WARNING as well as CompileError.

mamba list now looks like this:

# Name                    Version                   Build  Channel
accelerate                0.29.2             pyhd8ed1ab_0    conda-forge
arviz                     0.18.0             pyhd8ed1ab_0    conda-forge
atk-1.0                   2.38.0               hcb7b3dd_1    conda-forge
blas                      2.122                  openblas    conda-forge
blas-devel                3.9.0           22_osxarm64_openblas    conda-forge
brotli                    1.1.0                hb547adb_1    conda-forge
brotli-bin                1.1.0                hb547adb_1    conda-forge
brotli-python             1.1.0           py311ha891d26_1    conda-forge
bzip2                     1.0.8                h93a5062_5    conda-forge
c-ares                    1.28.1               h93a5062_0    conda-forge
ca-certificates           2024.3.11            hca03da5_0  
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
cachetools                5.3.3              pyhd8ed1ab_0    conda-forge
cairo                     1.18.0               hd1e100b_0    conda-forge
cctools_osx-arm64         986                  h62378fb_0    conda-forge
certifi                   2024.2.2           pyhd8ed1ab_0    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
clang                     16.0.6               h30cc82d_6    conda-forge
clang-16                  16.0.6          default_he012953_6    conda-forge
clang_impl_osx-arm64      16.0.6              hc421ffc_11    conda-forge
clang_osx-arm64           16.0.6              h54d7cd3_11    conda-forge
clangxx                   16.0.6          default_h4cf2255_6    conda-forge
clangxx_impl_osx-arm64    16.0.6              hcd7bac0_11    conda-forge
clangxx_osx-arm64         16.0.6              h54d7cd3_11    conda-forge
cloudpickle               3.0.0              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
compiler-rt               16.0.6               h3808999_2    conda-forge
compiler-rt_osx-arm64     16.0.6               h3808999_2    conda-forge
cons                      0.4.6              pyhd8ed1ab_0    conda-forge
contourpy                 1.2.1           py311hcc98501_0    conda-forge
cycler                    0.12.1             pyhd8ed1ab_0    conda-forge
dm-tree                   0.1.8           py311hea19e3d_4    conda-forge
etuples                   0.3.9              pyhd8ed1ab_0    conda-forge
expat                     2.6.2                hebf3989_0    conda-forge
fastprogress              1.0.3              pyhd8ed1ab_0    conda-forge
filelock                  3.13.4             pyhd8ed1ab_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 h77eed37_1    conda-forge
fontconfig                2.14.2               h82840c6_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.51.0          py311h05b510d_0    conda-forge
freetype                  2.12.1               hadb7bae_2    conda-forge
fribidi                   1.0.10               h27ca646_0    conda-forge
fsspec                    2024.3.1           pyhca7485f_0    conda-forge
gdk-pixbuf                2.42.10              hcea6d13_5    conda-forge
gettext                   0.22.5               h8fbad5d_2    conda-forge
gettext-tools             0.22.5               h8fbad5d_2    conda-forge
giflib                    5.2.2                h93a5062_0    conda-forge
gmp                       6.3.0                hebf3989_1    conda-forge
gmpy2                     2.1.2           py311h2ba9262_1    conda-forge
graphite2                 1.3.13            hebf3989_1003    conda-forge
graphviz                  9.0.0                h3face73_1    conda-forge
gtk2                      2.24.33              h7895bb2_4    conda-forge
gts                       0.7.6                he42f4ea_4    conda-forge
h5netcdf                  1.3.0              pyhd8ed1ab_0    conda-forge
h5py                      3.11.0          nompi_py311hd00467f_100    conda-forge
harfbuzz                  8.3.0                h8f0ba13_0    conda-forge
hdf5                      1.14.3          nompi_h5bb55e9_100    conda-forge
huggingface_hub           0.22.2             pyhd8ed1ab_0    conda-forge
icu                       73.2                 hc8870d7_0    conda-forge
idna                      3.6                pyhd8ed1ab_0    conda-forge
iniconfig                 1.1.1              pyhd3eb1b0_0  
jinja2                    3.1.3              pyhd8ed1ab_0    conda-forge
kiwisolver                1.4.5           py311he4fd1f5_1    conda-forge
krb5                      1.21.2               h92f50d5_0    conda-forge
lcms2                     2.16                 ha0e7c42_0    conda-forge
ld64_osx-arm64            711                  ha4bd21c_0    conda-forge
lerc                      4.0.0                h9a09cb3_0    conda-forge
libabseil                 20240116.1      cxx17_hebf3989_2    conda-forge
libaec                    1.1.3                hebf3989_0    conda-forge
libasprintf               0.22.5               h8fbad5d_2    conda-forge
libasprintf-devel         0.22.5               h8fbad5d_2    conda-forge
libblas                   3.9.0           22_osxarm64_openblas    conda-forge
libbrotlicommon           1.1.0                hb547adb_1    conda-forge
libbrotlidec              1.1.0                hb547adb_1    conda-forge
libbrotlienc              1.1.0                hb547adb_1    conda-forge
libcblas                  3.9.0           22_osxarm64_openblas    conda-forge
libclang-cpp16            16.0.6          default_he012953_6    conda-forge
libcurl                   8.7.1                h2d989ff_0    conda-forge
libcxx                    16.0.6               h4653b0c_0    conda-forge
libdeflate                1.20                 h93a5062_0    conda-forge
libedit                   3.1.20191231         hc8eb9b7_2    conda-forge
libev                     4.33                 h93a5062_2    conda-forge
libexpat                  2.6.2                hebf3989_0    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libgd                     2.3.3                hfdf3952_9    conda-forge
libgettextpo              0.22.5               h8fbad5d_2    conda-forge
libgettextpo-devel        0.22.5               h8fbad5d_2    conda-forge
libgfortran               5.0.0           13_2_0_hd922786_3    conda-forge
libgfortran5              13.2.0               hf226fd6_3    conda-forge
libglib                   2.80.0               hfc324ee_4    conda-forge
libiconv                  1.17                 h0d3ecfb_2    conda-forge
libintl                   0.22.5               h8fbad5d_2    conda-forge
libintl-devel             0.22.5               h8fbad5d_2    conda-forge
libjpeg-turbo             3.0.0                hb547adb_1    conda-forge
liblapack                 3.9.0           22_osxarm64_openblas    conda-forge
liblapacke                3.9.0           22_osxarm64_openblas    conda-forge
libllvm16                 16.0.6               haab561b_3    conda-forge
libnghttp2                1.58.0               ha4dd798_1    conda-forge
libopenblas               0.3.27          openmp_h6c19121_0    conda-forge
libpng                    1.6.43               h091b4b1_0    conda-forge
libprotobuf               3.21.12              ha614eb4_2    conda-forge
librsvg                   2.58.0               hb3d354b_0    conda-forge
libsqlite                 3.45.2               h091b4b1_0    conda-forge
libssh2                   1.11.0               h7a5bd25_0    conda-forge
libtiff                   4.6.0                h07db509_3    conda-forge
libuv                     1.48.0               h93a5062_0    conda-forge
libwebp                   1.3.2                hf30222e_1    conda-forge
libwebp-base              1.3.2                h93a5062_1    conda-forge
libxcb                    1.15                 hf346824_0    conda-forge
libxml2                   2.12.6               h0d0cfa8_1    conda-forge
libzlib                   1.2.13               h53f4e23_5    conda-forge
llvm-openmp               18.1.3               hcd81f8e_0    conda-forge
llvm-tools                16.0.6               haab561b_3    conda-forge
llvmlite                  0.42.0                   pypi_0    pypi
logical-unification       0.4.6              pyhd8ed1ab_0    conda-forge
markupsafe                2.1.5           py311h05b510d_0    conda-forge
matplotlib-base           3.8.4           py311hb58f1d1_0    conda-forge
minikanren                1.0.3              pyhd8ed1ab_0    conda-forge
mpc                       1.3.1                h91ba8db_0    conda-forge
mpfr                      4.2.1                h41d338b_1    conda-forge
mpmath                    1.3.0              pyhd8ed1ab_0    conda-forge
multipledispatch          0.6.0                      py_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
ncurses                   6.4.20240210         h078ce10_0    conda-forge
networkx                  3.3                pyhd8ed1ab_1    conda-forge
nomkl                     1.0                  h5ca1d4c_0    conda-forge
numba                     0.59.1                   pypi_0    pypi
numpy                     1.24.4                   pypi_0    pypi
openblas                  0.3.27          openmp_h55c453e_0    conda-forge
openjpeg                  2.5.2                h9f1df11_0    conda-forge
openssl                   3.2.1                h0d3ecfb_1    conda-forge
packaging                 24.0               pyhd8ed1ab_0    conda-forge
pandas                    2.2.2           py311hfbe21a1_0    conda-forge
pango                     1.52.2               hb067d4f_0    conda-forge
pcre2                     10.43                h26f9a81_0    conda-forge
pillow                    10.3.0          py311h0b5d0a1_0    conda-forge
pip                       24.0               pyhd8ed1ab_0    conda-forge
pixman                    0.43.4               hebf3989_0    conda-forge
pluggy                    1.0.0           py311hca03da5_1  
preliz                    0.5.0                    pypi_0    pypi
psutil                    5.9.8           py311h05b510d_0    conda-forge
pthread-stubs             0.4               h27ca646_1001    conda-forge
pymc                      5.10.0               hd8ed1ab_0    conda-forge
pymc-bart                 0.5.11                   pypi_0    pypi
pymc-base                 5.10.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.1.2              pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
pytensor                  2.18.6          py311hbc2cede_0    conda-forge
pytensor-base             2.18.6          py311hfbe21a1_0    conda-forge
pytest                    7.4.0           py311hca03da5_0  
python                    3.11.6          h47c9636_0_cpython    conda-forge
python-dateutil           2.9.0              pyhd8ed1ab_0    conda-forge
python-graphviz           0.20.3             pyh717bed2_0    conda-forge
python-tzdata             2024.1             pyhd8ed1ab_0    conda-forge
python_abi                3.11                    4_cp311    conda-forge
pytorch                   2.0.0           cpu_generic_py311ha38e979_1    conda-forge
pytz                      2024.1             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0.1           py311heffc1b2_1    conda-forge
readline                  8.2                  h92ec313_1    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
safetensors               0.4.2           py311h94f323b_0    conda-forge
scipy                     1.12.0                   pypi_0    pypi
setuptools                69.2.0             pyhd8ed1ab_0    conda-forge
sigtool                   0.1.3                h44b9a77_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sleef                     3.5.1                h156473d_2    conda-forge
sympy                     1.12            pypyh9d50eac_103    conda-forge
tapi                      1100.0.11            he4954df_0    conda-forge
tk                        8.6.13               h5083fa2_1    conda-forge
toolz                     0.12.1             pyhd8ed1ab_0    conda-forge
tqdm                      4.66.2             pyhd8ed1ab_0    conda-forge
typing-extensions         4.11.0               hd8ed1ab_0    conda-forge
typing_extensions         4.11.0             pyha770c72_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
urllib3                   2.2.1              pyhd8ed1ab_0    conda-forge
wheel                     0.43.0             pyhd8ed1ab_1    conda-forge
xarray                    2024.3.0           pyhd8ed1ab_0    conda-forge
xarray-einstats           0.7.0              pyhd8ed1ab_0    conda-forge
xorg-libxau               1.0.11               hb547adb_0    conda-forge
xorg-libxdmcp             1.1.3                h27ca646_0    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge
yaml                      0.2.5                h3422bc3_2    conda-forge
zlib                      1.2.13               h53f4e23_5    conda-forge
zstd                      1.5.5                h4f39d0f_0    conda-forge

I appreciate any suggestions

Just to rule out silly stuff, are you sure the notebook is running on the installed environment? Or alternatively you get the same error running pymc from a terminal?

I didn’t change anything but now everything (from terminal, pycharm, jupyter) works! I still get the WARNING regrading BLAS functions when I run with pycharm but not when I use terminal. Is it not a problem?

Anyway, thank you so much!

[Update] Running with terminal always works, but running with IDE as well as Jupyter is unstable, i.e. sometimes works but sometimes doesn’t. Can you think of a potential reason for this latency and differene between terminal and inconsistent runs with IDE?

My guess is you’re not accessing the correct environment from jupyter/pycharm. Check out if sys.executable is the same

PyMC-BART can be installed with conda, preliz not yet (I just opened an issue).