I’m using google colab with Python version 3.8.5 to run ‘import mxnet as mx’.
But it returns “module ‘numpy’ has no attribute ‘bool'”
Actually this command worked really well last December(12.2023) and January(01.2024).
So I don’t know why it doesn’t work today.
How can I fix this error? If anyone knows please help.
My code is :
from google.colab import drive
drive.mount('/content/drive')
!wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz
!tar xvfz Python-3.8.5.tgz
!Python-3.8.5/configure
!make
!sudo make install
!pip install torch==1.6.0+cpu torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
!pip install --upgrade gluoncv
!pip install --upgrade mxnet
import mxnet as mx
from mxnet import image
from mxnet.gluon.data.vision import transforms
import gluoncv
from gluoncv.utils.viz import get_color_pallete
import matplotlib.image as mpimg
from gluoncv.data.ade20k.segmentation import ADE20KSegmentation
from matplotlib import pyplot as plt
from gluoncv.data.transforms.presets.segmentation import test_transform
from google.colab import files
import pandas as pd
import numpy as np
import os
and this it results :
/usr/local/lib/python3.10/dist-packages/mxnet/numpy/utils.py:37: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
bool = onp.bool
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-6-d07a1bcfa66c> in <cell line: 1>()
----> 1 import mxnet as mx
2 from mxnet import image
3 from mxnet.gluon.data.vision import transforms
4 import gluoncv
5
7 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
New contributor
이지원 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.