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

Import paths wrong? No module named 'handlers' #474

Closed
Squelsh opened this issue Jan 1, 2020 · 20 comments
Closed

Import paths wrong? No module named 'handlers' #474

Squelsh opened this issue Jan 1, 2020 · 20 comments
Labels

Comments

@Squelsh
Copy link

Squelsh commented Jan 1, 2020

I am no Python expert, so perhaps this is a pretty simple config misstake, but I can not start mopidy.

Describe the bug
Files can not be found:

pi@phoniebox:~ $ mopidy
INFO     2020-01-01 14:39:32,031 [3337:MainThread] mopidy.__main__
  Starting Mopidy 3.0.1
ERROR    2020-01-01 14:39:32,259 [3337:MainThread] mopidy.ext
  Failed to load extension iris: No module named 'handlers'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mopidy/ext.py", line 209, in load_extensions
    extension_class = entry_point.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2417, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_iris/__init__.py", line 7, in <module>
    import handlers
ModuleNotFoundError: No module named 'handlers'

Environment details:

  • OS: Raspbian Buster
  • Iris version Mopidy_Iris-3.43.0 installed via pip
  • Mopidy installed from apt-repo.
@Squelsh Squelsh added the bug label Jan 1, 2020
@Squelsh
Copy link
Author

Squelsh commented Jan 1, 2020

Some more similar errors occur:

ERROR    2020-01-01 15:45:42,976 [6108:MainThread] mopidy.__main__
  Extension local-images failed during setup. This might have left the registry in a bad state.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mopidy/__main__.py", line 129, in main
    extension.setup(registry)
  File "/usr/local/lib/python3.7/dist-packages/mopidy_local_images/__init__.py", line 31, in setup
    from .library import ImageLibrary
  File "/usr/local/lib/python3.7/dist-packages/mopidy_local_images/library.py", line 12, in <module>
    from mopidy import local
ImportError: cannot import name 'local' from 'mopidy' (/usr/lib/python3/dist-packages/mopidy/__init__.py)
ERROR    2020-01-01 15:45:43,464 [6108:MainThread] mopidy.__main__
  Extension spotify failed during setup. This might have left the registry in a bad state.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mopidy/__main__.py", line 129, in main
    extension.setup(registry)
  File "/usr/local/lib/python3.7/dist-packages/Mopidy_Spotify-3.1.0-py3.7.egg/mopidy_spotify/__init__.py", line 52, in setup
    from mopidy_spotify.backend import SpotifyBackend
  File "/usr/local/lib/python3.7/dist-packages/Mopidy_Spotify-3.1.0-py3.7.egg/mopidy_spotify/backend.py", line 13, in <module>
    from mopidy_spotify import Extension, library, playback, playlists, web
  File "/usr/local/lib/python3.7/dist-packages/Mopidy_Spotify-3.1.0-py3.7.egg/mopidy_spotify/library.py", line 7, in <module>
    from mopidy_spotify import browse, distinct, images, lookup, search
  File "/usr/local/lib/python3.7/dist-packages/Mopidy_Spotify-3.1.0-py3.7.egg/mopidy_spotify/distinct.py", line 7, in <module>
    from mopidy_spotify import search
  File "/usr/local/lib/python3.7/dist-packages/Mopidy_Spotify-3.1.0-py3.7.egg/mopidy_spotify/search.py", line 10, in <module>
    from mopidy_spotify import lookup, translator
  File "/usr/local/lib/python3.7/dist-packages/Mopidy_Spotify-3.1.0-py3.7.egg/mopidy_spotify/lookup.py", line 7, in <module>
    from mopidy_spotify import playlists, translator, utils, web
  File "/usr/local/lib/python3.7/dist-packages/Mopidy_Spotify-3.1.0-py3.7.egg/mopidy_spotify/playlists.py", line 10, in <module>
    from mopidy_spotify import translator, utils, web
  File "/usr/local/lib/python3.7/dist-packages/Mopidy_Spotify-3.1.0-py3.7.egg/mopidy_spotify/web.py", line 11, in <module>
    import urlparse
ModuleNotFoundError: No module named 'urlparse'

@LickABrick
Copy link

Having the same issue, just installed Mopidy from apt repository and Mopidy-Iris via pip.
My other Mopidy + Iris instance is working fine on the latest Iris version.

@Squelsh
Copy link
Author

Squelsh commented Jan 4, 2020

My other Mopidy + Iris instance is working fine on the latest Iris version.

How did you install that version?

@Candymirror
Copy link

I got pass this error, by replacing the current mopidy_iris folder in /usr/local/lib/python3.7/dist-packages/ with the one from the "feature/python3" Branch: https://github.com/jaedb/Iris/tree/feature/python3
Mopidy and mopidy_iris are running.

I've got one more error remaining, mopidy related.
ERROR 2020-01-04 10:20:15,069 [4594:MainThread] mopidy.__main__ Extension local-images failed during setup. This might have left the registry in a bad state. Traceback (most recent call last): File "/usr/lib/python3/dist-packages/mopidy/__main__.py", line 129, in main extension.setup(registry) File "/usr/local/lib/python3.7/dist-packages/mopidy_local_images/__init__.py", line 31, in setup from .library import ImageLibrary File "/usr/local/lib/python3.7/dist-packages/mopidy_local_images/library.py", line 12, in <module> from mopidy import local ImportError: cannot import name 'local' from 'mopidy' (/usr/lib/python3/dist-packages/mopidy/__init__.py)

