2

I have installed the latest version of scikit-video=1.1.11 and the latest version of numpy=1.26.1. When trying to load a video as

>>> import skvideo.io >>> skvideo.io.vread('video_path.mp4') 

I get the following error

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/user/anaconda3/envs/snb/lib/python3.10/site-packages/skvideo/io/io.py", line 144, in vread reader = FFmpegReader(fname, inputdict=inputdict, outputdict=outputdict, verbosity=verbosity) File "/home/user/anaconda3/envs/snb/lib/python3.10/site-packages/skvideo/io/ffmpeg.py", line 44, in __init__ super(FFmpegReader,self).__init__(*args, **kwargs) File "/home/user/anaconda3/envs/snb/lib/python3.10/site-packages/skvideo/io/abstract.py", line 87, in __init__ if np.float(parts[1]) == 0.: File "/home/user/anaconda3/envs/snb/lib/python3.10/site-packages/numpy/__init__.py", line 324, 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'? 

The error goes away if I install older version of numpy=1.23.5 as suggested in this answer. The answer notes that float attribute is deprecated in numpy=1.20 and removed in numpy=1.24.

So, why has scikit-video not updated this in their latest version? Is there no way to use latest numpy with scikit-video?

1 Answer 1

2

This is an open issue in the scikit-video github repository.

One possible solution (as proposed in that issue) is using

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

Or using an older numpy version as you proposed.

As far as I see, there is no special reason for it apart from that this change in numpy has not been taken into account yet. Please note that the newest version of scikit-video is from 2018.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, I will try this. Any idea if scikit-video is still in development or is it better to switch to some other library for reading/writing videos?
Well there have been some updates on the github in the last months: github.com/scikit-video/scikit-video This even includes some changes for numpy >= 1.24. So I would say it is not abandoned but I cannot say if its still in active development. Even if it is not, there is no reason to not use it as long as it does what you need.
in my case, these np.float=np.float64 and so on must be after importing numpy but before importing scikit-video (as shown in the github link above). it worked without downgrading numpy. Somehow the order is important...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.