Skip to content

(2.0.0-rc1) python requirements not available in beets venv #270

@basg

Description

@basg

Trying out the 2.0.0-rc1 docker image, it seems that requirements (as specified in requirements.txt) are installed, but aren't (made) available within the beets venv.

I used the same beets plugin config / requirements.txt with the 'alpine' image without any issues.

With beets[discogs] and dependency python3-discogs-client (added this after i got the import error) in requirements.txt

python3-discogs-client
beets[discogs]

I get an import error:

# beet --version
** error loading plugin discogs
Traceback (most recent call last):
  File "/repo/backend/.venv/lib/python3.12/site-packages/beets/plugins.py", line 445, in _get_plugin
    namespace = import_module(f"{PLUGIN_NAMESPACE}.{name}")
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/repo/backend/.venv/lib/python3.12/site-packages/beetsplug/discogs.py", line 33, in <module>
    from discogs_client import Client, Master, Release
ModuleNotFoundError: No module named 'discogs_client'

from the container logs; the packages are actually being installed from requirements.txt (this log is from during the initial build)..

[Entrypoint] Installing pip requirements from /config/requirements.txt
Collecting python3-discogs-client (from -r /config/requirements.txt (line 1))
Downloading python3_discogs_client-2.8-py3-none-any.whl.metadata (1.2 kB)

But it's not available where it's expected by beets, at /repo/backend/.venv/lib/python3.12/site-packages/.

# pip show python3-discogs-client
Name: python3-discogs-client
Version: 2.8
...
Location: /usr/local/lib/python3.12/site-packages

The container log on a subsequent run of the built image also shows that the packages where installed at /usr/local/lib/python3.12/site-packages.

[Entrypoint] Installing pip requirements from /config/requirements.txt
Requirement already satisfied: python3-discogs-client in /usr/local/lib/python3.12/site-packages (from -r /config/requirements.txt (line 1)) (2.8)
Requirement already satisfied: beets[discogs] in /usr/local/lib/python3.12/site-packages (from -r /config/requirements.txt (line 2)) (2.5.1)

Thanks for looking in to this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions