Installation Error - VS Tools?

I get the following error when trying to install Pymc3 on windows. I’ve never had this error in past installations

After running the command

conda install -c conda-forge pymc3

I get

(MCMC) C:\Users\Alex\PycharmProjects\MCMC>conda install -c conda-forge pymc3
Collecting package metadata (current_repodata.json): done
Solving environment: done

Package Plan

environment location: C:\Users\Alex\Anaconda3\envs\MCMC

added / updated specs:
- pymc3

The following NEW packages will be INSTALLED:

arviz conda-forge/noarch::arviz-0.7.0-py_0
bzip2 conda-forge/win-64::bzip2-1.0.8-hfa6e2cd_2
cftime conda-forge/win-64::cftime-1.1.1-py37hbc2f12b_0
curl conda-forge/win-64::curl-7.68.0-h4496350_0
cycler conda-forge/noarch::cycler-0.10.0-py_2
freetype conda-forge/win-64::freetype-2.10.0-h563cfd7_1
h5py conda-forge/win-64::h5py-2.10.0-nompi_py37h422b98e_102
hdf4 conda-forge/win-64::hdf4-4.2.13-hf8e6fe8_1003
hdf5 conda-forge/win-64::hdf5-1.10.5-nompi_ha405e13_1104
jpeg conda-forge/win-64::jpeg-9c-hfa6e2cd_1001
kiwisolver conda-forge/win-64::kiwisolver-1.1.0-py37heaa310e_1
krb5 conda-forge/win-64::krb5-1.16.4-hdd46e55_0
libcurl conda-forge/win-64::libcurl-7.68.0-h4496350_0
libgpuarray conda-forge/win-64::libgpuarray-0.7.6-hfa6e2cd_1003
libnetcdf conda-forge/win-64::libnetcdf-4.7.3-nompi_hc957ea6_101
libpng conda-forge/win-64::libpng-1.6.37-h7602738_0
libssh2 conda-forge/win-64::libssh2-1.8.2-h642c060_2
mako conda-forge/noarch::mako-1.1.0-py_0
markupsafe conda-forge/win-64::markupsafe-1.1.1-py37h8055547_1
matplotlib-base conda-forge/win-64::matplotlib-base-3.2.0-py37h2981e6d_1
netcdf4 conda-forge/win-64::netcdf4-1.5.3-nompi_py37h0154fc0_102
packaging conda-forge/noarch::packaging-20.1-py_0
pandas conda-forge/win-64::pandas-1.0.2-py37h9b59f54_0
patsy conda-forge/noarch::patsy-0.5.1-py_0
pygpu conda-forge/win-64::pygpu-0.7.6-py37hc8d92b1_1000
pymc3 conda-forge/noarch::pymc3-3.8-py_0
pyparsing conda-forge/noarch::pyparsing-2.4.6-py_0
pyreadline conda-forge/win-64::pyreadline-2.1-py37_1001
python-dateutil conda-forge/noarch::python-dateutil-2.8.1-py_0
pytz conda-forge/noarch::pytz-2019.3-py_0
theano conda-forge/win-64::theano-1.0.4-py37h6538335_1001
tk conda-forge/win-64::tk-8.6.10-hfa6e2cd_0
tornado conda-forge/win-64::tornado-6.0.4-py37hfa6e2cd_0
tqdm conda-forge/noarch::tqdm-4.43.0-py_0
vs2015_win-64 pkgs/main/win-64::vs2015_win-64-14.0.25420-h55c1224_11
xarray conda-forge/noarch::xarray-0.15.0-py_0
zlib conda-forge/win-64::zlib-1.2.11-h2fa13f4_1006

The following packages will be UPDATED:

certifi pkgs/main::certifi-2019.11.28-py37_0 → conda-forge::certifi-2019.11.28-py37hc8dfbb8_1

The following packages will be SUPERSEDED by a higher-priority channel:

ca-certificates pkgs/main::ca-certificates-2020.1.1-0 → conda-forge::ca-certificates-2019.11.28-hecc5488_0
openssl pkgs/main::openssl-1.1.1e-he774522_0 → conda-forge::openssl-1.1.1d-hfa6e2cd_0

