question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

librosa.load does not work with pathlib.Path

See original GitHub issue

Describe 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:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jonashaagcommented, Sep 11, 2020

😮 I did pip install -U soundfile before reporting this issue, and pip reported v0.10.2 to be installed, but soundfile.__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.

1reaction
bmcfeecommented, Sep 11, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found