Got the Error while running the example about MvNormal

I don’t understand why such a simple example would go wrong.Help~~~~

mu = np.zeros(3)
true_cov = np.array([[1.0, 0.5, 0.1],
                     [0.5, 2.0, 0.2],
                     [0.1, 0.2, 1.0]])
data = np.random.multivariate_normal(mu, true_cov, 10)
with pm.Model() as model_allcate:
    sd_dist = pm.HalfCauchy.dist(beta=2.5, shape=3)
    chol_packed = pm.LKJCholeskyCov('chol_packed', n=3, eta=2, sd_dist=sd_dist)
    chol = pm.expand_packed_triangular(3, chol_packed)
    vals = pm.MvNormal('vals', mu=mu, chol=chol, observed=data)
     trace=pm.sample(1)
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\subtensor.py:2197: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  rval = inputs[0].__getitem__(inputs[1:])
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\subtensor.py:2339: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  out[0][inputs[2:]] = inputs[1]
Only 1 samples in chain.
Auto-assigning NUTS sampler...
Initializing NUTS using jitter+adapt_diag...
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\basic.py:6592: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  result[diagonal_slice] = x
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\subtensor.py:2339: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  out[0][inputs[2:]] = inputs[1]
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\subtensor.py:2197: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  rval = inputs[0].__getitem__(inputs[1:])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in compile_args(self)
    965                 try:
--> 966                     ret += x.c_compile_args(c_compiler)
    967                 except TypeError:

TypeError: c_compile_args() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

AssertionError                            Traceback (most recent call last)
E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\blas.py in _ldflags(ldflags_str, libs, flags, libs_dir, include_dir)
    443             t0, t1, t2 = t[0:3]
--> 444             assert t0 == '-'
    445         except Exception:

AssertionError: 

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-930-88f9299b1080> in <module>
     10     vals = pm.MvNormal('vals', mu=mu, chol=chol, observed=data)
     11 
---> 12     pm.sample(1)

E:\ProgramData\Anaconda3\lib\site-packages\pymc3\sampling.py in sample(draws, step, init, n_init, start, trace, chain_idx, chains, cores, tune, nuts_kwargs, step_kwargs, progressbar, model, random_seed, live_plot, discard_tuned_samples, live_plot_kwargs, compute_convergence_checks, use_mmap, **kwargs)
    393                 start_, step = init_nuts(init=init, chains=chains, n_init=n_init,
    394                                          model=model, random_seed=random_seed,
--> 395                                          progressbar=progressbar, **args)
    396                 if start is None:
    397                     start = start_

E:\ProgramData\Anaconda3\lib\site-packages\pymc3\sampling.py in init_nuts(init, chains, n_init, model, random_seed, progressbar, **kwargs)
   1513             'Unknown initializer: {}.'.format(init))
   1514 
-> 1515     step = pm.NUTS(potential=potential, model=model, **kwargs)
   1516 
   1517     return start, step