Do you have the same error? I will try to solve this

@LickABrick
Copy link

How did you install that version?

This installation was done months ago and I have been keeping it up to date with the build in update script/button and the occasional apt-get update/upgrade

@jaedb
Copy link
Owner

jaedb commented Jan 4, 2020

At first glance the issue seems to be that you're running Mopidy 3. Iris' support for Mopidy 3 (python 3) is still in progress, which is why you're observing errors.
You can keep track of the progress of Iris here:
#356 and the overall Mopidy 3 upgrade here: https://github.com/orgs/mopidy/projects/2

@m4rc77
Copy link

m4rc77 commented Feb 1, 2020

Is this issue maybe related to the Python version used? In the release notes of Iris (https://github.com/jaedb/Iris/releases/tag/3.44.0) i can see that Iris now uses Python 3.8. All the stacktraces above do contain ..../python3.7/.... Is this the cause of this problem?

I am currently stuck with the same issue with Mopidy 3.0.1, Phyton 3.7 on Debian Buster.

@kingosticks
Copy link
Contributor

kingosticks commented Feb 2, 2020

I assume the release notes are a typo, the version requirement in setup.cfg is python >= 3.7 (which is what you'd expect for a Mopidy 3 compatible extension).

Regardless, all the stack traces in here seem to be from broken installations where old versions of extensions are running. If you look at the source code in the master branch on here for the file specified you'll see the specified line doesn't exist. I suggest you reinstall iris.

The Mopidy-spotify one is Mopidy-spotify v3.x (not Python 3 compatible) and mopidy-local-images no longer exists in Mopidy 3.

In short, these are all bad installs.

@Squelsh
Copy link
Author

Squelsh commented Feb 2, 2020 via email

@jaedb
Copy link
Owner

jaedb commented Feb 2, 2020

@Squelsh, @kingosticks is correct, there is a typo in the release notes. It should read "python 3.7", and is now corrected.

@m4rc77
Copy link

m4rc77 commented Feb 3, 2020

@kingosticks thanks for the clarification concerning the Python version.

Concerning the issue itself ...I do see the the line import handlers that causes the first stacktrace in this issue in https://github.com/jaedb/Iris/blob/3.43.0/mopidy_iris/__init__.py but in https://github.com/jaedb/Iris/blob/3.44.0/mopidy_iris/__init__.py it has gone. But from PyPi you could not yet get 3.44.0 ... see https://pypi.org/project/Mopidy-Iris/ . Therefore fresh/clean installations as mine do still fail.

I guess this problem could be solved as soon as 3.44.0 is available from https://pypi.org/project/Mopidy-Iris/

@kingosticks
Copy link
Contributor

Yes. And also if the install instructions were updated to sudo python3 -m pip install iris.

@m4rc77
Copy link

m4rc77 commented Feb 3, 2020

Yes. And also if the install instructions were updated to sudo python3 -m pip install iris.

You mean sudo python3 -m pip install Mopidy-Iris? Or do I miss something here?

Any Ideas when 3.44.0 will be available on PyPI as it was already released here on https://github.com/jaedb/Iris/releases ?

@kingosticks
Copy link
Contributor

Yep, I meant what you what said. The different PyPI and repo names catches me every time.

@jaedb
Copy link
Owner

jaedb commented Feb 8, 2020

@m4rc77 and @Squelsh Iris 3.44 is out in the wild now.

@jaedb jaedb closed this as completed Feb 8, 2020
@s-martin
Copy link

Phoniebox uses Iris 3.43, because some parts are still Python 2.

One user reported the same issue MiczFlor/RPi-Jukebox-RFID#759 (comment) like this ticket.

Is the only resolution upgrading to 3.44 or are there other options?

@jaedb
Copy link
Owner

jaedb commented Feb 22, 2020

@s-martin this is because Mopidy doesn't provide backwards compatibility, but mostly I simply don't have the time resource to single-handedly manage Python 2.7/3.7 dual support.

To answer your question, you'll need to use Iris < 34.0 until Python 3.7 is supported.

@s-martin
Copy link

s-martin commented Mar 1, 2020

Sorry to bother again, but our users have reported that issue again even after using Python 3, Mopidy 3 and Iris 3.45.1

See MiczFlor/RPi-Jukebox-RFID#759 (comment)

Could this be the same issue or a different one?

@jaedb
Copy link
Owner

jaedb commented Mar 2, 2020

Looking at the error log, my guess is they haven't upgraded Iris. In the latest version of Iris, __init__.py doesn't import handlers, rather it imports the sub-modules of it.

See:

My suggestion would be to ensure Iris is completely removed (check python3 -m pip as well as pip and pip3 just to be certain) before installing it again from scratch.

@s-martin
Copy link

s-martin commented Mar 2, 2020

Thanks, @kingosticks already found out that we missed a sudo :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants