Exception: ('Compilation failed (return status=1)... error after installing PyMC3 for the first time

I agree with you that it’s not the best first experience. We will update the instructions soon in there. The rest of the notebook seems to be up to date. Let us know if you find any issues.

I can confirm. I re-installed my environment with Python 3.8 (just to be safe) and the correct installation command linked to above and the getting started example works fine. Thanks for your assistance.

1 Like

Hi! I followed the instruction from Installation Guide (Windows) · pymc-devs/pymc3 Wiki · GitHub but still got the same issue. I’m using python3.8 in conda on Windows. Could someone point out what I could do wrong?

2 Likes

Hi I have also followed the windows installation instructions precisely and receive the following exception:

Exception: ('Compilation failed (return status=1): C:\Users\matth\AppData\Local\Temp\ccyTAp8a.s: Assembler messages:\r. C:\Users\matth\AppData\Local\Temp\ccyTAp8a.s:101: Error: invalid register for .seh_savexmm\r. ', ‘FunctionGraph(Elemwise{EQ}(<TensorType(float64, vector)>, <TensorType(int8, (True,))>))’)

1 Like

Hi~ I got the same issue. Have you solved the problem? Even though I referred to the steps recommended by installation guide and response from issuses, there are still no ways to solve it.

1 Like

I am always getting the same issue, has anybody managed to solve this?

I get the same errors even after following the instructions in all installation pages, and doing it multiple times, trying to use this package have been pretty hectic to be honest

Hi, is there any update on new installation procedure? i still get the same error.

I am getting a similar problem while flowing the installation instructions.

Exception: ("Compilation failed (return status=1): In file included from /Users/kanferg/.theano/compiledir_Darwin-19.6.0-x86_64-i386-64bit-i386-3.7.13-64/tmpzicwrzx5/mod.cpp:1:. In file included from /Users/kanferg/opt/anaconda3/envs/pm3_py37/include/python3.7m/Python.h:25:. /Users/kanferg/opt/anaconda3/envs/pm3_py37/bin/…/include/c++/v1/stdio.h:107:15: fatal error: ‘stdio.h’ file not found. #include_next <stdio.h>. ^~~~~~~~~. 1 error generated… ", ‘FunctionGraph(Elemwise{true_div,no_inplace}(TensorConstant{1.0}, TensorConstant{1.0}))’)

I am also having compilation issues on a first-time install on MacOS.

I’m on an M1 Mac running Monterey. Followed instructions here and am trying to run the “getting started” notebook.

Running on PyMC3 v3.11.4
Running on ArviZ v0.11.2

When I run the model line, compilation fails (see error message below). Based on similar StackOverflow threads (here) I’ve tried uninstalling / reinstalling / updating both the CLT and Xcode separately, to no avail.

Exception: ("Compilation failed (return status=1): ld: unsupported tapi file type ‘!tapi-tbd’ in YAML file ‘/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libSystem.tbd’ for architecture x86_64. clang-12: error: linker command failed with exit code 1 (use -v to see invocation). ", ‘FunctionGraph(Elemwise{true_div,no_inplace}(TensorConstant{1.0}, TensorConstant{1.0}))’)

This may be a red herring but the issue seems to be originating from the theano library-- which maybe should be pymc-theano based on the install instructions?

File ~/opt/anaconda3/envs/pymc3_env/lib/python3.9/site-packages/theano/tensor/var.py:176

Hello there,
I’m also a PyMC3 first-timer and I got the exact same error message as ted above, after following the latest installation instructions (running on MacOS Monterey).
I’d really love to use PyMC3, so if anyone knows what is going on, please step in. :slight_smile:

1 Like

Greetings all,

I’m having the same issue. However, the only difference is that no issue when running conda environment on macOS terminal, yet it produces the same issue stated above on any IDE, like pycharm etc. Anyone find any solution?

with model.backend.model:
    idata=pm.sampling_jax.sample_numpyro_nuts(draws= 2500, tune = 100, target_accept = .99, postprocessing_backend = 'cpu')
    posterior_predictive = pm.sample_posterior_predictive(trace = idata, extend_inferencedata=True)
You can find the C code in this temporary file: /var/folders/jj/t5457kfd45zg1p3m5gnvp3580000gn/T/aesara_compilation_error_k6_sv7lq
Traceback (most recent call last):
  File "/Users/fatihbozdag/opt/anaconda3/envs/tools/lib/python3.11/site-packages/aesara/link/vm.py", line 1246, in make_all
    node.op.make_thunk(node, storage_map, compute_map, [], impl=impl)
  File "/Users/fatihbozdag/opt/anaconda3/envs/tools/lib/python3.11/site-packages/aesara/link/c/op.py", line 131, in make_thunk
    return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/fatihbozdag/opt/anaconda3/envs/tools/lib/python3.11/site-packages/aesara/link/c/op.py", line 96, in make_c_thunk
    outputs = cl.make_thunk(
              ^^^^^^^^^^^^^^
  File "/Users/fatihbozdag/opt/anaconda3/envs/tools/lib/python3.11/site-packages/aesara/link/c/basic.py", line 1202, in make_thunk
    cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
                                                             ^^^^^^^^^^^^^^^^^
  File "/Users/fatihbozdag/opt/anaconda3/envs/tools/lib/python3.11/site-packages/aesara/link/c/basic.py", line 1122, in __compile__
    thunk, module = self.cthunk_factory(
                    ^^^^^^^^^^^^^^^^^^^^
  File "/Users/fatihbozdag/opt/anaconda3/envs/tools/lib/python3.11/site-packages/aesara/link/c/basic.py", line 1647, in cthunk_factory
    module = cache.module_from_key(key=key, lnk=self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/fatihbozdag/opt/anaconda3/envs/tools/lib/python3.11/site-packages/aesara/link/c/cmodule.py", line 1229, in module_from_key
    module = lnk.compile_cmodule(location)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/fatihbozdag/opt/anaconda3/envs/tools/lib/python3.11/site-packages/aesara/link/c/basic.py", line 1546, in compile_cmodule
    module = c_compiler.compile_str(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/fatihbozdag/opt/anaconda3/envs/tools/lib/python3.11/site-packages/aesara/link/c/cmodule.py", line 2640, in compile_str
    raise CompileError(
aesara.link.c.exceptions.CompileError: Compilation failed (return status=1):
/Users/fatihbozdag/opt/anaconda3/envs/tools/bin/clang++ -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -fPIC -undefined dynamic_lookup -I/Users/fatihbozdag/opt/anaconda3/envs/tools/lib/python3.11/site-packages/numpy/core/include -I/Users/fatihbozdag/opt/anaconda3/envs/tools/include/python3.11 -I/Users/fatihbozdag/opt/anaconda3/envs/tools/lib/python3.11/site-packages/aesara/link/c/c_code -L/Users/fatihbozdag/opt/anaconda3/envs/tools/lib -fvisibility=hidden -o /Users/fatihbozdag/.aesara/compiledir_macOS-13.1-arm64-arm-64bit-arm-3.11.0-64/tmpvkqzlpe7/mf31361ca627aa70a34ba69d9c3a6724ab1a9973de86698a670254c65a40b8387.so /Users/fatihbozdag/.aesara/compiledir_macOS-13.1-arm64-arm-64bit-arm-3.11.0-64/tmpvkqzlpe7/mod.cpp
In file included from /Users/fatihbozdag/.aesara/compiledir_macOS-13.1-arm64-arm-64bit-arm-3.11.0-64/tmpvkqzlpe7/mod.cpp:1:
In file included from /Users/fatihbozdag/opt/anaconda3/envs/tools/include/python3.11/Python.h:23:
/Users/fatihbozdag/opt/anaconda3/envs/tools/bin/../include/c++/v1/stdlib.h:93:15: fatal error: 'stdlib.h' file not found
#include_next <stdlib.h>

Are you using an M1? Platform, installation method, and version numbers would help investigate.

Yeap, it is M2 actually.


Python 3.11.0 | packaged by conda-forge | (main, Oct 25 2022, 06:21:25) [Clang 14.0.4 ] on darwin
print(f"Running on PyMC v{pm.__version__}")
Running on PyMC v5.0.1

IDE Pycharm

(tools) fatihbozdag@arm64-apple-darwin20 pythonProject % pip list
Package             Version
------------------- ---------
absl-py             1.3.0
aeppl               0.0.38
aesara              2.8.7
arviz               0.14.0
bambi               0.9.3
blackjax            0.9.6
cachetools          4.2.2
certifi             2020.6.20
cftime              1.6.2
cloudpickle         2.0.0
cons                0.4.5
contourpy           1.0.6
cycler              0.11.0
etuples             0.3.8
fastprogress        1.0.0
filelock            3.6.0
fonttools           4.25.0
formulae            0.3.4
graphviz            0.16
jax                 0.4.1
jaxlib              0.4.1
jaxopt              0.5.5
kiwisolver          1.4.4
logical-unification 0.4.5
matplotlib          3.6.2
miniKanren          1.0.3
multipledispatch    0.6.0
munkres             1.1.4
netCDF4             1.6.2
numpy               1.23.5
numpyro             0.10.1
opt-einsum          3.3.0
packaging           21.3
pandas              1.5.2
Pillow              9.2.0
pip                 22.3.1
pymc                5.0.1
pyparsing           3.0.4
pytensor            2.8.11
python-dateutil     2.8.2
pytz                2021.3
scipy               1.9.3
seaborn             0.12.1
setuptools          65.6.3
six                 1.16.0
toolz               0.11.2
tqdm                4.64.1
typing_extensions   4.1.1
wheel               0.37.1
xarray              2022.12.0
xarray-einstats     0.4.0

Indeed, I’ve just updated PyMC from 4.4, yet no change. The problem persists. I’ve followed the updated install instructions, however, since it did not work, I’ve installed version 5 via pip.

Here you can see that all is good on the macOS terminal in the same environment.

Update.

I’ve reverted to python 3.10.8, and all is good on Spyder and PyCharm.

(off-topic question) By the way, with PyMC 4, the following code also provides loglikelihood, yet it is not the case with version 5. why is the difference?

with model.backend.model:
    idata=pm.sampling_jax.sample_numpyro_nuts(draws= 2500, tune = 100, target_accept = .99, postprocessing_backend = 'cpu')
    posterior_predictive = pm.sample_posterior_predictive(trace = idata, extend_inferencedata=True)
(pymc) fatihbozdag@Fatihs-MacBook-Pro ~ % pip list
Package                       Version
----------------------------- -----------
alabaster                     0.7.12
applaunchservices             0.3.0
appnope                       0.1.2
arrow                         1.2.3
arviz                         0.14.0
astroid                       2.11.7
atomicwrites                  1.4.0
attrs                         22.1.0
autopep8                      1.6.0
Babel                         2.11.0
backcall                      0.2.0
bambi                         0.9.3
beautifulsoup4                4.11.1
binaryornot                   0.4.4
black                         22.6.0
bleach                        4.1.0
brotlipy                      0.7.0
cachetools                    5.2.0
certifi                       2022.12.7
cffi                          1.15.1
cftime                        1.6.2
chardet                       4.0.0
charset-normalizer            2.0.4
click                         8.0.4
cloudpickle                   2.0.0
colorama                      0.4.5
cons                          0.4.5
contourpy                     1.0.6
cookiecutter                  1.7.3
cryptography                  38.0.1
cycler                        0.11.0
debugpy                       1.5.1
decorator                     5.1.1
defusedxml                    0.7.1
diff-match-patch              20200713
dill                          0.3.6
docutils                      0.18.1
entrypoints                   0.4
etuples                       0.3.8
fastjsonschema                2.16.2
fastprogress                  1.0.3
filelock                      3.8.2
flake8                        4.0.1
flit_core                     3.6.0
fonttools                     4.38.0
formulae                      0.3.4
graphviz                      0.20.1
idna                          3.4
imagesize                     1.4.1
importlib-metadata            4.11.3
inflection                    0.5.1
intervaltree                  3.1.0
ipykernel                     6.15.2
ipython                       7.31.1
ipython-genutils              0.2.0
isort                         5.9.3
jax                           0.4.1
jaxlib                        0.4.1
jedi                          0.18.1
jellyfish                     0.9.0
Jinja2                        3.1.2
jinja2-time                   0.2.0
jsonschema                    4.16.0
jupyter_client                7.4.8
jupyter_core                  4.11.2
jupyterlab-pygments           0.1.2
keyring                       23.4.0
kiwisolver                    1.4.4
lazy-object-proxy             1.6.0
logical-unification           0.4.5
lxml                          4.9.1
MarkupSafe                    2.1.1
matplotlib                    3.6.2
matplotlib-inline             0.1.6
mccabe                        0.7.0
miniKanren                    1.0.3
mistune                       0.8.4
multipledispatch              0.6.0
mypy-extensions               0.4.3
nbclient                      0.5.13
nbconvert                     6.5.4
nbformat                      5.7.0
nest-asyncio                  1.5.5
netCDF4                       1.6.2
numpy                         1.24.0
numpydoc                      1.5.0
numpyro                       0.10.1
opt-einsum                    3.3.0
packaging                     22.0
pandas                        1.5.2
pandocfilters                 1.5.0
parso                         0.8.3
pathspec                      0.9.0
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        9.3.0
pip                           22.3.1
platformdirs                  2.5.2
pluggy                        1.0.0
ply                           3.11
poyo                          0.5.0
prompt-toolkit                3.0.20
psutil                        5.9.0
ptyprocess                    0.7.0
pycodestyle                   2.8.0
pycparser                     2.21
pydocstyle                    6.1.1
pyflakes                      2.4.0
Pygments                      2.11.2
pylint                        2.14.5
pyls-spyder                   0.4.0
pymc                          5.0.1
pyobjc-core                   8.5
pyobjc-framework-Cocoa        8.5
pyobjc-framework-CoreServices 8.5
pyobjc-framework-FSEvents     8.5
pyOpenSSL                     22.0.0
pyparsing                     3.0.9
PyQt5-sip                     12.11.0
pyrsistent                    0.18.0
PySocks                       1.7.1
pytensor                      2.8.11
python-dateutil               2.8.2
python-lsp-black              1.2.1
python-lsp-jsonrpc            1.0.0
python-lsp-server             1.5.0
python-slugify                5.0.2
pytz                          2022.7
PyYAML                        6.0
pyzmq                         23.2.0
QDarkStyle                    3.0.2
qstylizer                     0.1.10
QtAwesome                     1.0.3
qtconsole                     5.3.2
QtPy                          2.2.0
requests                      2.28.1
rope                          0.22.0
Rtree                         0.9.7
scipy                         1.9.3
seaborn                       0.12.1
setuptools                    65.5.0
sip                           6.6.2
six                           1.16.0
snowballstemmer               2.2.0
sortedcontainers              2.4.0
soupsieve                     2.3.2.post1
Sphinx                        5.0.2
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
spyder                        5.3.3
spyder-kernels                2.3.3
text-unidecode                1.3
textdistance                  4.2.1
three-merge                   0.1.1
tinycss                       0.4
tinycss2                      1.2.1
toml                          0.10.2
tomli                         2.0.1
tomlkit                       0.11.1
toolz                         0.12.0
tornado                       6.2
tqdm                          4.64.1
traitlets                     5.7.1
typing_extensions             4.4.0
ujson                         5.4.0
Unidecode                     1.2.0
urllib3                       1.26.13
watchdog                      2.1.6
wcwidth                       0.2.5
webencodings                  0.5.1
whatthepatch                  1.0.2
wheel                         0.37.1
wrapt                         1.14.1
wurlitzer                     3.0.2
xarray                        2022.12.0
xarray-einstats               0.4.0
yapf                          0.31.0
zipp                          3.8.0

Can you elaborate?

well, on pyMC4 without providing idata_kwargs={"log_likelihood":True}, pm.sampling_jax.sample_numpyro_nuts would provide log_likehood . However, with pyMC version 5, without kwargs InferenceData would not include log_likelihood. I thought the default is log_likelihood = True

so the code above would be rewritten as;

with model.backend.model:
    idata=pm.sampling_jax.sample_numpyro_nuts(draws= 2500, tune = 100, target_accept = .99, postprocessing_backend = 'cpu', idata_kwargs = {"log_likelihood": True)
    posterior_predictive = pm.sample_posterior_predictive(trace = idata, extend_inferencedata=True)

This behavior changed with 5.0. See the release notes here.

1 Like

export CPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include

Above code part worked for me. I was also receiving the following error

  GCC_compiler.compile_str(dirname, code, location=loc, preargs=args)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/pymc_env_research/lib/python3.11/site-packages/pytensor/link/c/cmodule.py", line 2640, in compile_str
    raise CompileError(
pytensor.link.c.exceptions.CompileError: Compilation failed (return status=1):
/opt/homebrew/Caskroom/miniforge/base/envs/pymc_env_research/bin/clang++ -dynamiclib -g -Wno-c++11-narrowing -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -fPIC -undefined dynamic_lookup -I/opt/homebrew/Caskroom/miniforge/base/envs/pymc_env_research/lib/python3.11/site-packages/numpy/core/include -I/opt/homebrew/Caskroom/miniforge/base/envs/pymc_env_research/include/python3.11 -I/opt/homebrew/Caskroom/miniforge/base/envs/pymc_env_research/lib/python3.11/site-packages/pytensor/link/c/c_code -L/opt/homebrew/Caskroom/miniforge/base/envs/pymc_env_research/lib -fvisibility=hidden -o /Users/mehmet/.pytensor/compiledir_macOS-14.2.1-arm64-arm-64bit-arm-3.11.7-64/lazylinker_ext/lazylinker_ext.so /Users/mehmet/.pytensor/compiledir_macOS-14.2.1-arm64-arm-64bit-arm-3.11.7-64/lazylinker_ext/mod.cpp
ld: library 'System' not found
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)