Hi,
I’ve install mopidy and its ytmusic plugin as a service with the following definition:
mopidy = {
enable = true;
extensionPackages = [ pkgs.mopidy-mpd pkgs.mopidy-ytmusic ];
configuration = "
[mpd]
hostname = ::
";
};
If I start the service I get the following error ModuleNotFoundError: No module named 'ytmusicapi.parsers.utils'
even if the python library is correctly installed by the mopidy-ytmusic package.
Any idea about what’s wrong here ?
Found this solution here:
opened 01:17AM - 11 Jul 22 UTC
0.kind: bug
### Describe the bug
Installing mopidy, with the mopidy-ytmusic extension does … not work properly NixOS 22.05. Recent changes to the underlying library it uses break API compatibility, and nixpkgs is not pinning ytmusicapi to v0.20.0 for mopidy-ytmusic. Systemd logs showing the error below.
I have found a workaround. I made this overlay ([source here](https://github.com/desttinghim/nixos-configuration/blob/d7492c31e6f037b6e9de1c30a08dbb14412b01ea/flake.nix#L62-L71)) that uses a pending PR that updates the extension to the latest version of the API.
```
overlay-mopidy-ytmusic = final: prev: {
mopidy-ytmusic = prev.mopidy-ytmusic.overrideAttrs (old: rec {
src = prev.fetchFromGitHub {
owner = "kmac";
repo = "mopidy-ytmusic";
rev = "ytmusicapi-0.22.0";
sha256 = "sha256-cxLum/QS8bV7s5zUoBkP8I05PO7F1xi8IKtSr5dwHH4=";
};
});
};
```
### Steps To Reproduce
Steps to reproduce the behavior (I am using home-manager BTW):
1. Install mopidy with mopidy-ytmusic
2. Start the mopidy service.
3. The ytmusic extension fails to load
### Expected behavior
Adding the `mopidy` service with the `mopidy-ytmusic` extension enabled should allow the mopidy service to start with ytmusic support.
### Additional context
I am using a flake to manage both my nixos system configuration and my home-manager configuration. The repository is here: https://github.com/desttinghim/nixos-configuration
#### Journalctl log
```
Jul 10 17:18:32 nixos systemd[1768]: Started mopidy music player daemon.
Jul 10 17:18:32 nixos mopidy[438394]: INFO 2022-07-10 17:18:32,361 [438394:MainThread] mopidy.__main__
Jul 10 17:18:32 nixos mopidy[438394]: Starting Mopidy 3.3.0
Jul 10 17:18:32 nixos mopidy[438394]: INFO 2022-07-10 17:18:32,384 [438394:MainThread] mopidy.config
Jul 10 17:18:32 nixos mopidy[438394]: Loading config from builtin defaults
Jul 10 17:18:32 nixos mopidy[438394]: INFO 2022-07-10 17:18:32,385 [438394:MainThread] mopidy.config
Jul 10 17:18:32 nixos mopidy[438394]: Loading config from file:///nix/store/448bvagj4b6p1pxvgd6d4b5vq9jn7qn4-mopidy-desttinghim
Jul 10 17:18:32 nixos mopidy[438394]: INFO 2022-07-10 17:18:32,385 [438394:MainThread] mopidy.config
Jul 10 17:18:32 nixos mopidy[438394]: Loading config from command line options
Jul 10 17:18:32 nixos mopidy[438394]: WARNING 2022-07-10 17:18:32,388 [438394:MainThread] mopidy.config
Jul 10 17:18:32 nixos mopidy[438394]: Ignoring config section 'mpd' because no matching extension was found
Jul 10 17:18:32 nixos mopidy[438394]: INFO 2022-07-10 17:18:32,635 [438394:MainThread] mopidy.__main__
Jul 10 17:18:32 nixos mopidy[438394]: Enabled extensions: m3u, local, podcast, http, iris, softwaremixer, file, mpris, stream, ytmusic
Jul 10 17:18:32 nixos mopidy[438394]: INFO 2022-07-10 17:18:32,635 [438394:MainThread] mopidy.__main__
Jul 10 17:18:32 nixos mopidy[438394]: Disabled extensions: none
Jul 10 17:18:32 nixos mopidy[438394]: ERROR 2022-07-10 17:18:32,703 [438394:MainThread] mopidy.__main__
Jul 10 17:18:32 nixos mopidy[438394]: Extension ytmusic failed during setup. This might have left the registry in a bad state.
Jul 10 17:18:32 nixos mopidy[438394]: Traceback (most recent call last):
Jul 10 17:18:32 nixos mopidy[438394]: File "/nix/store/qg85clm7lla5v4q6kxsfc5hr68r5kr7w-mopidy-with-extensions-3.3.0/lib/python3.9/site-packages/mopidy/__main__.py", line 129, in main
Jul 10 17:18:32 nixos mopidy[438394]: extension.setup(registry)
Jul 10 17:18:32 nixos mopidy[438394]: File "/nix/store/qg85clm7lla5v4q6kxsfc5hr68r5kr7w-mopidy-with-extensions-3.3.0/lib/python3.9/site-packages/mopidy_ytmusic/__init__.py", line 48, in setup
Jul 10 17:18:32 nixos mopidy[438394]: from .backend import YTMusicBackend
Jul 10 17:18:32 nixos mopidy[438394]: File "/nix/store/qg85clm7lla5v4q6kxsfc5hr68r5kr7w-mopidy-with-extensions-3.3.0/lib/python3.9/site-packages/mopidy_ytmusic/backend.py", line 9, in <module>
Jul 10 17:18:32 nixos mopidy[438394]: from ytmusicapi.parsers.utils import (
Jul 10 17:18:32 nixos mopidy[438394]: ModuleNotFoundError: No module named 'ytmusicapi.parsers.utils'
```
### Notify maintainers
The package indicates that @NickHu is the maintainer.
### Metadata
Please run `nix-shell -p nix-info --run "nix-info -m"` and paste the result.
```console
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 5.15.49, NixOS, 22.05 (Quokka), 22.05.20220701.915f5a5`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.8.1`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
```