Jeff-sjtu/HybrIK

ImportError: cannot import name 'bool' from 'numpy' (/home/cvit/miniconda3/envs/hybrik2/lib/python3.9/site-packages/numpy/__init__.py)

Closed this issue · 1 comments

After setup, on running

python scripts/demo_video.py --video-name examples/dance.mp4 --out-dir res_dance --save-pk --save-img, I get the below error

  warnings.warn(
/home/cvit/miniconda3/envs/hybrik2/lib/python3.9/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing `weights=FasterRCNN_ResNet50_FPN_Weights.COCO_V1`. You can also use `weights=FasterRCNN_ResNet50_FPN_Weights.DEFAULT` to get the most up-to-date weights.
  warnings.warn(msg)
/home/cvit/miniconda3/envs/hybrik2/lib/python3.9/site-packages/chumpy/__init__.py:11: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
  from numpy import bool, int, float, complex, object, unicode, str, nan, inf
/home/cvit/miniconda3/envs/hybrik2/lib/python3.9/site-packages/chumpy/__init__.py:11: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
  from numpy import bool, int, float, complex, object, unicode, str, nan, inf
/home/cvit/miniconda3/envs/hybrik2/lib/python3.9/site-packages/chumpy/__init__.py:11: FutureWarning: In the future `np.str` will be defined as the corresponding NumPy scalar.
  from numpy import bool, int, float, complex, object, unicode, str, nan, inf
Traceback (most recent call last):
  File "/home/cvit/amogh/projects/HybrIK/scripts/demo_video.py", line 137, in <module>
    hybrik_model = builder.build_sppe(cfg.MODEL)
  File "/home/cvit/amogh/projects/HybrIK/hybrik/models/builder.py", line 21, in build_sppe
    return build(cfg, SPPE)
  File "/home/cvit/amogh/projects/HybrIK/hybrik/models/builder.py", line 17, in build
    return build_from_cfg(cfg, registry, default_args)
  File "/home/cvit/amogh/projects/HybrIK/hybrik/utils/registry.py", line 75, in build_from_cfg
    return obj_cls(**args)
  File "/home/cvit/amogh/projects/HybrIK/hybrik/models/HRNetWithCam.py", line 78, in __init__
    self.smpl = SMPL_layer(
  File "/home/cvit/amogh/projects/HybrIK/hybrik/models/layers/smpl/SMPL.py", line 85, in __init__
    self.smpl_data = Struct(**pk.load(smpl_file, encoding='latin1'))
  File "/home/cvit/miniconda3/envs/hybrik2/lib/python3.9/site-packages/chumpy/__init__.py", line 11, in <module>
    from numpy import bool, int, float, complex, object, unicode, str, nan, inf
ImportError: cannot import name 'bool' from 'numpy' (/home/cvit/miniconda3/envs/hybrik2/lib/python3.9/site-packages/numpy/__init__.py)```

This error comes due to numpy versioning. I was able to solve it by doing the following

  1. pip uninstall numpy
  2. pip install numpy==1.23.1