Pymc3 linker error

Hi all,
I have been using pymc3 for about a year. A few months ago I changed from an intel mac to an M1 mac. Suddenly, I can’t use pymc3 anymore. I keep getting the following error that I have no idea how to interpret:

You can find the C code in this temporary file: /var/folders/dx/7qsz_y4j3hzcbm5wnqnr8kdr0000gn/T/theano_compilation_error_1ef8ki88

Exception Traceback (most recent call last)
3 # Priors for unknown model parameters
----> 4 beta1 = pm.Normal(“beta1”, mu=4, sigma=1)
5 beta2 = pm.Normal(“beta2”, mu=9.8, sigma=1)
6 sigma = pm.HalfNormal(“sigma”, sigma=1)

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/pymc3/distributions/ in new(cls, name, *args, **kwargs)
119 dist = cls.dist(*args, **kwargs, shape=shape)
120 else:
→ 121 dist = cls.dist(*args, **kwargs)
122 return model.Var(name, dist, data, total_size, dims=dims)

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/pymc3/distributions/ in dist(cls, *args, **kwargs)
128 def dist(cls, *args, **kwargs):
129 dist =
→ 130 dist.init(*args, **kwargs)
131 return dist

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/pymc3/distributions/ in init(self, mu, sigma, tau, sd, **kwargs)
487 self.mean = self.median = self.mode = = mu = tt.as_tensor_variable(floatX(mu))
→ 488 self.variance = 1.0 / self.tau
490 assert_negative_support(sigma, “sigma”, “Normal”)

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/theano/tensor/ in rtruediv(self, other)
175 def rtruediv(self, other):
→ 176 return theano.tensor.basic.true_div(other, self)
178 def rfloordiv(self, other):

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/theano/graph/ in call(self, *inputs, **kwargs)
252 if config.compute_test_value != “off”:
→ 253 compute_test_value(node)
255 if self.default_output is not None:

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/theano/graph/ in compute_test_value(node)
125 # Create a thunk that performs the computation
→ 126 thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
127 thunk.inputs = [storage_map[v] for v in node.inputs]
128 thunk.outputs = [storage_map[v] for v in node.outputs]

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/theano/graph/ in make_thunk(self, node, storage_map, compute_map, no_recycling, impl)
632 )
633 try:
→ 634 return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
635 except (NotImplementedError, MethodNotDefined):
636 # We requested the c code, so don’t catch the error.

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/theano/graph/ in make_c_thunk(self, node, storage_map, compute_map, no_recycling)
598 print(f"Disabling C code for {self} due to unsupported float16")
599 raise NotImplementedError(“float16”)
→ 600 outputs = cl.make_thunk(
601 input_storage=node_input_storage, output_storage=node_output_storage
602 )

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/theano/link/c/ in make_thunk(self, input_storage, output_storage, storage_map)
1201 “”"
1202 init_tasks, tasks = self.get_init_tasks()
→ 1203 cthunk, module, in_storage, out_storage, error_storage = self.compile(
1204 input_storage, output_storage, storage_map
1205 )

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/theano/link/c/ in compile(self, input_storage, output_storage, storage_map)
1136 input_storage = tuple(input_storage)
1137 output_storage = tuple(output_storage)
→ 1138 thunk, module = self.cthunk_factory(
1139 error_storage,
1140 input_storage,

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/theano/link/c/ in cthunk_factory(self, error_storage, in_storage, out_storage, storage_map)
1632 for node in self.node_order:
1633 node.op.prepare_node(node, storage_map, None, “c”)
→ 1634 module = get_module_cache().module_from_key(key=key, lnk=self)
1636 vars = self.inputs + self.outputs + self.orphans

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/theano/link/c/ in module_from_key(self, key, lnk)
1189 try:
1190 location = dlimport_workdir(self.dirname)
→ 1191 module = lnk.compile_cmodule(location)
1192 name = module.file
1193 assert name.startswith(location)

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/theano/link/c/ in compile_cmodule(self, location)
1541 try:
1542 _logger.debug(f"LOCATION {location}")
→ 1543 module = c_compiler.compile_str(
1544 module_name=mod.code_hash,
1545 src_code=src_code,

~/opt/anaconda3/envs/cmpinf2120/lib/python3.9/site-packages/theano/link/c/ in compile_str(module_name, src_code, location, include_dirs, lib_dirs, libs, preargs, py_module, hide_symbols)
2544 # difficult to read.
2545 compile_stderr = compile_stderr.replace("\n", ". “)
→ 2546 raise Exception(
2547 f"Compilation failed (return status={status}): {compile_stderr}”
2548 )

Exception: ("Compilation failed (return status=1): ld: unsupported tapi file type ‘!tapi-tbd’ in YAML file ‘/Applications/’ 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}))’)

I created an anaconda environment with pymc3 using the exact directions instructed for M1 macs. I have the latest version of xcode installed. I am on the latest version of MacOS monterrey.

Please let me know if you need any more information about my anaconda version, my python version, my gcc/clang version, etc.

If anyone can help me, I cannot begin to tell you how much this would be appreciated. I am really really worried.

I apologize if this is a really stupid question as well or if I haven’t provided enough help. I am just really anxious about this, please help me!


1 Like

This issue seems related?

Yes, looks like the same error. PyMC3 was working for me a month ago and then it just stopped and looked like that.

Do you know if v4 developed on/for the M4 macs with monterrey?

Alternately, is there any way to check that my gcc/clang version are correct and functional?

I would post to that issue and a) let everyone know you are experiencing the same problem and b) ask about your configuration/installation. You can also try out the v4 beta that has been released.

Looks like things were resolved, yes? Moving to PyMC v4 took care of your problem?

Yes it did! Thanks for pointing me to that thread!

Installing v4 from source worked, but so did installing pymc (as opposed to pymc3) from conda-forge.

I’ll still be coming to office hours on Friday for some smaller questions. But my massive ball of stress is gone!

1 Like