# Wierd problem installing PYMC

**URL:** <https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984>\
**Category:** v5\
**Tags:** bug\
**Created:** [May 9, 2025, 11:15pm UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984 "2025-05-09T23:15:55Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![DrEntropy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/drentropy/32/4747_2.png) [@DrEntropy](https://discourse.pymc.io/u/DrEntropy)\
**Post date:** [May 9, 2025, 11:15pm UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/1 "2025-05-09T23:15:55Z")

</div>

I was just starting a new project, like I normally do, and tried installing pymc like this:

```auto
conda create -n multinom3 python=3.12 pymc=5.21.0 arviz jupyter -c conda-forge

```

This is on windows 11.  
Note I pinned these versions only in later experiments when I could not get defaults to work either.  
However when I try to run a simple model with this (any model) I get errors:

```auto
import pymc as pm
import numpy as np
import arviz as az

# Generate some fake data
np.random.seed(123)
data = np.random.normal(loc=5.0, scale=2.0, size=100)

with pm.Model() as model:
    mu = pm.Normal("mu", mu=0, sigma=10)
    sigma = pm.HalfNormal("sigma", sigma=10)
    observed = pm.Normal("observed", mu=mu, sigma=sigma, observed=data)
    trace = pm.sample(1000, tune=1000, cores =1)

```

Initializing NUTS using jitter+adapt\_diag…  
ERROR (pytensor.graph.rewriting.basic): Rewrite failure due to: constant\_folding  
ERROR (pytensor.graph.rewriting.basic): node: Cast{float64}(0)  
ERROR (pytensor.graph.rewriting.basic): TRACEBACK:  
ERROR (pytensor.graph.rewriting.basic): Traceback (most recent call last)  
ETC ETC ETC

I tried various things like downgrading numpy but I just cannot get things to work. What is even stranger is that my existing environments I have used for other projects are working just fine using these same version numbers.

I also tried exporting an existing environment and recreating it from that (with everything pinned) and that _does_ work. I am mystified.

Comparing exported environments, maybe this difference is what matters?

older working environment:

```auto
 - vc=14.3=hbf610ac_24
 - vc14_runtime=14.42.34438=hfd919c2_24
 - vs2015_runtime=14.42.34438=h7142326_24

```

vs in broken environment

```auto
  - vc=14.3=h2b53caa_26
  - vc14_runtime=14.42.34438=hfd919c2_26
  - vs2015_runtime=14.42.34438=h7142326_26

```

I.e. the 24 vs the 26? I am just grasping at straws here though. Anyone else run into something like this?

---

<div class="post-metadata">

**Author:** ![jessegrabowski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jessegrabowski/32/5010_2.png) [@jessegrabowski](https://discourse.pymc.io/u/jessegrabowski)\
**Post date:** [May 10, 2025, 12:03am UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/2 "2025-05-10T00:03:37Z")

</div>

Can you post versions for pymc and pytensor? (or just confirm they are both the latest releases as shown on the github page)

Edit: Just noticed you’re version pinning pymc – is that necessary? You might need an associated pin on pytensor.

---

<div class="post-metadata">

**Author:** ![DrEntropy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/drentropy/32/4747_2.png) [@DrEntropy](https://discourse.pymc.io/u/DrEntropy)\
**Post date:** [May 10, 2025, 12:11am UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/3 "2025-05-10T00:11:36Z")

</div>

The pins are not necessary, I was just ‘trying things’ to get it to work. Pytensor version was 2.28.2 (I also tried 2.28.3)

---

<div class="post-metadata">

**Author:** ![DrEntropy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/drentropy/32/4747_2.png) [@DrEntropy](https://discourse.pymc.io/u/DrEntropy)\
**Post date:** [May 10, 2025, 12:12am UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/4 "2025-05-10T00:12:53Z")

</div>

Just to clarify I also tried to create a fresh environment following the instructions on the pymc website and got the same errors. (with default versions for all) . I tried many things lol, and one thing I found that definitely worked is switching over to my MacBook for the time being 😉

---

<div class="post-metadata">

**Author:** ![jessegrabowski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jessegrabowski/32/5010_2.png) [@jessegrabowski](https://discourse.pymc.io/u/jessegrabowski)\
**Post date:** [May 10, 2025, 12:17am UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/5 "2025-05-10T00:17:19Z")

</div>

By the way, I don’t think those differences you posted should be the determining factor. Those look like C++ runtimes, but your error is happening at the pytensor level, before the logp function is compiled.

---

<div class="post-metadata">

**Author:** ![DrEntropy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/drentropy/32/4747_2.png) [@DrEntropy](https://discourse.pymc.io/u/DrEntropy)\
**Post date:** [May 10, 2025, 12:42am UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/6 "2025-05-10T00:42:00Z")

</div>

Ok thanks! Here is more of the error message if it helps:

```auto
Initializing NUTS using jitter+adapt_diag...
ERROR (pytensor.graph.rewriting.basic): Rewrite failure due to: constant_folding
ERROR (pytensor.graph.rewriting.basic): node: Cast{float64}(0)
ERROR (pytensor.graph.rewriting.basic): TRACEBACK:
ERROR (pytensor.graph.rewriting.basic): Traceback (most recent call last):
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1922, in process_node
    replacements = node_rewriter.transform(fgraph, node)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
    return self.fn(fgraph, node)
           ^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1173, in constant_folding
    return unconditional_constant_folding.transform(fgraph, node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\graph\rewriting\basic.py", line 1086, in transform
    return self.fn(fgraph, node)
           ^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\tensor\rewriting\basic.py", line 1122, in unconditional_constant_folding
    thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\link\c\op.py", line 119, in make_thunk
    return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\link\c\op.py", line 84, in make_c_thunk
    outputs = cl.make_thunk(
              ^^^^^^^^^^^^^^
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\link\c\basic.py", line 1185, in make_thunk
    cthunk, module, in_storage, out_storage, error_storage = self. __compile__ (
                                                             ^^^^^^^^^^^^^^^^^
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\link\c\basic.py", line 1102, in __compile__
    thunk, module = self.cthunk_factory(
                    ^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\link\c\basic.py", line 1626, in cthunk_factory
    module = cache.module_from_key(key=key, lnk=self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\link\c\cmodule.py", line 1250, in module_from_key
    module = lnk.compile_cmodule(location)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\link\c\basic.py", line 1527, in compile_cmodule
    module = c_compiler.compile_str(
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\link\c\cmodule.py", line 2688, in compile_str
    return dlimport(lib_filename)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\rjljr\miniconda3\envs\multinom\Lib\site-packages\pytensor\link\c\cmodule.py", line 346, in dlimport
    rval = __import__ (module_name, {}, {}, [module_name])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: DLL load failed while importing m300014ab234446dc184b72b5e07d4663d2813454bb33582d49f5e173c77f73aa: The specified procedure could not be found.

```

This repeats over and over for with a different (hash?) string for the 'specified procedure` and different ops.

---

<div class="post-metadata">

**Author:** ![DrEntropy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/drentropy/32/4747_2.png) [@DrEntropy](https://discourse.pymc.io/u/DrEntropy)\
**Post date:** [May 10, 2025, 12:42am UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/7 "2025-05-10T00:42:29Z")

</div>

If there are other tests you can think of that i could try, I would appreciate it!

---

<div class="post-metadata">

**Author:** ![jessegrabowski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/jessegrabowski/32/5010_2.png) [@jessegrabowski](https://discourse.pymc.io/u/jessegrabowski)\
**Post date:** [May 10, 2025, 1:10am UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/8 "2025-05-10T01:10:22Z")

</div>

Well now I do think those differences could be relevant. Just to rule it out, could you clear your pytensor cache (`pytensor-cache clear` )

---

<div class="post-metadata">

**Author:** ![DrEntropy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/drentropy/32/4747_2.png) [@DrEntropy](https://discourse.pymc.io/u/DrEntropy)\
**Post date:** [May 10, 2025, 1:44am UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/9 "2025-05-10T01:44:09Z")

</div>

Ok tried that, still same errors. also did purge just to be sure.

---

<div class="post-metadata">

**Author:** ![ricardoV94](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ricardov94/32/5775_2.png) [@ricardoV94](https://discourse.pymc.io/u/ricardoV94)\
**Post date:** [May 10, 2025, 12:41pm UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/10 "2025-05-10T12:41:20Z")

</div>

The compiler / path machinery is failing, may be a general incompatibility with a recent version of windows 11? Don’t know if other folks out there have succeeded installing PyMC on recent Windows 11.

Perhaps @michaelosthege ?

---

<div class="post-metadata">

**Author:** ![ricardoV94](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ricardov94/32/5775_2.png) [@ricardoV94](https://discourse.pymc.io/u/ricardoV94)\
**Post date:** [May 10, 2025, 12:44pm UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/11 "2025-05-10T12:44:05Z")

</div>

In the meantime you can try to avoid the C backend. Set `pytensor.config.cxx=""` and for sampling with PyMC use the numba backend by passing `compile_kwargs={mode:"NUMBA"}` or use the nutpie sampler which also defaults to numba.

---

<div class="post-metadata">

**Author:** ![DrEntropy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/drentropy/32/4747_2.png) [@DrEntropy](https://discourse.pymc.io/u/DrEntropy)\
**Post date:** [May 10, 2025, 3:26pm UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/12 "2025-05-10T15:26:34Z")

</div>

> [@ricardoV94](#):
>
> pytensor.config.cxx=“”

Thanks this workaround (and using nutpie) works great!  
Today I will try to find time to find the minimal diff between my working and not working environments and report back 🙂

---

<div class="post-metadata">

**Author:** ![DrEntropy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/drentropy/32/4747_2.png) [@DrEntropy](https://discourse.pymc.io/u/DrEntropy)\
**Post date:** [May 10, 2025, 5:17pm UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/13 "2025-05-10T17:17:01Z")

</div>

Comparing conda exports from working and not working environments, I found that pinning libgcc to an earlier version fixes it:

This envirnoment works:

```auto
name: working_env
channels:
  - conda-forge
  - defaults
dependencies:
  - python = 3.12
  - scikit-learn
  - pandas
  - numpy
  - matplotlib
  - pytensor=2.28.2
  - pymc = 5.21
  - arviz = 0.21
  - jupyter
  - pip
  - libgcc=14.2.0=h1383e82_2

```

This one doesn’t (same as above except remove the -libgcc pin:

```auto
name: broken_env
channels:
  - conda-forge
  - defaults
dependencies:
  - python = 3.12
  - scikit-learn
  - pandas
  - numpy
  - matplotlib
  - pytensor=2.28.2
  - pymc = 5.21
  - arviz = 0.21
  - jupyter
  - pip

```

In this version, libgcc is 15.1.0

The other pinned versions may not matter, I just have not had a chance to test that (building and destroying conda environments is a bit time consuming !)

---

<div class="post-metadata">

**Author:** ![ricardoV94](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ricardov94/32/5775_2.png) [@ricardoV94](https://discourse.pymc.io/u/ricardoV94)\
**Post date:** [May 10, 2025, 5:25pm UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/14 "2025-05-10T17:25:44Z")

</div>

CC @maresb

---

<div class="post-metadata">

**Author:** ![DrEntropy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/drentropy/32/4747_2.png) [@DrEntropy](https://discourse.pymc.io/u/DrEntropy)\
**Post date:** [May 10, 2025, 5:43pm UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/15 "2025-05-10T17:43:24Z")

</div>

> [@DrEntropy](#):
>
> The other pinned versions may not matter, I just have not had a chance to test that (building and destroying conda environments is a bit time consuming !)

I did test removing all the pins, and it is enough to just add -libgcc=14.2 to get things to work with no other pinning.

---

<div class="post-metadata">

**Author:** ![maresb](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@maresb](https://discourse.pymc.io/u/maresb)\
**Post date:** [May 10, 2025, 6:43pm UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/16 "2025-05-10T18:43:32Z")

</div>

Thanks @DrEntropy for the diagnosis!

Note that libgcc 15 came out 3 days ago on conda-forge: [Files | Anaconda.org](https://anaconda.org/conda-forge/libgcc/files)

I’m not sure what we need to do to stabilize this, or if we’ll have this problem on other platforms? Do we need to pin `libgcc<15` for everyone before we release a new version? Also, I thought gcc was supposed to be forwards-compatible.

---

<div class="post-metadata">

**Author:** ![maresb](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@maresb](https://discourse.pymc.io/u/maresb)\
**Post date:** [May 12, 2025, 5:54pm UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/17 "2025-05-12T17:54:04Z")

</div>

Tracking this in GitHub in [Pytensor finds wrong compiler on windows when `libgcc\>15` is installed · Issue #1398 · pymc-devs/pytensor · GitHub](https://github.com/pymc-devs/pytensor/issues/1398)

---

<div class="post-metadata">

**Author:** ![DrEntropy](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/drentropy/32/4747_2.png) [@DrEntropy](https://discourse.pymc.io/u/DrEntropy)\
**Post date:** [May 13, 2025, 7:24pm UTC](https://discourse.pymc.io/t/wierd-problem-installing-pymc/16984/18 "2025-05-13T19:24:51Z")

</div>

Thanks, for anyone else reading this, it was fixed with [Remove iostream include for C backend by maresb · Pull Request #1400 · pymc-devs/pytensor](https://github.com/pymc-devs/pytensor/pull/1400) . Thanks @maresb !
