Skip to content

AttributeError: module 'numpy' has no attribute 'float' error from skvideo dependency #19

@tleyden

Description

@tleyden

I tried running StrayVisualizer and got the following error:

python stray_visualize.py stray_scanner_c9c16b88c7
Traceback (most recent call last):
  File "/Users/tleyden/DevLibraries/StrayVisualizer/stray_visualize.py", line 215, in <module>
    main()
  File "/Users/tleyden/DevLibraries/StrayVisualizer/stray_visualize.py", line 206, in main
    geometries += point_clouds(flags, data)
  File "/Users/tleyden/DevLibraries/StrayVisualizer/stray_visualize.py", line 130, in point_clouds
    for i, (T_WC, rgb) in enumerate(zip(data['poses'], video)):
  File "/opt/miniconda3/envs/strayscan/lib/python3.10/site-packages/skvideo/io/io.py", line 251, in vreader
    reader = FFmpegReader(fname, inputdict=inputdict, outputdict=outputdict, verbosity=verbosity)
  File "/opt/miniconda3/envs/strayscan/lib/python3.10/site-packages/skvideo/io/ffmpeg.py", line 44, in __init__
    super(FFmpegReader,self).__init__(*args, **kwargs)
  File "/opt/miniconda3/envs/strayscan/lib/python3.10/site-packages/skvideo/io/abstract.py", line 87, in __init__
    if np.float(parts[1]) == 0.:
  File "/opt/miniconda3/envs/strayscan/lib/python3.10/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` 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. Did you mean: 'cfloat'?

It looks like it's caused by scikit-video/scikit-video#154, and the workaround mentioned here worked for me:

In stray_visualize.py, replace import skvideo.io with:

import numpy
numpy.float = numpy.float64
numpy.int = numpy.int_
import skvideo.io

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions