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

ModuleNotFoundError: No module named 'pkg_resources' #188

Closed
StefanLobbenmeier opened this issue Mar 17, 2024 · 10 comments · Fixed by #189
Closed

ModuleNotFoundError: No module named 'pkg_resources' #188

StefanLobbenmeier opened this issue Mar 17, 2024 · 10 comments · Fixed by #189
Labels
bug Something isn't working dependencies Pull requests that update a dependency file

Comments

@StefanLobbenmeier
Copy link

I installed this via pipx on macOS 14.4.

brew install pipx

pipx install audible-cli

pipx ensurepath

audible
Traceback (most recent call last):
  File "~/.local/bin/audible", line 7, in <module>
    from audible_cli import main
  File "~/Library/Application Support/pipx/venvs/audible-cli/lib/python3.12/site-packages/audible_cli/__init__.py", line 5, in <module>
    from .cli import main, quickstart
  File "~/Library/Application Support/pipx/venvs/audible-cli/lib/python3.12/site-packages/audible_cli/cli.py", line 3, in <module>
    from pkg_resources import iter_entry_points
ModuleNotFoundError: No module named 'pkg_resources'

To solve this I had to add setuptools:

pipx runpip audible-cli install setuptools
Collecting setuptools
  Using cached setuptools-69.2.0-py3-none-any.whl.metadata (6.3 kB)
Using cached setuptools-69.2.0-py3-none-any.whl (821 kB)
Installing collected packages: setuptools
Successfully installed setuptools-69.2.0

And now the audible command works 😄

FYI this is the requirements that were installed by pipx (before I ran the additional install):

pipx runpip audible-cli list
Package        Version
-------------- --------
aiofiles       23.2.1
anyio          4.3.0
audible        0.8.2
audible-cli    0.2.6
beautifulsoup4 4.12.3
certifi        2024.2.2
click          8.1.7
h11            0.14.0
httpcore       0.16.3
httpx          0.23.3
idna           3.6
packaging      24.0
pbkdf2         1.3
pillow         10.2.0
pip            24.0
prompt-toolkit 3.0.36
pyaes          1.6.1
pyasn1         0.5.1
questionary    2.0.1
rfc3986        1.5.0
rsa            4.9
sniffio        1.3.1
soupsieve      2.5
tabulate       0.9.0
toml           0.10.2
tqdm           4.66.2
wcwidth        0.2.13

I suppose fixing this is just adding setuptools to the requirements?

@mkb79
Copy link
Owner

mkb79 commented Mar 17, 2024

Thank you for this information. I am already aware of this problem. setuptools should actually be installed in most Python environments. Therefore, the error should only occur in rare cases. That's also why I hadn't noticed it until recently.

To solve this problem with pipx, you can run pipx inject audible-cli setuptools too. But I will include setuptools in the list of dependencies in the next release. In the meantime, I'll keep this issue open to make it easier for everyone to find.

Best regards

@mkb79 mkb79 pinned this issue Mar 17, 2024
@mkb79 mkb79 added bug Something isn't working dependencies Pull requests that update a dependency file labels Mar 17, 2024
@mkb79 mkb79 linked a pull request Mar 18, 2024 that will close this issue
@mkb79 mkb79 reopened this Mar 19, 2024
@mkb79
Copy link
Owner

mkb79 commented Mar 19, 2024

The master branch now includes a fix for this issue. I'll close this issue, when the fix will be released.

@mkb79
Copy link
Owner

mkb79 commented Mar 19, 2024

v0.3.0 is now out

@mkb79 mkb79 closed this as completed Mar 19, 2024
@StefanLobbenmeier
Copy link
Author

just to confirm, I just ran pipx uninstall audible-cli and pipx install audible-cli and received

audible --version
audible-cli, version 0.3.1 (up-to-date)

Surprisingly pipx runpip audible-cli list does not include setuptools, but it seems to work nonetheless.

@StefanLobbenmeier
Copy link
Author

using importlib.metadata over setuptools (pkg_resources) to get entrypoints

nevermind, it is no longer needed 😄 so all good

@mkb79
Copy link
Owner

mkb79 commented Mar 22, 2024

Thank you for this information. Some user reported, that they have issues downloading aax files. Do you have them too?

@StefanLobbenmeier
Copy link
Author

StefanLobbenmeier commented Mar 22, 2024

Yeah looks like I have the same issue:

audible -v DEBUG download -a B...X --aax
debug: Audible-cli version: 0.3.1
debug: App dir: ~/.audible
debug: Plugin dir: ~/.audible/plugins
debug: Using asyncio.run ...
debug: Config loaded from config.toml
debug: Auth file audible.json for profile audible loaded.

No new files downloaded.

Adding a c at the end to download an aaxc file works

@StefanLobbenmeier
Copy link
Author

it is a fairly new audiobook, I suspect it might not have aac. But using --all I can download some audiobooks:

error: 5.14 - Der Orden des Phönix (Teil 1) is not downloadable in AAX format
Nicht_einschlafen-LC_128_44100_stereo.aax:  25%|████████████▊                                       | 7.04M/28.6M [00:04<00:05, 4.49MB/s]

@mkb79
Copy link
Owner

mkb79 commented Mar 22, 2024

I've found the reason for the aax issue. Fix is on the way. In the meantime you can use --timeout 0. But you have to wait 1 to 2 minutes. The Amazon server have some trouble with head requests. Get request to the same URI are answered in some milliseconds.

PS: Schönes Audiobuch. Das gab es glaube ich mal kostenlos?

@StefanLobbenmeier
Copy link
Author

StefanLobbenmeier commented Mar 22, 2024

PS: Schönes Audiobuch. Das gab es glaube ich mal kostenlos?

yeah exactly, most of my library is just audiobooks that I got for free and never listened to 😄 but if you can recommend it I will give it a go

(it was free last year it seems: https://www.mydealz.de/search?q=nicht%20einschlafen)
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants