I'm using a conda environment with Python version 3.9.7, pip 22.3.1, numpy 1.24.0, gluoncv 0.10.5.post0, mxnet 1.7.0.post2
from gluoncv import data, utils
gives the error:
C:\Users\std\anaconda3\envs\myenv\lib\site-packages\mxnet\numpy\utils.py:37: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar. (This may have returned Python scalars in past versions
bool = onp.bool
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[1], line 3
1 #import cv2
2 #import os
----> 3 from gluoncv import data, utils #does not work
File ~\anaconda3\envs\myenv\lib\site-packages\gluoncv\__init__.py:16
14 _found_mxnet = _found_pytorch = False
15 try:
---> 16 _require_mxnet_version('1.4.0', '2.0.0')
17 from . import data
18 from . import model_zoo
File ~\anaconda3\envs\myenv\lib\site-packages\gluoncv\check.py:6, in _require_mxnet_version(mx_version, max_mx_version)
4 def _require_mxnet_version(mx_version, max_mx_version='2.0.0'):
5 try:
----> 6 import mxnet as mx
7 from distutils.version import LooseVersion
8 if LooseVersion(mx.__version__) < LooseVersion(mx_version) or \
9 LooseVersion(mx.__version__) >= LooseVersion(max_mx_version):
File ~\anaconda3\envs\myenv\lib\site-packages\mxnet\__init__.py:33
30 # version info
31 __version__ = base.__version__
---> 33 from . import contrib
34 from . import ndarray
35 from . import ndarray as nd
File ~\anaconda3\envs\myenv\lib\site-packages\mxnet\contrib\__init__.py:30
27 from . import autograd
28 from . import tensorboard
---> 30 from . import text
31 from . import onnx
32 from . import io
File ~\anaconda3\envs\myenv\lib\site-packages\mxnet\contrib\text\__init__.py:23
21 from . import utils
22 from . import vocab
---> 23 from . import embedding
File ~\anaconda3\envs\myenv\lib\site-packages\mxnet\contrib\text\embedding.py:36
34 from ... import base
35 from ...util import is_np_array
---> 36 from ... import numpy as _mx_np
37 from ... import numpy_extension as _mx_npx
40 def register(embedding_cls):
File ~\anaconda3\envs\myenv\lib\site-packages\mxnet\numpy\__init__.py:23
21 from . import random
22 from . import linalg
---> 23 from .multiarray import * # pylint: disable=wildcard-import
24 from . import _op
25 from . import _register
File ~\anaconda3\envs\myenv\lib\site-packages\mxnet\numpy\multiarray.py:47
45 from ..ndarray.numpy import _internal as _npi
46 from ..ndarray.ndarray import _storage_type, from_numpy
---> 47 from .utils import _get_np_op
48 from .fallback import * # pylint: disable=wildcard-import,unused-wildcard-import
49 from . import fallback
File ~\anaconda3\envs\myenv\lib\site-packages\mxnet\numpy\utils.py:37
35 int64 = onp.int64
36 bool_ = onp.bool_
---> 37 bool = onp.bool
39 pi = onp.pi
40 inf = onp.inf
File ~\anaconda3\envs\myenv\lib\site-packages\numpy\__init__.py:284, in __getattr__(attr)
281 from .testing import Tester
282 return Tester
--> 284 raise AttributeError("module {!r} has no attribute "
285 "{!r}".format(__name__, attr))
AttributeError: module 'numpy' has no attribute 'bool'
conda-forge
channel, so make sure you're careful about which channels go with which env. Frankly, I'd recommend deleting anaconda and installingminiforge
ormambaforge
from the same page. – Rn