Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tleyden opened this issue May 15, 2023 · 0 comments

Comments

@tleyden
Copy link

tleyden commented May 15, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant