Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
629 views
in Technique[技术] by (71.8m points)

theano - PyMC3 fails to execute on MacOS Big Sur/ PyCharm

I am attempting to run some simple PyMC3 code in PyCharm on MacOS Big Sur but the execution fails and throws the following error:

Exception: ('Compilation failed (return status=1): ld: library not found for -lSystem. clang-10: error: linker command failed with exit code 1 (use -v to see invocation). ', '[Elemwise{add,no_inplace}(TensorConstant{1.0}, TensorConstant{1.0})]')

I am using PyCharm 2020.3.2. I am able to install pymc3 (version 3.8) and theano (1.0.4) into the environment. Code I am attempting to run follows:

import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
import pymc3 as pm

np.random.seed(123)
n_experiments = 4
theta_real = 0.35
data = stats.bernoulli.rvs(p=theta_real, size=n_experiments)

with pm.Model() as our_first_model:
    theta = pm.Beta('theta', alpha=1, beta=1)
    y = pm.Bernoulli('y', p=theta, observed=data)
    start = pm.find_MAP()
    step = pm.Metropolis()
    trace = pm.sample(1000, step=step, start=start)
    burnin = 100
    chain = trace[burnin:]
    pm.traceplot(chain, lines={'theta':theta_real});

I disabled Apple System Integrity Protection on some speculation that maybe Apple hiding /usr/include might be the source of the problem; it made no difference. No clue how else to fix this.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

From the information in comments it seems like your anaconda is broken. Update anaconda and try again.

If that doesn't work, try to install PyMC3 in the system Python not the Anaconda one. This will use the system clang and not the Anaconda clang.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...