1

How to install and import theano.tensor on google colab?

I am attaching the program code below:

pip install Theano

import theano.tensor as tt
Below is a description of the error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-82b00d491f91> in <cell line: 2>()
      1 get_ipython().system('pip install Theano')
----> 2 import theano.tensor as tt

8 frames
/usr/local/lib/python3.10/dist-packages/numpy/__init__.py in __getattr__(attr)
    317 
    318         if attr in __former_attrs__:
--> 319             raise AttributeError(__former_attrs__[attr])
    320 
    321         if attr == 'testing':

AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
2
  • I would advise against using Theano in any new project: it hasn't seen any updates since 2020, so it is not surprising that it might rely on NumPy features that have been deprecated since. If you absolutely need to use Theano (e.g. for a legacy project), try installing necessary libraries with versions that were current around the latest Theano release (for NumPy, this would be v1.18 or v1.19), keeping in mind potential bugs or security issues.
    – simon
    Commented Jul 5 at 15:13
  • If you start a new project, (I guess, this goes in the direction of deep learning), try an up-to-date library like PyTorch or TensorFlow – or maybe have a look at PyTensor, which seems to be a fork of Theano that is actively maintained and that is recommended by the original Theano project.
    – simon
    Commented Jul 5 at 15:15

0

Browse other questions tagged or ask your own question.