Proceed ([y]/n)?

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

C:\Users\Alex\PycharmProjects\MCMC>SET DISTUTILS_USE_SDK=1

C:\Users\Alex\PycharmProjects\MCMC>SET MSSdk=1

C:\Users\Alex\PycharmProjects\MCMC>SET platform=

C:\Users\Alex\PycharmProjects\MCMC>IF /I [AMD64] == [amd64] set “platform=true”

C:\Users\Alex\PycharmProjects\MCMC>IF /I == [amd64] set “platform=true”

C:\Users\Alex\PycharmProjects\MCMC>if defined platform (set “VSREGKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0” ) ELSE (set “VSREGKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0” )

C:\Users\Alex\PycharmProjects\MCMC>for /F “skip=2 tokens=2,*” %A in (‘reg query “HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0” /v InstallDir’) do SET “VSINSTALLDIR=%B”
ERROR: The system was unable to find the specified registry key or value.

C:\Users\Alex\PycharmProjects\MCMC>if “” == “” (set “VSINSTALLDIR=” )

C:\Users\Alex\PycharmProjects\MCMC>if “” == “” (
ECHO “WARNING: Did not find VS in registry or in VS140COMNTOOLS env var - your compiler may not work”
GOTO End
)
“WARNING: Did not find VS in registry or in VS140COMNTOOLS env var - your compiler may not work”
The system cannot find the batch label specified - End

some more information. I have miniGW installed as detailed in this post. Despite the VS error above, I can still import pymc3, but I get compile errors when now when trying to build a model

You can find the C code in this temporary file: C:\Users\Alex\AppData\Local\Temp\theano_compilation_error_qw3te2c1
Traceback (most recent call last):
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\code.py”, line 91, in runcode
exec(code, self.locals)
File “”, line 44, in
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\pymc3\distributions\distribution.py”, line 47, in new
return model.Var(name, dist, data, total_size)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\pymc3\model.py”, line 952, in Var
total_size=total_size, model=self)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\pymc3\model.py”, line 1488, in init
self.logp_elemwiset = distribution.logp(data)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\pymc3\distributions\continuous.py”, line 519, in logp
sigma > 0)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\tensor\var.py”, line 64, in gt
rval = theano.tensor.basic.gt(self, other)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\op.py”, line 670, in call
no_recycling=)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\op.py”, line 955, in make_thunk
no_recycling)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\op.py”, line 858, in make_c_thunk
output_storage=node_output_storage)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\cc.py”, line 1217, in make_thunk
keep_lock=keep_lock)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\cc.py”, line 1157, in compile
keep_lock=keep_lock)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\cc.py”, line 1624, in cthunk_factory
key=key, lnk=self, keep_lock=keep_lock)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\cmodule.py”, line 1189, in module_from_key
module = lnk.compile_cmodule(location)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\cc.py”, line 1527, in compile_cmodule
preargs=preargs)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\cmodule.py”, line 2411, in compile_str
(status, compile_stderr.replace(‘\n’, '. ')))
Exception: ('Compilation failed (return status=1): C:\Users\Alex\AppData\Local\Temp\ccJHhHnb.s: Assembler messages:\r. C:\Users\Alex\AppData\Local\Temp\ccJHhHnb.s:282: Error: invalid register for .seh_savexmm\r. ', ‘[Elemwise{gt,no_inplace}(<TensorType(float64, vector)>, <TensorType(int8, (True,))>)]’)

Please run this code and tell us the errors you see

import numpy as np
import pymc3 as pm

import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

SEED = 3264602 # from random.org
np.random.seed(SEED)

N = 10000

μ_actual = np.array([1, -2])
Σ_actual = np.array([[0.5, -0.3],
                     [-0.3, 1.]])

x = np.random.multivariate_normal(μ_actual, Σ_actual, size=N)