E:\ProgramData\Anaconda3\lib\site-packages\pymc3\step_methods\hmc\nuts.py in __init__(self, vars, max_treedepth, early_max_treedepth, **kwargs)
    152         `pm.sample` to the desired number of tuning steps.
    153         """
--> 154         super(NUTS, self).__init__(vars, **kwargs)
    155 
    156         self.max_treedepth = max_treedepth

E:\ProgramData\Anaconda3\lib\site-packages\pymc3\step_methods\hmc\base_hmc.py in __init__(self, vars, scaling, step_scale, is_cov, model, blocked, potential, integrator, dtype, Emax, target_accept, gamma, k, t0, adapt_step_size, step_rand, **theano_kwargs)
     73 
     74         super(BaseHMC, self).__init__(
---> 75             vars, blocked=blocked, model=model, dtype=dtype, **theano_kwargs
     76         )
     77 

E:\ProgramData\Anaconda3\lib\site-packages\pymc3\step_methods\arraystep.py in __init__(self, vars, model, blocked, dtype, **theano_kwargs)
    226 
    227         func = model.logp_dlogp_function(
--> 228             vars, dtype=dtype, **theano_kwargs)
    229 
    230         # handle edge case discovered in #2948

E:\ProgramData\Anaconda3\lib\site-packages\pymc3\model.py in logp_dlogp_function(self, grad_vars, **kwargs)
    708         varnames = [var.name for var in grad_vars]
    709         extra_vars = [var for var in self.free_RVs if var.name not in varnames]
--> 710         return ValueGradFunction(self.logpt, grad_vars, extra_vars, **kwargs)
    711 
    712     @property

E:\ProgramData\Anaconda3\lib\site-packages\pymc3\model.py in __init__(self, cost, grad_vars, extra_vars, dtype, casting, **kwargs)
    447 
    448         self._theano_function = theano.function(
--> 449             inputs, [self._cost_joined, grad], givens=givens, **kwargs)
    450 
    451     def set_extra_values(self, extra_vars):

E:\ProgramData\Anaconda3\lib\site-packages\theano\compile\function.py in function(inputs, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input)
    315                    on_unused_input=on_unused_input,
    316                    profile=profile,
--> 317                    output_keys=output_keys)
    318     return fn

E:\ProgramData\Anaconda3\lib\site-packages\theano\compile\pfunc.py in pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input, output_keys)
    484                          accept_inplace=accept_inplace, name=name,
    485                          profile=profile, on_unused_input=on_unused_input,
--> 486                          output_keys=output_keys)
    487 
    488 

E:\ProgramData\Anaconda3\lib\site-packages\theano\compile\function_module.py in orig_function(inputs, outputs, mode, accept_inplace, name, profile, on_unused_input, output_keys)
   1839                   name=name)
   1840         with theano.change_flags(compute_test_value="off"):
-> 1841             fn = m.create(defaults)
   1842     finally:
   1843         t2 = time.time()

E:\ProgramData\Anaconda3\lib\site-packages\theano\compile\function_module.py in create(self, input_storage, trustme, storage_map)
   1713             theano.config.traceback.limit = theano.config.traceback.compile_limit
   1714             _fn, _i, _o = self.linker.make_thunk(
-> 1715                 input_storage=input_storage_lists, storage_map=storage_map)
   1716         finally:
   1717             theano.config.traceback.limit = limit_orig

E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\link.py in make_thunk(self, input_storage, output_storage, storage_map)
    697         return self.make_all(input_storage=input_storage,
    698                              output_storage=output_storage,
--> 699                              storage_map=storage_map)[:3]
    700 
    701     def make_all(self, input_storage, output_storage):

E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\vm.py in make_all(self, profiler, input_storage, output_storage, storage_map)
   1089                                                  compute_map,
   1090                                                  [],
-> 1091                                                  impl=impl))
   1092                 linker_make_thunk_time[node] = time.time() - thunk_start
   1093                 if not hasattr(thunks[-1], 'lazy'):

E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\op.py in make_thunk(self, node, storage_map, compute_map, no_recycling, impl)
    953             try:
    954                 return self.make_c_thunk(node, storage_map, compute_map,
--> 955                                          no_recycling)
    956             except (NotImplementedError, utils.MethodNotDefined):
    957                 # We requested the c code, so don't catch the error.

E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\op.py in make_c_thunk(self, node, storage_map, compute_map, no_recycling)
    856         _logger.debug('Trying CLinker.make_thunk')
    857         outputs = cl.make_thunk(input_storage=node_input_storage,
--> 858                                 output_storage=node_output_storage)
    859         thunk, node_input_filters, node_output_filters = outputs
    860 

E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in make_thunk(self, input_storage, output_storage, storage_map, keep_lock)
   1215         cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
   1216             input_storage, output_storage, storage_map,
-> 1217             keep_lock=keep_lock)
   1218 
   1219         res = _CThunk(cthunk, init_tasks, tasks, error_storage, module)

E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in __compile__(self, input_storage, output_storage, storage_map, keep_lock)
   1155                                             output_storage,
   1156                                             storage_map,
-> 1157                                             keep_lock=keep_lock)
   1158         return (thunk,
   1159                 module,

E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in cthunk_factory(self, error_storage, in_storage, out_storage, storage_map, keep_lock)
   1607         """
   1608         try:
