Error in installing pymc3 on Windows10

I’m attempting to install the latest pymc3 version on a new computer (running Windows10) using conda, and it seems a lot more difficult than on a linux machine. I created a new environment:

conda create --name pymc3_env

After activating the environment, I ran the standard installation line:

conda install -c conda-forge pymc3

After the installation completed, to test the install I launched python, imported pymc3, and ran a test model, which produced the following error:

(pymc3_env) C:\Users\Jacob>python
Python 3.9.2 | packaged by conda-forge | (default, Feb 21 2021, 04:59:43) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymc3 as pm
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
>>> with pm.Model() as m:
...     a = pm.Uniform('a', lower=1, upper=10)
...     samps = pm.sample(100)
...

 You can find the C code in this temporary file: C:\Users\Jacob\AppData\Local\Temp\theano_compilation_error_n3urv09_
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\pymc3\distributions\distribution.py", line 121, in __new__
    dist = cls.dist(*args, **kwargs)
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\pymc3\distributions\distribution.py", line 130, in dist
    dist.__init__(*args, **kwargs)
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\pymc3\distributions\continuous.py", line 228, in __init__
    self.mean = (upper + lower) / 2.0
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\theano\tensor\var.py", line 101, in __add__
    return theano.tensor.basic.add(self, other)
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\theano\graph\op.py", line 253, in __call__
    compute_test_value(node)
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\theano\graph\op.py", line 126, in compute_test_value
    thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\theano\graph\op.py", line 634, in make_thunk
    return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\theano\graph\op.py", line 600, in make_c_thunk
    outputs = cl.make_thunk(
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\theano\link\c\basic.py", line 1203, in make_thunk
    cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\theano\link\c\basic.py", line 1138, in __compile__
    thunk, module = self.cthunk_factory(
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\theano\link\c\basic.py", line 1634, in cthunk_factory
    module = get_module_cache().module_from_key(key=key, lnk=self)
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\theano\link\c\cmodule.py", line 1191, in module_from_key
    module = lnk.compile_cmodule(location)
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\theano\link\c\basic.py", line 1543, in compile_cmodule
    module = c_compiler.compile_str(
  File "C:\Users\Jacob\miniconda3\envs\pymc3_env\lib\site-packages\theano\link\c\cmodule.py", line 2546, in compile_str
    raise Exception(
Exception: ('Compilation failed (return status=1): C:\\Users\\Jacob\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.19041-SP0-Intel64_Family_6_Model_61_Stepping_4_GenuineIntel-3.9.2-64\\tmptp4jf1fd\\mod.cpp:2:20: fatal error: iostream: No such file or directory\r. compilation terminated.\r. ', 'FunctionGraph(Elemwise{add,no_inplace}(TensorConstant{10.0}, TensorConstant{1.0}))')

So it appears to be some C/Theano issue. It seem to be in the same realm as these earlier posts (Install PyMC3 and Theano Windows 10), however I’ve tried all the suggestions in that thread and none of them solved the problem. I’m wondering does this have to do with the change from theano to theano-pymc? Is there a clear process for installing pymc3 on Windows 10?

Can you try following the install instructions for Windows that we have on our wiki? Let us know if it still does not work

1 Like

It looks like you ended up with theano instead of theano-pymc.

Which pymc3 version did conda install for you? The latest version is 3.11.1 and it pins on theano-pymc ==1.1.2, also in the conda-forge recipe: pymc3-feedstock/meta.yaml at master · conda-forge/pymc3-feedstock · GitHub
I don’t know why conda did not respect that in your case.

The Windows instructions in the Wiki that Chris linked should work! Please let me know if the don’t.

Yep, worked like a charm! Not sure how I missed that install guide on the wiki. Thanks for the help @fonnesbeck @michaelosthege.

Hi, I am facing a compilation problem when running pymc3 code in pycharm. I have seen other posts addressing this issue (https://youtrack.jetbrains.com/issue/PY-49742) but nothing that has been suggested solves it, at least for me. Any chance someone here has any ideas?