with pm.Model() as model:
    packed_L = pm.LKJCholeskyCov('packed_L', n=2,
                                 eta=2., sd_dist=pm.HalfCauchy.dist(2.5))

    L = pm.expand_packed_triangular(2, packed_L)
    Σ = pm.Deterministic('Σ', L.dot(L.T))

    μ = pm.Normal('μ', 0., 10., shape=2,
                  testval=x.mean(axis=0))
    obs = pm.MvNormal('obs', μ, chol=L, observed=x)


with model:
    trace = pm.sample(random_seed=SEED, cores=4)


print(pm.summary(trace))

Did you install mingw manually or only from conda? Manual install of mingw is not compatible with python.

Maybe try this workflow (you can skip Stan steps) https://pystan.readthedocs.io/en/latest/windows.html

Thanks for the tip here is what I see when I try to run this. I’ve researched this invalid register error and it appears to be happening for people who use Theano with MiniGW on Xeon chips

You can find the C code in this temporary file: C:\Users\Alex\AppData\Local\Temp\theano_compilation_error_9vub4jmd
Traceback (most recent call last):
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\code.py”, line 90, in runcode
exec(code, self.locals)
File “”, line 3, in
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\pymc3\distributions\distribution.py”, line 47, in new
return model.Var(name, dist, data, total_size)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\pymc3\model.py”, line 929, in Var
model=self)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\pymc3\model.py”, line 1656, in init
transformed_name, transform.apply(distribution), total_size=total_size)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\pymc3\distributions\transforms.py”, line 112, in apply
return TransformedDistribution.dist(dist, self)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\pymc3\distributions\distribution.py”, line 57, in dist
dist.init(*args, **kwargs)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\pymc3\distributions\transforms.py”, line 141, in init
v = forward(FreeRV(name=“v”, distribution=dist))
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\pymc3\model.py”, line 1370, in init
self.logp_elemwiset = distribution.logp(self)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\pymc3\distributions\multivariate.py”, line 1150, in logp
logp_sd = self.sd_dist.logp(sd_vals).sum()
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\pymc3\distributions\continuous.py”, line 2412, in logp
value >= 0, beta > 0)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\tensor\var.py”, line 69, in ge
rval = theano.tensor.basic.ge(self, other)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\op.py”, line 670, in call
no_recycling=)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\op.py”, line 955, in make_thunk
no_recycling)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\op.py”, line 858, in make_c_thunk
output_storage=node_output_storage)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\cc.py”, line 1217, in make_thunk
keep_lock=keep_lock)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\cc.py”, line 1157, in compile
keep_lock=keep_lock)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\cc.py”, line 1624, in cthunk_factory
key=key, lnk=self, keep_lock=keep_lock)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\cmodule.py”, line 1189, in module_from_key
module = lnk.compile_cmodule(location)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\cc.py”, line 1527, in compile_cmodule
preargs=preargs)
File “C:\Users\Alex\Anaconda3\envs\MCMC\lib\site-packages\theano\gof\cmodule.py”, line 2399, in compile_str
(status, compile_stderr.replace(‘\n’, '. ')))
Exception: ('Compilation failed (return status=1): C:\Users\Alex\AppData\Local\Temp\ccpUtpzk.s: Assembler messages:\r. C:\Users\Alex\AppData\Local\Temp\ccpUtpzk.s:282: Error: invalid register for .seh_savexmm\r. ', ‘[Elemwise{ge,no_inplace}(<TensorType(float64, vector)>, <TensorType(int8, (True,))>)]’)

Yes I’ve tried installing m2w64-toolchain through conda but I am getting a compile error. I believe it has to do with the fact I have a Xeon chip, I’ve seen alot of other users run into this invalid register error

Ok, there might be possibility to use clang + libc++

conda install clang-dev libcxx -c conda-forge

Then I think you need to set CC=clang and CXX=clang++, but there is probably something needed so libcxx is used.

Let me give that a shot. Where do I set CC=clang and CXX=clang++ ?

Actually it appears according to this post they fixed the bug in GCC, so I just need to get the released of MiniGW that has the fix…

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65782

Yes that was it! I was able to get it working (almost) using the MSYS2 installer, which installs a newer version of GCC than whats in the conda package. I was able to run your script once I changed cores=4 to cores=1, as I what getting broken pipeline errors with multiprocessing. Thanks for the help!