Skip to content

Theano import issue #3375

@MaxHalford

Description

@MaxHalford

Description of your problem

Please provide a minimal, self-contained, and reproducible example.

import pymc3 as pm

with pm.Model() as model:
    
    x = pm.Uniform('x', lower=0, upper=16)

Please provide the full traceback.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-5fea95be487c> in <module>()
      3 with pm.Model() as model:
      4 
----> 5     x = pm.Uniform('x', lower=0, upper=16)

~/anaconda3/lib/python3.6/site-packages/pymc3/distributions/distribution.py in __new__(cls, name, *args, **kwargs)
     39                 raise TypeError("observed needs to be data but got: {}".format(type(data)))
     40             total_size = kwargs.pop('total_size', None)
---> 41             dist = cls.dist(*args, **kwargs)
     42             return model.Var(name, dist, data, total_size)
     43         else:

~/anaconda3/lib/python3.6/site-packages/pymc3/distributions/distribution.py in dist(cls, *args, **kwargs)
     50     def dist(cls, *args, **kwargs):
     51         dist = object.__new__(cls)
---> 52         dist.__init__(*args, **kwargs)
     53         return dist
     54 

~/anaconda3/lib/python3.6/site-packages/pymc3/distributions/continuous.py in __init__(self, lower, upper, *args, **kwargs)
    181         self.lower = lower = tt.as_tensor_variable(floatX(lower))
    182         self.upper = upper = tt.as_tensor_variable(floatX(upper))
--> 183         self.mean = (upper + lower) / 2.
    184         self.median = self.mean
    185 

~/anaconda3/lib/python3.6/site-packages/theano/tensor/var.py in __add__(self, other)
    126     def __add__(self, other):
    127         try:
--> 128             return theano.tensor.basic.add(self, other)
    129         # We should catch the minimum number of exception here.
    130         # Otherwise this will convert error when Theano flags

~/anaconda3/lib/python3.6/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/lib/python3.6/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/lib/python3.6/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/lib/python3.6/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/lib/python3.6/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/lib/python3.6/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

~/anaconda3/lib/python3.6/site-packages/theano/gof/cc.py in cmodule_key(self)
   1298                                  libraries=self.libraries(),
   1299                                  header_dirs=self.header_dirs(),
-> 1300                                  c_compiler=self.c_compiler(),
   1301                                  )
   1302 

~/anaconda3/lib/python3.6/site-packages/theano/gof/cc.py in cmodule_key_(self, fgraph, no_recycling, compile_args, libraries, header_dirs, insert_config_hash, c_compiler)
   1377         # DynamicModule always add the include <numpy/arrayobject.h>
   1378         sig.append('NPY_ABI_VERSION=0x%X' %
-> 1379                    np.core.multiarray._get_ndarray_c_version())
   1380         if c_compiler:
   1381             sig.append('c_compiler_str=' + c_compiler.version_str())

AttributeError: module 'numpy.core.multiarray' has no attribute '_get_ndarray_c_version'

Please provide any additional information below.

I tried to create a fresh virtual environment and reinstall different versions of Theano but nothing worked. Also I'm working in a Jupyter Notebook, not sure if that affects anything.

Versions and main components

  • PyMC3 Version: 3.6
  • Theano Version: 1.0.4
  • Python Version: 3.6.8
  • Operating system: Arch Linux (exact build: 4.19.4-arch1-1-ARCH)
  • How did you install PyMC3: (conda/pip) conda

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions