When I run my code in PyCharm, it works fine. But when I copy the same code into a Jupyter notebook, it crashes with the error below:
C:\Users\maria\Anaconda3\envs\PYMC3\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:])
C:\Users\maria\Anaconda3\envs\PYMC3\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]
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-8-620e314cdf0c> in <module>()
797 choices=choices, rewards=rewards, group=group, age=age, n_groups=n_groups,
798 model_name=model_name, slope_variable=slope_variable, contrast=contrast, fit_individuals=fit_individuals,
--> 799 n_subj=n_subj, n_trials='all', verbose=False, print_logps=False)
800
801 # Fit parameters, calculate model fits, make plots, and save everything
<ipython-input-8-620e314cdf0c> in create_model(choices, rewards, group, age, n_subj, n_trials, model_name, slope_variable, contrast, verbose, print_logps, fitted_data_name, n_groups, fit_individuals, upper)
636 # Use Bernoulli to sample responses
637 if n_trials_back < 3:
--> 638 model_choices = pm.Bernoulli('model_choices', p=p_right[:-1], observed=choices[3:]) # predict from trial 3 on; discard last p_right because there is no trial to predict after the last value update
639 else:
640 model_choices = pm.Bernoulli('model_choices', p=p_right[:-1], observed=choices[4:]) # predict from trial 4 on; discard last p_right because there is no trial to predict after the last value update
~\Anaconda3\envs\PYMC3\lib\site-packages\pymc3\distributions\distribution.py in __new__(cls, name, *args, **kwargs)
44 raise TypeError("observed needs to be data but got: {}".format(type(data)))
45 total_size = kwargs.pop('total_size', None)
---> 46 dist = cls.dist(*args, **kwargs)
47 return model.Var(name, dist, data, total_size)
48 else:
~\Anaconda3\envs\PYMC3\lib\site-packages\pymc3\distributions\distribution.py in dist(cls, *args, **kwargs)
55 def dist(cls, *args, **kwargs):
56 dist = object.__new__(cls)
---> 57 dist.__init__(*args, **kwargs)
58 return dist
59
~\Anaconda3\envs\PYMC3\lib\site-packages\pymc3\distributions\discrete.py in __init__(self, p, logit_p, *args, **kwargs)
310 self._logit_p = tt.as_tensor_variable(logit_p)
311
--> 312 self.mode = tt.cast(tround(self.p), 'int8')
313
314 def random(self, point=None, size=None):
~\Anaconda3\envs\PYMC3\lib\site-packages\pymc3\math.py in tround(*args, **kwargs)
102 """
103 kwargs['mode'] = 'half_to_even'
--> 104 return tt.round(*args, **kwargs)
105
106
~\Anaconda3\envs\PYMC3\lib\site-packages\theano\tensor\basic.py in round(a, mode)
2188 return round_half_away_from_zero(a)
2189 elif mode == "half_to_even":
-> 2190 return round_half_to_even(a)
2191 else:
2192 raise Exception("round mode %s is not implemented." % mode)
~\Anaconda3\envs\PYMC3\lib\site-packages\theano\gof\op.py in __call__(self, *inputs, **kwargs)
668 # compute output value once with test inputs to validate graph
669 thunk = node.op.make_thunk(node, storage_map, compute_map,
--> 670 no_recycling=[])
671 thunk.inputs = [storage_map[v] for v in node.inputs]
672 thunk.outputs = [storage_map[v] for v in node.outputs]
~\Anaconda3\envs\PYMC3\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.
~\Anaconda3\envs\PYMC3\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
~\Anaconda3\envs\PYMC3\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)
~\Anaconda3\envs\PYMC3\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,
~\Anaconda3\envs\PYMC3\lib\site-packages\theano\gof\cc.py in cthunk_factory(self, error_storage, in_storage, out_storage, storage_map, keep_lock)
1622 node.op.prepare_node(node, storage_map, None, 'c')
1623 module = get_module_cache().module_from_key(
-> 1624 key=key, lnk=self, keep_lock=keep_lock)
1625
1626 vars = self.inputs + self.outputs + self.orphans
~\Anaconda3\envs\PYMC3\lib\site-packages\theano\gof\cmodule.py in module_from_key(self, key, lnk, keep_lock)
1146 """
1147 # Is the module in the cache?
-> 1148 module = self._get_from_key(key)
1149 if module is not None:
1150 return module
~\Anaconda3\envs\PYMC3\lib\site-packages\theano\gof\cmodule.py in _get_from_key(self, key, key_data)
1045 if name is None:
1046 return None
-> 1047 return self._get_module(name)
1048
1049 def _get_from_hash(self, module_hash, key, keep_lock=False):
~\Anaconda3\envs\PYMC3\lib\site-packages\theano\gof\cmodule.py in _get_module(self, name)
718 if name not in self.module_from_name:
719 _logger.debug('loading name %s', name)
--> 720 self.module_from_name[name] = dlimport(name)
721 self.stats[1] += 1
722 else:
~\Anaconda3\envs\PYMC3\lib\site-packages\theano\gof\cmodule.py in dlimport(fullpath, suffix)
315 warnings.filterwarnings("ignore",
316 message="numpy.ndarray size changed")
--> 317 rval = __import__(module_name, {}, {}, [module_name])
318 t1 = time.time()
319 import_time += t1 - t0
ImportError: DLL load failed: The specified procedure could not be found.
I would have loved to use PyMC3 in Jupyter - any insights what might be causing the issue? Thanks!