-> 1609             key = self.cmodule_key()
   1610         except KeyError:
   1611             key = None

E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in cmodule_key(self)
   1295         """
   1296         return self.cmodule_key_(self.fgraph, self.no_recycling,
-> 1297                                  compile_args=self.compile_args(),
   1298                                  libraries=self.libraries(),
   1299                                  header_dirs=self.header_dirs(),

E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\cc.py in compile_args(self)
    966                     ret += x.c_compile_args(c_compiler)
    967                 except TypeError:
--> 968                     ret += x.c_compile_args()
    969             except utils.MethodNotDefined:
    970                 pass

E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\blas.py in c_compile_args(self)
    500 
    501     def c_compile_args(self):
--> 502         return ldflags(libs=False, flags=True)
    503 
    504     def c_lib_dirs(self):

E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\blas.py in ldflags(libs, flags, libs_dir, include_dir)
    387                     flags=flags,
    388                     libs_dir=libs_dir,
--> 389                     include_dir=include_dir)
    390 
    391 

E:\ProgramData\Anaconda3\lib\site-packages\theano\gof\utils.py in rval(*args, **kwargs)
    257         key = (args, kwtup)
    258         if key not in cache:
--> 259             val = f(*args, **kwargs)
    260             cache[key] = val
    261         else:

E:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\blas.py in _ldflags(ldflags_str, libs, flags, libs_dir, include_dir)
    445         except Exception:
    446             raise ValueError('invalid token "%s" in ldflags_str: "%s"'
--> 447                              % (t, ldflags_str))
    448         if libs_dir and t1 == 'L':
    449             rval.append(t[2:])

ValueError: ('The following error happened while compiling the node', Dot22Scalar(Solve{A_structure='upper_triangular', lower=True, overwrite_A=False, overwrite_b=False}.0, InplaceDimShuffle{1,0}.0, TensorConstant{-1.0}), '\n', 'invalid token "lblas" in ldflags_str: "lblas"')

Do you get any warning when you import theano or pymc3?

Thank you for your reply. there is no errors or warnings when I import theano and pymc3 . Other examples work well except for this MvNormal module. After reading your reply, I even restarted my computer, and the result was the same. I have tried another computer, but also got the same error.

when I run theano.test(), there are many errors. is that the reason i cannot use the MvNormal?

Theano version 1.0.3
theano is installed in D:\ProgramData\Anaconda3\lib\site-packages\theano
NumPy version 1.15.4
NumPy relaxed strides checking option: True
NumPy is installed in D:\ProgramData\Anaconda3\lib\site-packages\numpy
Python version 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)]
nose version 1.3.7
EE.EEEE.EE…EEEEE.E.EEEEEE…EE.EEE…EE…E.EE…EEEEEE…EEE…SSEEE.EEEEEEEEEE…E…E…D:\ProgramData\Anaconda3\lib\site-packages\theano\scan_module\scan_perform_ext.py:76: UserWarning: The file scan_perform.c is not available. This donot happen normally. You are probably in a strangesetup. This mean Theano can not use the cython code for scan. If youwant to remove this warning, use the Theano flag’cxx=’ (set to an empty string) to disable all ccode generation.
“The file scan_perform.c is not available. This do”
…FEEEE…EE…E…E…EEE…EEEEEE.EEEEE.EEE…EEEEEE…EEEEEEEEEEEEEEEEEEEEEEEE.EEE…E…EEEEE…EEEEEEEEEEEEEEEESEEEEEEEESEEEES.D:\ProgramData\Anaconda3\lib\site-packages\theano\gpuarray\type.py:895: UserWarning: config.experimental.unpickle_gpu_on_cpu is set to True. Unpickling GpuArray as numpy.ndarray
"config.experimental.unpickle_gpu_on_cpu is set to True. "
.EEEEEES…SEEEEED:\ProgramData\Anaconda3\lib\site-packages\theano\sandbox\rng_mrg.py:1031: UserWarning: MRG_RandomStreams.multinomial_wo_replacement() is deprecated and will be removed in the next release of Theano. Please use MRG_RandomStreams.choice() instead.
warnings.warn(‘MRG_RandomStreams.multinomial_wo_replacement() is ’
EEE.EEEEEEEEEEEEEEEEEEEEEEEE.EEEEEEEEEEEEEEEEEEEEEEEE.EEEEEEEEEEE.EE.EE.ESEE…EEEEEEEEEEEEEE.EEEEEEEE.EEEE…EEEEEEE.SEEEESSSSEEEEED:\ProgramData\Anaconda3\lib\site-packages\theano\scan_module\scan_perform_ext.py:76: UserWarning: The file scan_perform.c is not available. This donot happen normally. You are probably in a strangesetup. This mean Theano can not use the cython code for scan. If youwant to remove this warning, use the Theano flag’cxx=’ (set to an empty string) to disable all ccode generation.
“The file scan_perform.c is not available. This do”
.ESE…E…

ERROR: Failure: ModuleNotFoundError (No module named ‘parameterized’)

Traceback (most recent call last):
File “D:\ProgramData\Anaconda3\lib\site-packages\nose\failure.py”, line 39, in runTest
raise self.exc_val.with_traceback(self.tb)
File “D:\ProgramData\Anaconda3\lib\site-packages\nose\loader.py”, line 417, in loadTestsFromName
addr.filename, addr.module)
File “D:\ProgramData\Anaconda3\lib\site-packages\nose\importer.py”, line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File “D:\ProgramData\Anaconda3\lib\site-packages\nose\importer.py”, line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File “D:\ProgramData\Anaconda3\lib\imp.py”, line 234, in load_module
return load_source(name, filename, file)
File “D:\ProgramData\Anaconda3\lib\imp.py”, line 171, in load_source
module = _load(spec)
File “”, line 696, in _load
File “”, line 677, in _load_unlocked
File “”, line 728, in exec_module
File “”, line 219, in _call_with_frames_removed
File “D:\ProgramData\Anaconda3\lib\site-packages\theano\compile\tests\test_builders.py”, line 17, in
from theano.tests import unittest_tools
File “D:\ProgramData\Anaconda3\lib\site-packages\theano\tests\unittest_tools.py”, line 7, in
from parameterized import parameterized
ModuleNotFoundError: No module named ‘parameterized’

======================================================================
ERROR: Failure: ModuleNotFoundError (No module named ‘parameterized’)

Traceback (most recent call last):
File “D:\ProgramData\Anaconda3\lib\site-packages\nose\failure.py”, line 39, in runTest
raise self.exc_val.with_traceback(self.tb)
File “D:\ProgramData\Anaconda3\lib\site-packages\nose\loader.py”, line 417, in loadTestsFromName
addr.filename, addr.module)
File “D:\ProgramData\Anaconda3\lib\site-packages\nose\importer.py”, line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File “D:\ProgramData\Anaconda3\lib\site-packages\nose\importer.py”, line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File “D:\ProgramData\Anaconda3\lib\imp.py”, line 234, in load_module
return load_source(name, filename, file)
File “D:\ProgramData\Anaconda3\lib\imp.py”, line 171, in load_source
module = _load(spec)
File “”, line 696, in _load
File “”, line 677, in _load_unlocked
File “”, line 728, in exec_module
File “”, line 219, in _call_with_frames_removed
File “D:\ProgramData\Anaconda3\lib\site-packages\theano\compile\tests\test_debugmode.py”, line 15, in
from theano.tests import unittest_tools as utt
File “D:\ProgramData\Anaconda3\lib\site-packages\theano\tests\unittest_tools.py”, line 7, in
from parameterized import parameterized
ModuleNotFoundError: No module named ‘parameterized’

======================================================================
ERROR: test_in_allow_downcast_floatX (theano.compile.tests.test_function.TestFunctionIn)

Traceback (most recent call last):
File “D:\ProgramData\Anaconda3\lib\site-packages\theano\gof\op.py”, line 625, in call
storage_map[ins] = [self._get_test_value(ins)]
File “D:\ProgramData\Anaconda3\lib\site-packages\theano\gof\op.py”, line 581, in _get_test_value
raise AttributeError(’%s has no test value %s’ % (v, detailed_err_msg))
AttributeError: a has no test value
Backtrace when that variable is created:

File “D:\ProgramData\Anaconda3\lib\site-packages\nose\suite.py”, line 177, in call
return self.run(*arg, **kw)
File “D:\ProgramData\Anaconda3\lib\site-packages\nose\suite.py”, line 224, in run
test(orig)
File “D:\ProgramData\Anaconda3\lib\site-packages\nose\case.py”, line 45, in call
return self.run(*arg, **kwarg)
File “D:\ProgramData\Anaconda3\lib\site-packages\nose\case.py”, line 133, in run
self.runTest(result)
File “D:\ProgramData\Anaconda3\lib\site-packages\nose\case.py”, line 151, in runTest
test(result)
File “D:\ProgramData\Anaconda3\lib\unittest\case.py”, line 663, in call
return self.run(*args, **kwds)
File “D:\ProgramData\Anaconda3\lib\unittest\case.py”, line 615, in run
testMethod()
File “D:\ProgramData\Anaconda3\lib\site-packages\theano\compile\tests\test_function.py”, line 149, in test_in_allow_downcast_floatX
a = theano.tensor.fscalar(‘a’)



Ran 415 tests in 19.742s

FAILED (SKIP=14, errors=271, failures=1)

That’s pretty strange as I cant replicate your error on my environment. What pymc3 version you are on? And how did you installed it?

pymc3.6 theano 1.0.3

I suspect my theano is not installed right as there are many errors in running theano.test(). But I try many times to reinstall theano, still went wrong…

Yep, seems there is some problem with your theano installation. How did you install it?

I’m very appreciate. After I reinstall theano follow the Instructions, It works!

but still got a warming. Has anyone ever encountered this kind of situation?

E:\ProgramData\Miniconda3\lib\site-packages\theano\tensor\subtensor.py:2339: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result.
out[0][inputs[2:]] = inputs[1]

This warning is fine to ignore for now :wink:

1 Like

I seem to be getting the same error when running Theano tests. I’ve install Theano v1.0.4 via Conda.

“The file scan_perform.c is not available”

I can’t seem to find a solution anywhere. Any ideas?

Yes, I saw the warning, too. I wonder if this error is still negligible? If not, how do I need to modify the code below? Thank you so much!


Xt = theano.shared(X_train)
yt = theano.shared(y_train)

with pm.Model() as iris_model:

# Coefficients for features
β = pm.Normal('β', 0, sigma=1e2, shape=(4, 3))
# Transoform to unit interval
a = pm.Flat('a', shape=(3,))
p = tt.nnet.softmax(Xt.dot(β) + a)

observed = pm.Categorical('obs', p=p, observed=yt)

Here’s the error:
D:\ProgramData\Anaconda3\lib\site-packages\theano\tensor\subtensor.py:2197: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result.
rval = inputs[0].getitem(inputs[1:])

Could you tell me if your problem has been solved? I am also installed in the anaconda environment theano 1.0.4, now encountered the same problem, look forward to your guidance, thank you!
I run the program on jupyter notebook, PYMC3 gives the wrong advice, I don’t know what to do with it.

this is the error document:
D:\ProgramData\Anaconda3\lib\site-packages\theano\scan_module\scan_perform_ext.py:76: UserWarning: The file scan_perform.c is not available. This donot happen normally. You are probably in a strangesetup. This mean Theano can not use the cython code for scan. If youwant to remove this warning, use the Theano flag’cxx=’ (set to an empty string) to disable all ccode generation.
“The file scan_perform.c is not available. This do”
0%| | 0/100 [00:00<?, ?it/s]D:\ProgramData\Anaconda3\lib\site-packages\theano\scan_module\scan_perform_ext.py:76: UserWarning: The file scan_perform.c is not available. This donot happen normally. You are probably in a strangesetup. This mean Theano can not use the cython code for scan. If youwant to remove this warning, use the Theano flag’cxx=’ (set to an empty string) to disable all ccode generation.
“The file scan_perform.c is not available. This do”
100%|████████████████████████████████████████| 100/100 [02:59<00:00, 1.80s/it]