librosa.load does not work with pathlib.Path
See original GitHub issueDescribe the bug
# OK:
>>> librosa.load(str(Path("...")))
# Not OK:
>>> librosa.load(Path("..."))
Traceback (most recent call last):
...
File ".../soundfile.py", line 1263, in _open
raise TypeError("Invalid file: {0!r}".format(self.name))
TypeError: Invalid file: PosixPath('...')
>>> soundfile.__version__
'0.9.0'
>>> librosa.__version__
'0.8.0'
Software versions
python: 3.8.5 (default, Jul 21 2020, 10:48:26) [Clang 11.0.3 (clang-1103.0.32.62)]
librosa: 0.8.0
audioread: 2.1.8 numpy: 1.18.5 scipy: 1.4.1 sklearn: 0.22.2.post1 joblib: 0.16.0 decorator: 4.4.2 soundfile: 0.9.0 resampy: 0.2.2 numba: 0.50.1
numpydoc: None sphinx: None sphinx_rtd_theme: None sphinxcontrib.versioning: None sphinx-gallery: None pytest: 6.0.1 pytest-mpl: None pytest-cov: None matplotlib: 3.3.0 presets: None
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
librosa.load — librosa 0.10.0.dev0 documentation
Any string file paths, or any object implementing Python's file interface (e.g. pathlib.Path ) are supported as path. If the codec is supported...
Read more >NoBackendError while getting features of audio files using ...
Im using jupyter notebook for executing this. The Whole program is available in this link ...
Read more >Audio Data Analysis Using librosa | Kaggle
It is a Python module to analyze audio signals in general but geared more ... as data from contextlib import contextmanager from pathlib...
Read more >Simple audio recognition: Recognizing keywords - TensorFlow
To save time with data loading, you will be working with a smaller version of the ... Divided into directories this way, you...
Read more >hey everybody! i'm new to this - Google Groups
1188 # See http://github.com/erikd/libsndfile/issues/77. ... \python39\lib\site-packages\librosa\core\audio.py:174, in load(path, sr, mono, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
😮 I did
pip install -U soundfile
before reporting this issue, and pip reported v0.10.2 to be installed, butsoundfile.__version__
still gave 0.9.0. Not sure what was going on there. Still, the librosa dependency is still at 0.9.0 so should be updated.The problem is that we didn’t update the minimum soundfile version necessary for this to work. If you upgrade soundfile to >=0.10.2, Path works as expected.
We should revise the requirements spec accordingly, but there are no code changes necessary to address this.