I have conda, and mamba installed, as well as Xcode on macOS Ventura 13.2.1 (Intel i7).
I can import pymc and this code shows I have version 4.1.5:
import pymc as pm
print(f"Running on PyMC v{pm.__version__}")
When I try to run the code from the introductory notebook however I get the following error:
ERROR (aesara.graph.opt): Optimization failure due to: constant_folding
ERROR (aesara.graph.opt): node: InplaceDimShuffle{}(TensorConstant{(1,) of 2})
ERROR (aesara.graph.opt): TRACEBACK:
ERROR (aesara.graph.opt): Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aesara/graph/opt.py", line 1861, in process_node
replacements = lopt.transform(fgraph, node)
File "/usr/local/lib/python3.9/site-packages/aesara/graph/opt.py", line 1066, in transform
return self.fn(fgraph, node)
File "/usr/local/lib/python3.9/site-packages/aesara/tensor/basic_opt.py", line 2784, in constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "/usr/local/lib/python3.9/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 "/usr/local/lib/python3.9/site-packages/aesara/link/c/op.py", line 96, in make_c_thunk
outputs = cl.make_thunk(
File "/usr/local/lib/python3.9/site-packages/aesara/link/c/basic.py", line 1198, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
File "/usr/local/lib/python3.9/site-packages/aesara/link/c/basic.py", line 1133, in __compile__
thunk, module = self.cthunk_factory(
File "/usr/local/lib/python3.9/site-packages/aesara/link/c/basic.py", line 1629, in cthunk_factory
module = get_module_cache().module_from_key(key=key, lnk=self)
File "/usr/local/lib/python3.9/site-packages/aesara/link/c/cmodule.py", line 1228, in module_from_key
module = lnk.compile_cmodule(location)
File "/usr/local/lib/python3.9/site-packages/aesara/link/c/basic.py", line 1538, in compile_cmodule
module = c_compiler.compile_str(
File "/usr/local/lib/python3.9/site-packages/aesara/link/c/cmodule.py", line 2639, in compile_str
raise CompileError(
aesara.link.c.exceptions.CompileError: Compilation failed (return status=1):
/Users/tomkealy/mambaforge/envs/pymc_env/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 -m64 -fPIC -undefined dynamic_lookup -I/usr/local/lib/python3.9/site-packages/numpy/core/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -I/usr/local/lib/python3.9/site-packages/aesara/link/c/c_code -L/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib -fvisibility=hidden -o /Users/tomkealy/.aesara/compiledir_macOS-13.2.1-x86_64-i386-64bit-i386-3.9.16-64/tmp2xj7s2yo/mba10987274f369529454d4a60996746c3927712a0b1b3928446a3c275151e2ee.so /Users/tomkealy/.aesara/compiledir_macOS-13.2.1-x86_64-i386-64bit-i386-3.9.16-64/tmp2xj7s2yo/mod.cpp
In file included from /Users/tomkealy/.aesara/compiledir_macOS-13.2.1-x86_64-i386-64bit-i386-3.9.16-64/tmp2xj7s2yo/mod.cpp:1:
In file included from /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9/Python.h:25:
/Users/tomkealy/mambaforge/envs/pymc_env/bin/../include/c++/v1/stdio.h:107:15: fatal error: 'stdio.h' file not found
#include_next <stdio.h>
^~~~~~~~~
1 error generated.
And I have no idea how to fix this.
Code to run the notebook:
import arviz as az
import matplotlib.pyplot as plt
import numpy as np
%config InlineBackend.figure_format = 'retina'
# Initialize random number generator
RANDOM_SEED = 8927
np.random.seed(RANDOM_SEED)
az.style.use("arviz-darkgrid")
# True parameter values
alpha, sigma = 1, 1
beta = [1, 2.5]
# Size of dataset
size = 100
# Predictor variable
X1 = np.random.randn(size)
X2 = np.random.randn(size) * 0.2
# Simulate outcome variable
Y = alpha + beta[0] * X1 + beta[1] * X2 + np.random.randn(size) * sigma
basic_model = pm.Model()
with basic_model:
# Priors for unknown model parameters
alpha = pm.Normal("alpha", mu=0, sigma=10)
beta = pm.Normal("beta", mu=0, sigma=10, shape=2)
sigma = pm.HalfNormal("sigma", sigma=1)
# Expected value of outcome
mu = alpha + beta[0] * X1 + beta[1] * X2
# Likelihood (sampling distribution) of observations
Y_obs = pm.Normal("Y_obs", mu=mu, sigma=sigma, observed=Y)
And I can’t get any further.