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

Python 3.12 RC from winsows store broke trakts #257

Closed
panaris opened this issue Aug 28, 2023 · 20 comments
Closed

Python 3.12 RC from winsows store broke trakts #257

panaris opened this issue Aug 28, 2023 · 20 comments
Labels
bug Something isn't working dependencies Pull requests that update a dependency file setup Trouble with installation

Comments

@panaris
Copy link

panaris commented Aug 28, 2023

Installation through pip works fine though.
erCp9sB

@iamkroot
Copy link
Owner

How exactly did you install trakt-scrobbler? With pipx this shouldn't happen

@iamkroot iamkroot added the setup Trouble with installation label Aug 29, 2023
@panaris
Copy link
Author

panaris commented Sep 2, 2023

I removed old python version. Installed lates windows store version. Removed pipx and the folder $home/.local/pipx. Then tried to install trakts through pipx. Everything went well but init failed. Then tried to uninstall via pipx and install though pip and same thing happened. Trakts help works fine.

@iamkroot
Copy link
Owner

Hmm, I don't see anything in the 3.12 changelogs about the pkg_resources package. Maybe try googling the error message?

@bulletproof2k
Copy link

How to update and which version of Plexapi are you using now?

@iamkroot
Copy link
Owner

iamkroot commented Sep 20, 2023

How to update and which version of Plexapi are you using now?

@bulletproof2k the current thread is about Python 3.12, and not a new version of trakt scrobbler. There haven't been any recent changes to the plex api usage in here. So if you're facing problems, please raise an issue (or if you already created it and I forgot, add a bump comment to it)

Updating the python installation should ideally require no changes to this scrobbler. But alas, we don't live in such a perfect world.

@bulletproof2k
Copy link

No problem, thanks for the quick response 👍

@iamkroot
Copy link
Owner

iamkroot commented Oct 8, 2023

@panaris Thanks for the bug report. This was a bug in an upstream dependency Diaoul/babelfish#46 (it uses a deprecated module which broke in Python3.12). I have pushed a fix for this, and it should work in Python3.12 now.
Install from branch:

  1. Stop the scrobbler with trakts stop
  2. Run pipx install --force --pip-args='--force-reinstall' git+https://github.com/iamkroot/trakt-scrobbler.git@master
  3. Start scrobbler with trakts start

(Or, wait for a new version)

@iamkroot iamkroot added bug Something isn't working dependencies Pull requests that update a dependency file labels Oct 8, 2023
@panaris
Copy link
Author

panaris commented Oct 11, 2023

https://bit.ly/3QbHbdD

with the new push

@iamkroot
Copy link
Owner

That's weird, I thought I already fixed it... Could you please paste the output of trakts init -vvv

@MarsAgainstVenus
Copy link

So what is the fix for this? Trying to install it now and receiving the same error.

@MarsAgainstVenus
Copy link

So what is the fix for this? Trying to install it now and receiving the same error.

Never mind. This did work for me:

pipx install --force --pip-args='--force-reinstall' git+https://github.com/iamkroot/trakt-scrobbler.git@master

Just a heads up that this is still occurring with fresh installs.

@iamkroot
Copy link
Owner

iamkroot commented Jan 11, 2024

@MarsAgainstVenus are installing from the master as shown here? There is no stable release with the fix yet.

EDIT: Good to see that you got it working. Will pin this issue for now.

@iamkroot iamkroot pinned this issue Jan 11, 2024
@coqre
Copy link

coqre commented May 14, 2024

I followed this but I get this error:

ERROR: Invalid requirement: "'--force-reinstall'" Cannot determine package name from spec 'git+https://github.com/iamkroot/trakt-scrobbler.git@master'. Check package spec for errors.

I'm a beginner, so I apologize for knowing very little.
:'D

@iamkroot
Copy link
Owner

@DoncanC try #257 (comment)

@coqre
Copy link

coqre commented May 16, 2024

@DoncanC try #257 (comment)

Yes but the error is the same

This will guide you through the setup of the scrobbler.
If you wish to quit at any point, press Ctrl+C or Cmd+C

  AttributeError

  module 'pkgutil' has no attribute 'ImpImporter'

  at AppData\Local\Programs\Python\Python312\Lib\site-packages\pkg_resources\__init__.py:2191 in <module>
      2187│     dist_groups = map(find_distributions, resolved_paths)
      2188│     return next(dist_groups, ())
      2189│
      2190│
    → 2191│ register_finder(pkgutil.ImpImporter, find_on_path)
      2192│
      2193│ if hasattr(importlib_machinery, 'FileFinder'):
      2194│     register_finder(importlib_machinery.FileFinder, find_on_path)
      2195│

:/

EDIT:
Sorry for my english, is a terrible B1.

I've found a solution here!!

But so I get this error
image

I'll informate you if I get other error... for now all right!! :D

@JWWolstenholme
Copy link

JWWolstenholme commented Jul 21, 2024

That's weird, I thought I already fixed it... Could you please paste the output of trakts init -vvv

Since OP never responded to you and since I'm experiencing the same problem with Python 3.12.4 (installed via python's "full installer", not windows store as issue title states) here's my output from trakts init -vvv:

Expand
C:\Users\redacted>trakts init -vvv
This will guide you through the setup of the scrobbler.
If you wish to quit at any point, press Ctrl+C or Cmd+C

Stack trace:

9  pipx\venvs\trakt-scrobbler\Lib\site-packages\clikit\console_application.py:131 in run
    129│             parsed_args = resolved_command.args
    130│
  → 131│             status_code = command.handle(parsed_args, io)
    132│         except KeyboardInterrupt:
    133│             status_code = 1

8  pipx\venvs\trakt-scrobbler\Lib\site-packages\clikit\api\command\command.py:120 in handle
    118│     def handle(self, args, io):  # type: (Args, IO) -> int
    119│         try:
  → 120│             status_code = self._do_handle(args, io)
    121│         except KeyboardInterrupt:
    122│             if io.is_debug():

7  pipx\venvs\trakt-scrobbler\Lib\site-packages\clikit\api\command\command.py:171 in _do_handle
    169│         handler_method = self._config.handler_method
    170│
  → 171│         return getattr(handler, handler_method)(args, io, self)
    172│
    173│     def __repr__(self):  # type: () -> str

6  pipx\venvs\trakt-scrobbler\Lib\site-packages\cleo\commands\command.py:92 in wrap_handle
     90│         self._command = command
     91│
  →  92│         return self.handle()
     93│
     94│     def handle(self):  # type: () -> Optional[int]

5  pipx\venvs\trakt-scrobbler\Lib\site-packages\trakt_scrobbler\commands\init.py:24 in handle
    22│         self.comment("This will guide you through the setup of the scrobbler.")
    23│         self.info("If you wish to quit at any point, press Ctrl+C or Cmd+C")
  → 24│         from trakt_scrobbler.player_monitors import collect_monitors
    25│
    26│         monitors = {Mon for Mon in collect_monitors() if isinstance(Mon.name, str)}

4  pipx\venvs\trakt-scrobbler\Lib\site-packages\trakt_scrobbler\player_monitors\__init__.py:4 in <module>
     2│ from pathlib import Path
     3│ from importlib import import_module
  →  4│ from .monitor import Monitor
     5│
     6│

3  pipx\venvs\trakt-scrobbler\Lib\site-packages\trakt_scrobbler\player_monitors\monitor.py:9 in <module>
      7│ from trakt_scrobbler import config, logger
      8│ from trakt_scrobbler.file_info import get_media_info
  →   9│ from trakt_scrobbler.notifier import notify
     10│ from trakt_scrobbler.utils import AutoloadError, ResumableTimer
     11│

2  pipx\venvs\trakt-scrobbler\Lib\site-packages\trakt_scrobbler\notifier.py:104 in <module>
    102│
    103│ else:
  → 104│     from win10toast import ToastNotifier
    105│     toaster = ToastNotifier()
    106│

