Install PyMC from GitHub using Anaconda enviroment in MAC

Hi people, we are trying to run BART in PyMC (GitHub version) using Anaconda in MAC, we made the following in a python 3.8 environment. The model that we tried to run is:

with pm.Model(rng_seeder=666) as model:
    μ = pm.BART('μ', X, Y) 
    σ = pm.HalfNormal('σ', 1)
    y = pm.Normal('y', μ, σ, observed=Y)
    idata = pm.sample(1000, tune=1000, chains=1, random_seed=666)

The error is the following:

ERROR (aesara.graph.opt): Optimization failure due to: constant_folding
ERROR (aesara.graph.opt): node: MakeVector{dtype='int64'}(TensorConstant{200})
ERROR (aesara.graph.opt): TRACEBACK:
ERROR (aesara.graph.opt): Traceback (most recent call last):
  File "/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/graph/opt.py", line 2025, in process_node
    replacements = lopt.transform(fgraph, node)
  File "/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/graph/opt.py", line 1187, in transform
    return self.fn(*args, **kwargs)
  File "/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/tensor/basic_opt.py", line 4338, in constant_folding
    thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
  File "/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/graph/op.py", line 682, in make_thunk
    return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
  File "/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/graph/op.py", line 648, in make_c_thunk
    outputs = cl.make_thunk(
  File "/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/c/basic.py", line 1204, in make_thunk
    cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
  File "/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/c/basic.py", line 1139, in __compile__
    thunk, module = self.cthunk_factory(
  File "/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/c/basic.py", line 1635, in cthunk_factory
    module = get_module_cache().module_from_key(key=key, lnk=self)
  File "/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/c/cmodule.py", line 1198, in module_from_key
    module = lnk.compile_cmodule(location)
  File "/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/c/basic.py", line 1544, in compile_cmodule
    module = c_compiler.compile_str(
  File "/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/c/cmodule.py", line 2553, in compile_str
    raise CompileError(
aesara.link.c.exceptions.CompileError: Compilation failed (return status=1):
/Users/MacMesser/anaconda3/envs/py38/bin/clang++ -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wno-c++11-narrowing -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/numpy/core/include -I/Users/MacMesser/anaconda3/envs/py38/include/python3.8 -I/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/c/c_code -L/Users/MacMesser/anaconda3/envs/py38/lib -fvisibility=hidden -o /Users/MacMesser/.aesara/compiledir_macOS-10.15.7-x86_64-i386-64bit-i386-3.8.12-64/tmp08bx5w11/m83c8945890860d30d89f0bf58d806baebd0304283bfe761a74ac471b6b32526d.so /Users/MacMesser/.aesara/compiledir_macOS-10.15.7-x86_64-i386-64bit-i386-3.8.12-64/tmp08bx5w11/mod.cpp
In file included from /Users/MacMesser/.aesara/compiledir_macOS-10.15.7-x86_64-i386-64bit-i386-3.8.12-64/tmp08bx5w11/mod.cpp:1:
In file included from /Users/MacMesser/anaconda3/envs/py38/include/python3.8/Python.h:25:
/Users/MacMesser/anaconda3/envs/py38/bin/../include/c++/v1/stdio.h:107:15: fatal error: 'stdio.h' file not found
#include_next <stdio.h>
              ^~~~~~~~~
1 error generated.


You can find the C code in this temporary file: /var/folders/t7/6r6sbtds7h71pk0gvkx_4ckh0000gn/T/aesara_compilation_error_atpm62kk

You can find the C code in this temporary file: /var/folders/t7/6r6sbtds7h71pk0gvkx_4ckh0000gn/T/aesara_compilation_error__acdjcop

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/c/lazylinker_c.py in <module>
     75         if version != actual_version:
---> 76             raise ImportError(
     77                 "Version check of the existing lazylinker compiled file."

ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
~/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/c/lazylinker_c.py in <module>
     96             if version != actual_version:
---> 97                 raise ImportError(
     98                     "Version check of the existing lazylinker compiled file."

ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True

During handling of the above exception, another exception occurred:

CompileError                              Traceback (most recent call last)
/var/folders/t7/6r6sbtds7h71pk0gvkx_4ckh0000gn/T/ipykernel_33899/3780641358.py in <module>
      1 with pm.Model() as model:
----> 2     μ = pm.BART('μ', X, Y)
      3     σ = pm.HalfNormal('σ', 1)
      4     y = pm.Normal('y', μ, σ, observed=Y)
      5     idata = pm.sample(1000, tune=1000, chains=1)

~/Documents/OSVALDO/PyMC/pymc-main/pymc/bart/bart.py in __new__(cls, name, X, Y, m, alpha, k, response, split_prior, **kwargs)
    139         cls.rv_op = bart_op
    140         params = [X, Y, m, alpha, k]
--> 141         return super().__new__(cls, name, *params, **kwargs)
    142 
    143     @classmethod

~/Documents/OSVALDO/PyMC/pymc-main/pymc/distributions/distribution.py in __new__(cls, name, rng, dims, initval, observed, total_size, transform, *args, **kwargs)
    238             rv_out = change_rv_size(rv_var=rv_out, new_size=resize_shape, expand=True)
    239 
--> 240         rv_out = model.register_rv(
    241             rv_out,
    242             name,

~/Documents/OSVALDO/PyMC/pymc-main/pymc/model.py in register_rv(self, rv_var, name, data, total_size, dims, transform, initval)
   1247             self.create_value_var(rv_var, transform)
   1248             self.add_random_variable(rv_var, dims)
-> 1249             self.set_initval(rv_var, initval)
   1250         else:
   1251             if (

~/Documents/OSVALDO/PyMC/pymc-main/pymc/model.py in set_initval(self, rv_var, initval)
    962 
    963         if initval is None or transform:
--> 964             initval = self._eval_initval(rv_var, initval, test_value, transform)
    965 
    966         self.initial_values[rv_value_var] = initval

~/Documents/OSVALDO/PyMC/pymc-main/pymc/model.py in _eval_initval(self, rv_var, initval, test_value, transform)
   1019             self.values_to_rvs[k]: initval_to_rvval(k, v) for k, v in self.initial_values.items()
   1020         }
-> 1021         initval_fn = aesara.function([], rv_var, mode=mode, givens=givens, on_unused_input="ignore")
   1022         try:
   1023             initval = initval_fn()

~/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/compile/function/__init__.py in function(inputs, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input)
    335         # note: pfunc will also call orig_function -- orig_function is
    336         #      a choke point that all compilation must pass through
--> 337         fn = pfunc(
    338             params=inputs,
    339             outputs=outputs,

~/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/compile/function/pfunc.py in pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input, output_keys)
    522         inputs.append(si)
    523 
--> 524     return orig_function(
    525         inputs,
    526         cloned_outputs,

~/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/compile/function/types.py in orig_function(inputs, outputs, mode, accept_inplace, name, profile, on_unused_input, output_keys)
   1982         )
   1983         with config.change_flags(compute_test_value="off"):
-> 1984             fn = m.create(defaults)
   1985     finally:
   1986         t2 = time.time()

~/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/compile/function/types.py in create(self, input_storage, trustme, storage_map)
   1837 
   1838         with config.change_flags(traceback__limit=config.traceback__compile_limit):
-> 1839             _fn, _i, _o = self.linker.make_thunk(
   1840                 input_storage=input_storage_lists, storage_map=storage_map
   1841             )

~/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/basic.py in make_thunk(self, input_storage, output_storage, storage_map, **kwargs)
    280         **kwargs,
    281     ) -> ThunkType:
--> 282         return self.make_all(
    283             input_storage=input_storage,
    284             output_storage=output_storage,

~/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/vm.py in make_all(self, profiler, input_storage, output_storage, storage_map)
   1163             post_thunk_clear = None
   1164 
-> 1165         vm = self.make_vm(
   1166             order,
   1167             thunks,

~/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/vm.py in make_vm(self, nodes, thunks, input_storage, output_storage, storage_map, post_thunk_clear, computed, compute_map, updated_vars)
    868 
    869         try:
--> 870             from aesara.link.c.cvm import CVM
    871         except (MissingGXX, ImportError):
    872             CVM = None

~/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/c/cvm.py in <module>
     11             "lazylinker will not be imported if aesara.config.cxx is not set."
     12         )
---> 13     from aesara.link.c import lazylinker_c
     14 
     15     class CVM(lazylinker_c.CLazyLinker, VM):

~/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/c/lazylinker_c.py in <module>
    135 
    136             args = GCC_compiler.compile_args()
--> 137             GCC_compiler.compile_str(dirname, code, location=loc, preargs=args)
    138             # Save version into the __init__.py file.
    139             init_py = os.path.join(loc, "__init__.py")

~/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/c/cmodule.py in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols)
   2551             # difficult to read.
   2552             # compile_stderr = compile_stderr.replace("\n", ". ")
-> 2553             raise CompileError(
   2554                 f"Compilation failed (return status={status}):\n{' '.join(cmd)}\n{compile_stderr}"
   2555             )

CompileError: Compilation failed (return status=1):
/Users/MacMesser/anaconda3/envs/py38/bin/clang++ -dynamiclib -g -Wno-c++11-narrowing -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/numpy/core/include -I/Users/MacMesser/anaconda3/envs/py38/include/python3.8 -I/Users/MacMesser/anaconda3/envs/py38/lib/python3.8/site-packages/aesara/link/c/c_code -L/Users/MacMesser/anaconda3/envs/py38/lib -fvisibility=hidden -o /Users/MacMesser/.aesara/compiledir_macOS-10.15.7-x86_64-i386-64bit-i386-3.8.12-64/lazylinker_ext/lazylinker_ext.so /Users/MacMesser/.aesara/compiledir_macOS-10.15.7-x86_64-i386-64bit-i386-3.8.12-64/lazylinker_ext/mod.cpp
In file included from /Users/MacMesser/.aesara/compiledir_macOS-10.15.7-x86_64-i386-64bit-i386-3.8.12-64/lazylinker_ext/mod.cpp:1:
In file included from /Users/MacMesser/anaconda3/envs/py38/include/python3.8/Python.h:25:
/Users/MacMesser/anaconda3/envs/py38/bin/../include/c++/v1/stdio.h:107:15: fatal error: 'stdio.h' file not found
#include_next <stdio.h>
              ^~~~~~~~~
1 error generated.

Apparently, the error comes from Aesara, these are the ways that we tried in the packages installations:

  1. First installation:
conda install jupyter scipy numpy mkl

conda install -c conda-forge arviz

# In the downloaded pymc-main folder
pip install -r requirements-dev.txt

# From the folder above pymc-main
pip install -e pymc-main

This gives the above error, then we tray uninstalling Aesara with pip and reinstall with conda:

pip uninstall aesara
conda install -c conda-forge aesara

But we get the same error.

  1. Second installation:
# Delete the previous environment and create a new one
conda env remove --name py38
conda create --name py38 python=3.8
source activate py38

# New installation
conda install jupyter scipy numpy mkl
# From the folder above pymc -main
pip install -e pymc-main

But again the previous error appears when we run the model.

The system information is:

macOS Catalina v 10.15.7
MacBookPro (Retina, 13 inch, late 2013)
Processor 2.8 GHz, Dual-Core Intel Core i7
Memory 16 GB 1600 MHz DDR3
Graphics Intel Iris 1536 MB

The conda info command displays the following information:

     active environment : None
       user config file : /Users/MacMesser/.condarc
 populated config files : /Users/MacMesser/.condarc
          conda version : 4.10.3
    conda-build version : 3.0.27
         python version : 3.6.13.final.0
       virtual packages : __osx=10.15.7=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /Users/MacMesser/anaconda3  (writable)
      conda av data dir : /Users/MacMesser/anaconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://conda.anaconda.org/conda-forge/osx-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /Users/MacMesser/anaconda3/pkgs
                          /Users/MacMesser/.conda/pkgs
       envs directories : /Users/MacMesser/anaconda3/envs
                          /Users/MacMesser/.conda/envs
               platform : osx-64
             user-agent : conda/4.10.3 requests/2.26.0 CPython/3.6.13 Darwin/19.6.0 OSX/10.15.7
                UID:GID : 501:20
             netrc file : None
           offline mode : False

We really appreciate it if somebody can point us in a direction to correct this error.

1 Like

Pymc3 - 'final' stable release on conda? - #2 by Helmut might help.

1 Like

I get the same error using that solution:

ERROR (aesara.graph.opt): Optimization failure due to: constant_folding
ERROR (aesara.graph.opt): node: MakeVector{dtype='int64'}(TensorConstant{200})
ERROR (aesara.graph.opt): TRACEBACK:
ERROR (aesara.graph.opt): Traceback (most recent call last):
  File "/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/graph/opt.py", line 2025, in process_node
    replacements = lopt.transform(fgraph, node)
  File "/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/graph/opt.py", line 1187, in transform
    return self.fn(*args, **kwargs)
  File "/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/tensor/basic_opt.py", line 2994, in constant_folding
    thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
  File "/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/graph/op.py", line 682, in make_thunk
    return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
  File "/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/graph/op.py", line 648, in make_c_thunk
    outputs = cl.make_thunk(
  File "/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/c/basic.py", line 1204, in make_thunk
    cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
  File "/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/c/basic.py", line 1139, in __compile__
    thunk, module = self.cthunk_factory(
  File "/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/c/basic.py", line 1635, in cthunk_factory
    module = get_module_cache().module_from_key(key=key, lnk=self)
  File "/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/c/cmodule.py", line 1198, in module_from_key
    module = lnk.compile_cmodule(location)
  File "/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/c/basic.py", line 1544, in compile_cmodule
    module = c_compiler.compile_str(
  File "/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/c/cmodule.py", line 2553, in compile_str
    raise CompileError(
aesara.link.c.exceptions.CompileError: Compilation failed (return status=1):
/Users/MacMesser/anaconda3/bin/clang++ -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -Wno-c++11-narrowing -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/numpy/core/include -I/Users/MacMesser/anaconda3/envs/py39/include/python3.9 -I/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/c/c_code -L/Users/MacMesser/anaconda3/envs/py39/lib -fvisibility=hidden -o /Users/MacMesser/.aesara/compiledir_macOS-10.15.7-x86_64-i386-64bit-i386-3.9.5-64/tmpbvc9d5ru/m83c8945890860d30d89f0bf58d806baebd0304283bfe761a74ac471b6b32526d.so /Users/MacMesser/.aesara/compiledir_macOS-10.15.7-x86_64-i386-64bit-i386-3.9.5-64/tmpbvc9d5ru/mod.cpp
In file included from /Users/MacMesser/.aesara/compiledir_macOS-10.15.7-x86_64-i386-64bit-i386-3.9.5-64/tmpbvc9d5ru/mod.cpp:1:
In file included from /Users/MacMesser/anaconda3/envs/py39/include/python3.9/Python.h:25:
/Users/MacMesser/anaconda3/bin/../include/c++/v1/stdio.h:107:15: fatal error: 'stdio.h' file not found
#include_next <stdio.h>
              ^~~~~~~~~
1 error generated.


You can find the C code in this temporary file: /var/folders/t7/6r6sbtds7h71pk0gvkx_4ckh0000gn/T/aesara_compilation_error_wktbwbj3

You can find the C code in this temporary file: /var/folders/t7/6r6sbtds7h71pk0gvkx_4ckh0000gn/T/aesara_compilation_error_7ik7l9w8

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/c/lazylinker_c.py in <module>
     75         if version != actual_version:
---> 76             raise ImportError(
     77                 "Version check of the existing lazylinker compiled file."

ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
~/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/c/lazylinker_c.py in <module>
     96             if version != actual_version:
---> 97                 raise ImportError(
     98                     "Version check of the existing lazylinker compiled file."

ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True

During handling of the above exception, another exception occurred:

CompileError                              Traceback (most recent call last)
/var/folders/t7/6r6sbtds7h71pk0gvkx_4ckh0000gn/T/ipykernel_57189/3780641358.py in <module>
      1 with pm.Model() as model:
----> 2     μ = pm.BART('μ', X, Y)
      3     σ = pm.HalfNormal('σ', 1)
      4     y = pm.Normal('y', μ, σ, observed=Y)
      5     idata = pm.sample(1000, tune=1000, chains=1)

~/Documents/OSVALDO/PyMC/pymc-main/pymc/bart/bart.py in __new__(cls, name, X, Y, m, alpha, k, response, split_prior, **kwargs)
    139         cls.rv_op = bart_op
    140         params = [X, Y, m, alpha, k]
--> 141         return super().__new__(cls, name, *params, **kwargs)
    142 
    143     @classmethod

~/Documents/OSVALDO/PyMC/pymc-main/pymc/distributions/distribution.py in __new__(cls, name, rng, dims, initval, observed, total_size, transform, *args, **kwargs)
    238             rv_out = change_rv_size(rv_var=rv_out, new_size=resize_shape, expand=True)
    239 
--> 240         rv_out = model.register_rv(
    241             rv_out,
    242             name,

~/Documents/OSVALDO/PyMC/pymc-main/pymc/model.py in register_rv(self, rv_var, name, data, total_size, dims, transform, initval)
   1247             self.create_value_var(rv_var, transform)
   1248             self.add_random_variable(rv_var, dims)
-> 1249             self.set_initval(rv_var, initval)
   1250         else:
   1251             if (

~/Documents/OSVALDO/PyMC/pymc-main/pymc/model.py in set_initval(self, rv_var, initval)
    962 
    963         if initval is None or transform:
--> 964             initval = self._eval_initval(rv_var, initval, test_value, transform)
    965 
    966         self.initial_values[rv_value_var] = initval

~/Documents/OSVALDO/PyMC/pymc-main/pymc/model.py in _eval_initval(self, rv_var, initval, test_value, transform)
   1019             self.values_to_rvs[k]: initval_to_rvval(k, v) for k, v in self.initial_values.items()
   1020         }
-> 1021         initval_fn = aesara.function([], rv_var, mode=mode, givens=givens, on_unused_input="ignore")
   1022         try:
   1023             initval = initval_fn()

~/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/compile/function/__init__.py in function(inputs, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input)
    335         # note: pfunc will also call orig_function -- orig_function is
    336         #      a choke point that all compilation must pass through
--> 337         fn = pfunc(
    338             params=inputs,
    339             outputs=outputs,

~/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/compile/function/pfunc.py in pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input, output_keys)
    522         inputs.append(si)
    523 
--> 524     return orig_function(
    525         inputs,
    526         cloned_outputs,

~/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/compile/function/types.py in orig_function(inputs, outputs, mode, accept_inplace, name, profile, on_unused_input, output_keys)
   1982         )
   1983         with config.change_flags(compute_test_value="off"):
-> 1984             fn = m.create(defaults)
   1985     finally:
   1986         t2 = time.time()

~/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/compile/function/types.py in create(self, input_storage, trustme, storage_map)
   1837 
   1838         with config.change_flags(traceback__limit=config.traceback__compile_limit):
-> 1839             _fn, _i, _o = self.linker.make_thunk(
   1840                 input_storage=input_storage_lists, storage_map=storage_map
   1841             )

~/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/basic.py in make_thunk(self, input_storage, output_storage, storage_map, **kwargs)
    280         **kwargs,
    281     ) -> ThunkType:
--> 282         return self.make_all(
    283             input_storage=input_storage,
    284             output_storage=output_storage,

~/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/vm.py in make_all(self, profiler, input_storage, output_storage, storage_map)
   1163             post_thunk_clear = None
   1164 
-> 1165         vm = self.make_vm(
   1166             order,
   1167             thunks,

~/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/vm.py in make_vm(self, nodes, thunks, input_storage, output_storage, storage_map, post_thunk_clear, computed, compute_map, updated_vars)
    868 
    869         try:
--> 870             from aesara.link.c.cvm import CVM
    871         except (MissingGXX, ImportError):
    872             CVM = None

~/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/c/cvm.py in <module>
     11             "lazylinker will not be imported if aesara.config.cxx is not set."
     12         )
---> 13     from aesara.link.c import lazylinker_c
     14 
     15     class CVM(lazylinker_c.CLazyLinker, VM):

~/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/c/lazylinker_c.py in <module>
    135 
    136             args = GCC_compiler.compile_args()
--> 137             GCC_compiler.compile_str(dirname, code, location=loc, preargs=args)
    138             # Save version into the __init__.py file.
    139             init_py = os.path.join(loc, "__init__.py")

~/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/c/cmodule.py in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols)
   2551             # difficult to read.
   2552             # compile_stderr = compile_stderr.replace("\n", ". ")
-> 2553             raise CompileError(
   2554                 f"Compilation failed (return status={status}):\n{' '.join(cmd)}\n{compile_stderr}"
   2555             )

CompileError: Compilation failed (return status=1):
/Users/MacMesser/anaconda3/bin/clang++ -dynamiclib -g -Wno-c++11-narrowing -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/numpy/core/include -I/Users/MacMesser/anaconda3/envs/py39/include/python3.9 -I/Users/MacMesser/anaconda3/envs/py39/lib/python3.9/site-packages/aesara/link/c/c_code -L/Users/MacMesser/anaconda3/envs/py39/lib -fvisibility=hidden -o /Users/MacMesser/.aesara/compiledir_macOS-10.15.7-x86_64-i386-64bit-i386-3.9.5-64/lazylinker_ext/lazylinker_ext.so /Users/MacMesser/.aesara/compiledir_macOS-10.15.7-x86_64-i386-64bit-i386-3.9.5-64/lazylinker_ext/mod.cpp
In file included from /Users/MacMesser/.aesara/compiledir_macOS-10.15.7-x86_64-i386-64bit-i386-3.9.5-64/lazylinker_ext/mod.cpp:1:
In file included from /Users/MacMesser/anaconda3/envs/py39/include/python3.9/Python.h:25:
/Users/MacMesser/anaconda3/bin/../include/c++/v1/stdio.h:107:15: fatal error: 'stdio.h' file not found
#include_next <stdio.h>
              ^~~~~~~~~
1 error generated.

It looks like you are trying to use the current development version of PyMC. Does it run for you in PyMC 3 (i.e. the current stable release)? Aesara is still under heavy development.

If you are really set on running v4, check to make sure your command line tools in macOS are up to date. Then try running some of the PyMC test suite to make sure everything runs as expected. If the error still occurs then, you may have uncovered an Aesara bug, which should be reported to that project.

1 Like

We were finally able to solve the problem by deleting the folders of theano and aesara from the user folder and reinstalling pymc in a new environment. This was the workflow:

# Eliminate the previous environment
conda env remove --name py38

# Delete the folders /Users/USER/.theano/ and /Users/USER/.aesara/
rm -r /Users/USER/.theano/ 
rm -r /Users/USER/.aesara/

# Create and activate new environment
conda create --name py38 python=3.8

source activate py38

# Download pymc and install with pip
pip install -e pymc-main

# Install jupyter
conda install jupyter

Thanks for the help.