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.

ImportError: cannot import name 'lombscargle'

See original GitHub issue

Hello! I installed Librosa using sudo pip3 install librosa. I get this:

Requirement already satisfied: librosa in /home/nikigre/.local/lib/python3.6/site-packages
Requirement already satisfied: audioread>=2.0.0 in /home/nikigre/.local/lib/python3.6/site-packages (from librosa)
Requirement already satisfied: numpy>=1.8.0 in /home/nikigre/.local/lib/python3.6/site-packages (from librosa)
Requirement already satisfied: six>=1.3 in /home/nikigre/.local/lib/python3.6/site-packages (from librosa)
Requirement already satisfied: decorator>=3.0.0 in /home/nikigre/.local/lib/python3.6/site-packages (from librosa)
Requirement already satisfied: joblib>=0.7.0 in /home/nikigre/.local/lib/python3.6/site-packages (from librosa)
Requirement already satisfied: scipy>=0.13.0 in /home/nikigre/.local/lib/python3.6/site-packages (from librosa)
Requirement already satisfied: scikit-learn>=0.14.0 in /home/nikigre/.local/lib/python3.6/site-packages (from librosa)
Requirement already satisfied: resampy>=0.1.2 in /home/nikigre/.local/lib/python3.6/site-packages (from librosa)
Requirement already satisfied: numba>=0.32 in /home/nikigre/.local/lib/python3.6/site-packages (from resampy>=0.1.2->librosa)
Requirement already satisfied: llvmlite>=0.29.0 in /home/nikigre/.local/lib/python3.6/site-packages (from numba>=0.32->resampy>=0.1.2->librosa)

But when I try using it in deepvoice3_pytorch, I get this error.

Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform; print(platform.platform())
Linux-4.4.0-17763-Microsoft-x86_64-with-Ubuntu-18.04-bionic
>>> import sys; print("Python", sys.version)
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]]
>>> import numpy; print("NumPy", numpy.__version__)
NumPy 1.16.4
>>> import scipy; print("SciPy", scipy.__version__)
SciPy 1.3.0
>>> import librosa; print("librosa", librosa.__version__)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nikigre/.local/lib/python3.6/site-packages/librosa/__init__.py", line 12, in <module>
    from . import core
  File "/home/nikigre/.local/lib/python3.6/site-packages/librosa/core/__init__.py", line 109, in <module>
    from .audio import *  # pylint: disable=wildcard-import
  File "/home/nikigre/.local/lib/python3.6/site-packages/librosa/core/audio.py", line 10, in <module>
    import scipy.signal
  File "/home/nikigre/.local/lib/python3.6/site-packages/scipy/signal/__init__.py", line 305, in <module>
    from .spectral import *
  File "/home/nikigre/.local/lib/python3.6/site-packages/scipy/signal/spectral.py", line 10, in <module>
    from ._spectral import lombscargle
ImportError: cannot import name 'lombscargle'

I tried sudo pip3 install lombscargle But it does not exists (requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://pypi.org/simple/lombscargle/) How can I repair this? Thank you!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lostanlencommented, Jul 24, 2019

That’s quite strange. I can’t reproduce the problem on my machine. Python 3.7 on a Darwin OS.

Python 3.7.3 (default, Mar 27 2019, 16:54:48)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform; print(platform.platform())
Darwin-18.6.0-x86_64-i386-64bit
>>> import sys; print("Python", sys.version)
Python 3.7.3 (default, Mar 27 2019, 16:54:48)
[Clang 4.0.1 (tags/RELEASE_401/final)]
>>> import numpy; print("NumPy", numpy.__version__)
NumPy 1.16.4
>>> import scipy; print("SciPy", scipy.__version__)
SciPy 1.3.0
>>> import librosa; print("librosa", librosa.__version__)
librosa 0.7.0

The crux problem seems to lie at import scipy.signal. Can you re-run Python and just type this command: import scipy.signal, see if the error still happens?

lombscargle is not a module but a function within the scipy.signal.spectral module. It’s been there since at least 2012 or 2013 (scipy v0.13), if not earlier. https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.lombscargle.html

0reactions
bmcfeecommented, Jul 24, 2019

But this error is probably not connected to Librosa. Thank you for quick help!

I’m glad it’s working now!

import librosa; print(“librosa”, librosa.version) librosa 0.5.1

That version is several years out of date now, but upgrading to 0.7 should work fine if your dependency chain is settled now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use of scipy.signal.lombscargle - Stack Overflow
The data that we are pulling from is a simple .dat file with lists of numbers. Here is the code, any ideas on...
Read more >
LombScargle — Astropy v5.2
Compute the Lomb-Scargle periodogram at a user-specified frequency grid: ... from astropy import units as u >>> t = t * u.s >>>...
Read more >
The Generalized Lomb-Scargle Periodogram (GLS)
The Gls class computes the error-weighted Lomb-Scargle periodogram as developed by [ZK09] using various possible normalizations. The constructor of Gls takes a ...
Read more >
Fast Lomb-Scargle Periodograms in Python
The Lomb-Scargle periodogram (named for Lomb (1976) and Scargle (1982)) is a ... We'll start with some typical Python import statements:.
Read more >
Signal Processing (scipy.signal) — SciPy v1.9.3 Manual
import numpy as np >>> from scipy import signal, misc >>> import ... Filtering is a generic name for any system that modifies...
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