1  pipx\venvs\trakt-scrobbler\Lib\site-packages\win10toast\__init__.py:15 in <module>
     13│ from os import path
     14│ from time import sleep
  →  15│ from pkg_resources import Requirement
     16│ from pkg_resources import resource_filename
     17│

AttributeError

module 'pkgutil' has no attribute 'ImpImporter'

at pipx\venvs\trakt-scrobbler\Lib\site-packages\pkg_resources\__init__.py:2191 in <module>
    2187│     dist_groups = map(find_distributions, resolved_paths)
    2188│     return next(dist_groups, ())
    2189│
    2190│
  → 2191│ register_finder(pkgutil.ImpImporter, find_on_path)
    2192│
    2193│ if hasattr(importlib_machinery, 'FileFinder'):
    2194│     register_finder(importlib_machinery.FileFinder, find_on_path)
    2195│

In the meantime, I'll use one of the solutions above. Failing that I'll just downgrade python.

I doubt this is relevant to this issue but might be worth mentioning that python in my PATH is set to a bash script that runs py instead, which at the time of writing just defaults to running the version mentioned above. Should be no difference.

@iamkroot
Copy link
Owner

@JWWolstenholme what version of the scrobbler are you running (output of trakts -V)? This should have been fixed in the latest beta (v1.7.0-beta1)

Install beta version:

  1. Stop the scrobbler with trakts stop
  2. pipx uninstall trakt-scrobbler
  3. Run pipx install --pip-args='--pre' trakt-scrobbler==1.7.0b1
  4. Start scrobbler with trakts start

@JWWolstenholme
Copy link

JWWolstenholme commented Jul 21, 2024

@iamkroot I was running 1.6.3 as I didn't go out of my way to specify any version during install. I can also confirm that 1.6.3 works on python backdated to 3.11.9.
I've tested out v1.7.0-beta1 on python 3.12.4 and can confirm that works. Thanks for the help!

Note that I had to correct step 3. in your instructions to pipx install --pip-args=--pre trakt-scrobbler==1.7.0b1 (something to do with pip-args starting with -- I think?):

C:\Users\redacted>pipx install --pip-args='--pre' trakt-scrobbler==1.7.0b1
Fatal error from pip prevented installation. Full pip output in file:
    C:\Users\redacted\pipx\logs\cmd_2024-07-22_03.34.28_pip_errors.log

Some possibly relevant errors from pip install:
    ERROR: Invalid requirement: "'--pre'": Expected package name at the start of dependency specifier

Error installing trakt-scrobbler from spec 'trakt-scrobbler==1.7.0b1'.

C:\Users\redacted>pipx install --pip-args=--pre trakt-scrobbler==1.7.0b1
  installed package trakt-scrobbler 1.7.0b1, installed using Python 3.12.4
  These apps are now globally available
    - trakts.exe
done! ✨ 🌟 ✨

C:\Users\redacted>trakts
Trakts version 1.7.0-beta.1
...

@Dragoonstorm1
Copy link

Yep this is still happening to me, the stable and beta branches didnt work, same error. But the pipx install --force --pip-args='--force-reinstall' git+https://github.com/iamkroot/trakt-scrobbler.git@master command did the trick.

@lowbit
Copy link

lowbit commented Nov 20, 2024

trakts init
This will guide you through the setup of the scrobbler.
If you wish to quit at any point, press Ctrl+C or Cmd+C

  AttributeError

  module 'pkgutil' has no attribute 'ImpImporter'

  at pipx\venvs\trakt-scrobbler\Lib\site-packages\pkg_resources\__init__.py:2191 in <module>
      2187│     dist_groups = map(find_distributions, resolved_paths)
      2188│     return next(dist_groups, ())
      2189│
      2190│
    → 2191│ register_finder(pkgutil.ImpImporter, find_on_path)
      2192│
      2193│ if hasattr(importlib_machinery, 'FileFinder'):
      2194│     register_finder(importlib_machinery.FileFinder, find_on_path)
      2195│

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 setup Trouble with installation
Projects
None yet
Development

No branches or pull requests

8 participants