Installation issues v5.9 macOS

Hi all,

I am having installation issues on macOS Sonoma (macbook pro m2) with the latest version of pymc (v5.9).

From a fresh conda environment created with:

conda create -c conda-forge -n pymc_env "pymc>=5"
conda activate pymc_env

As soon as I import pymc I get:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/marco.forgione/anaconda3/envs/bda/lib/python3.11/site-packages/pymc/", line 47, in <module>
  File "/Users/marco.forgione/anaconda3/envs/bda/lib/python3.11/site-packages/pymc/", line 30, in __set_compiler_flags
    import pytensor
  File "/Users/marco.forgione/anaconda3/envs/bda/lib/python3.11/site-packages/pytensor/", line 119, in <module>
    from pytensor import scalar, tensor
  File "/Users/marco.forgione/anaconda3/envs/bda/lib/python3.11/site-packages/pytensor/tensor/", line 105, in <module>
    from pytensor.tensor import sharedvar  # noqa
  File "/Users/marco.forgione/anaconda3/envs/bda/lib/python3.11/site-packages/pytensor/tensor/", line 8, in <module>
    from pytensor.tensor.type import TensorType
  File "/Users/marco.forgione/anaconda3/envs/bda/lib/python3.11/site-packages/pytensor/tensor/", line 746, in <module>
AttributeError: partially initialized module 'pytensor' has no attribute 'compile' (most likely due to a circular import)

I othewise installed the package successfully on a x86 linux machine. Also, I previously had installed pymc v5.7.2 on my macbook with the same procedure and it used to work.

Are you installing x86 (with MKL et al) or Apple Silicon (with Accelerate et al) ?

Not sure I get your question. I installed on a Macbook Pro M2, thus Silicon architecture and I got the error. I also installed on a x86 linux machine and everything was fine there.

In both cases, I created a fresh conda environment with the command

conda create -c conda-forge -n pymc_env "pymc>=5"

as per the official documentation on the pymc website.

You can try with accelerate (Performance tip if you're on ARM64 (Apple's M1/M2 chips): Install accelerate):

conda create -c conda-forge -n pymc_env "pymc>=5" "libblas=*=*accelerate"

Yep, just curious in case (like me) you’re stubbornly persisting with x86 :smiley:

Well worth using ARM and explicitly requiring accelerate - as Thomas suggests

Works on my macbook silicon, thanks!

1 Like

I don’t have any specific requirements; I just use PyMC for teaching Bayesian data analysis to undergrads and try to ensure that we don’t spend the first lecture troubleshooting installation issues across all platforms. :wink:

1 Like

Can you mark my reply as the answer so that others can see that it’s solved?