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

ERROR: PlexTraktSync 0.34.0: No module named 'trakt.auth' #2167

Closed
2 of 3 tasks
etsianavas opened this issue Jan 29, 2025 · 12 comments
Closed
2 of 3 tasks

ERROR: PlexTraktSync 0.34.0: No module named 'trakt.auth' #2167

etsianavas opened this issue Jan 29, 2025 · 12 comments

Comments

@etsianavas
Copy link

etsianavas commented Jan 29, 2025

Confirmation

  • I have read the README.md on the project homepage
  • I have checked if an identical issue or discussion already exists
  • I have tried downgrading to find version that can be used as a workaround

The problem

Hi, I'm trying to install install this as a docker container through portainer.
After I give the trakt app client secret I get this error.

Steps to reproduce the behavior

Please enter your client id: *client id form trakt*
Please enter your client secret:

Error trace / logs

Please enter your client secret:

Attempting to authenticate with Trakt

ERROR    No module named 'trakt.auth'

         ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
         │ /app/plextraktsync/cli.py:28 in wrap                                                                                                                                                                                                                                                                                                      │
         │                                                                                                                                                                                                                                                                                                                                           │
         │    25 │   │   │   cmd = getattr(module, name)                                                                                                                                                                                                                                                                                             │
         │    26 │   │   │                                                                                                                                                                                                                                                                                                                           │
         │    27 │   │   │   try:                                                                                                                                                                                                                                                                                                                    │
         │ ❱  28 │   │   │   │   cmd(*args, **kwargs)                                                                                                                                                                                                                                                                                                │
         │    29 │   │   │   except EOFError as e:                                                                                                                                                                                                                                                                                                   │
         │    30 │   │   │   │   raise ClickException(f"Program requested terminal, No terminal is                                                                                                                                                                                                                                                   │
         │       connected: {e}")                                                                                                                                                                                                                                                                                                                    │
         │    31 │   │   │   except ClickException as e:                                                                                                                                                                                                                                                                                             │
         │                                                                                                                                                                                                                                                                                                                                           │
         │ /app/plextraktsync/commands/sync.py:50 in sync                                                                                                                                                                                                                                                                                            │
         │                                                                                                                                                                                                                                                                                                                                           │
         │   47 │   │   logger.warning('"plextraktsync sync --batch-delay=<number>" is deprecated use                                                                                                                                                                                                                                                │
         │      "plextraktsync ---batch-delay=<number> sync"')                                                                                                                                                                                                                                                                                       │
         │   48 │   │   config.update(batch_delay=batch_delay)                                                                                                                                                                                                                                                                                       │
         │   49 │                                                                                                                                                                                                                                                                                                                                    │
         │ ❱ 50 │   ensure_login()                                                                                                                                                                                                                                                                                                                   │
         │   51 │   wc = factory.walk_config.update(movies=movies, shows=shows, watchlist=watchlist)                                                                                                                                                                                                                                                 │
         │   52 │   w = factory.walker                                                                                                                                                                                                                                                                                                               │
         │   53                                                                                                                                                                                                                                                                                                                                      │
         │                                                                                                                                                                                                                                                                                                                                           │
         │ /app/plextraktsync/commands/login.py:14 in ensure_login                                                                                                                                                                                                                                                                                   │
         │                                                                                                                                                                                                                                                                                                                                           │
         │   11 │   │   plex_login_autoconfig()                                                                                                                                                                                                                                                                                                      │
         │   12 │                                                                                                                                                                                                                                                                                                                                    │
         │   13 │   if not has_trakt_token():                                                                                                                                                                                                                                                                                                        │
         │ ❱ 14 │   │   trakt_login_autoconfig()                                                                                                                                                                                                                                                                                                     │
         │   15                                                                                                                                                                                                                                                                                                                                      │
         │   16                                                                                                                                                                                                                                                                                                                                      │
         │   17 def login():                                                                                                                                                                                                                                                                                                                         │
         │                                                                                                                                                                                                                                                                                                                                           │
         │ /app/plextraktsync/commands/trakt_login.py:56 in trakt_login_autoconfig                                                                                                                                                                                                                                                                   │
         │                                                                                                                                                                                                                                                                                                                                           │
         │   53                                                                                                                                                                                                                                                                                                                                      │
         │   54                                                                                                                                                                                                                                                                                                                                      │
         │   55 def trakt_login_autoconfig():                                                                                                                                                                                                                                                                                                        │
         │ ❱ 56 │   login()                                                                                                                                                                                                                                                                                                                          │
         │   57                                                                                                                                                                                                                                                                                                                                      │
         │   58                                                                                                                                                                                                                                                                                                                                      │
         │   59 def trakt_login():                                                                                                                                                                                                                                                                                                                   │
         │                                                                                                                                                                                                                                                                                                                                           │
         │ /app/plextraktsync/commands/trakt_login.py:69 in login                                                                                                                                                                                                                                                                                    │
         │                                                                                                                                                                                                                                                                                                                                           │
         │   66 def login():                                                                                                                                                                                                                                                                                                                         │
         │   67 │   print = factory.print                                                                                                                                                                                                                                                                                                            │
         │   68 │   api = factory.trakt_api                                                                                                                                                                                                                                                                                                          │
         │ ❱ 69 │   trakt_authenticate(api)                                                                                                                                                                                                                                                                                                          │
         │   70 │   user = api.me.username                                                                                                                                                                                                                                                                                                           │
         │   71 │                                                                                                                                                                                                                                                                                                                                    │
         │   72 │   CONFIG = factory.config                                                                                                                                                                                                                                                                                                          │
         │                                                                                                                                                                                                                                                                                                                                           │
         │ /app/plextraktsync/commands/trakt_login.py:42 in trakt_authenticate                                                                                                                                                                                                                                                                       │
         │                                                                                                                                                                                                                                                                                                                                           │
         │   39 │   │                                                                                                                                                                                                                                                                                                                                │
         │   40 │   │   print("Attempting to authenticate with Trakt")                                                                                                                                                                                                                                                                               │
         │   41 │   │   try:                                                                                                                                                                                                                                                                                                                         │
         │ ❱ 42 │   │   │   return api.device_auth(client_id=client_id, client_secret=client_secret)                                                                                                                                                                                                                                                 │
         │   43 │   │   except (ForbiddenException, JSONDecodeError) as e:                                                                                                                                                                                                                                                                           │
         │   44 │   │   │   print(error(f"Log in to Trakt failed: {e}, Try again."))                                                                                                                                                                                                                                                                 │
         │   45                                                                                                                                                                                                                                                                                                                                      │
         │                                                                                                                                                                                                                                                                                                                                           │
         │ /app/plextraktsync/trakt/TraktApi.py:57 in device_auth                                                                                                                                                                                                                                                                                    │
         │                                                                                                                                                                                                                                                                                                                                           │
         │    54 │   def device_auth(client_id: str, client_secret: str):                                                                                                                                                                                                                                                                            │
         │    55 │   │   trakt.core.AUTH_METHOD = trakt.core.DEVICE_AUTH                                                                                                                                                                                                                                                                             │
         │    56 │   │                                                                                                                                                                                                                                                                                                                               │
         │ ❱  57 │   │   return trakt.init(client_id=client_id, client_secret=client_secret, store=True)                                                                                                                                                                                                                                             │
         │    58 │                                                                                                                                                                                                                                                                                                                                   │
         │    59 │   @cached_property                                                                                                                                                                                                                                                                                                                │
         │    60 │   @rate_limit()                                                                                                                                                                                                                                                                                                                   │
         │                                                                                                                                                                                                                                                                                                                                           │
         │ /usr/local/lib/python3.13/site-packages/trakt/core.py:67 in init                                                                                                                                                                                                                                                                          │
         │                                                                                                                                                                                                                                                                                                                                           │
         │    64                                                                                                                                                                                                                                                                                                                                     │
         │    65 def init(*args, **kwargs):                                                                                                                                                                                                                                                                                                          │
         │    66 │   """Run the auth function specified by *AUTH_METHOD*"""                                                                                                                                                                                                                                                                          │
         │ ❱  67 │   from trakt.auth import init_auth                                                                                                                                                                                                                                                                                                │
         │    68 │                                                                                                                                                                                                                                                                                                                                   │
         │    69 │   return init_auth(AUTH_METHOD, *args, **kwargs)                                                                                                                                                                                                                                                                                  │
         │    70                                                                                                                                                                                                                                                                                                                                     │
         ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

         ModuleNotFoundError: No module named 'trakt.auth'

Error: Error running sync command: No module named 'trakt.auth'

Expected behavior

The expected behavior is to log in to trakt and start syncing

Inspect of problematic items

Workarounds

No response

Config file contents

Install method

docker-compose

Version

0.34.0

Python Version

3.9.2

Plex Server Version

1.41.3.9314

Operating System and Version

OpenMediaVault

@glensc

This comment has been minimized.

@glensc glensc changed the title ERROR No module named 'trakt.auth' ERROR: PlexTraktSync 0.34.0: No module named 'trakt.auth' Jan 29, 2025
@glensc
Copy link
Collaborator

glensc commented Jan 29, 2025

Our docker image looks ok, also plextraktsync info shows ok.

are you sure you don't have some customizations? and what's the docker image full address you're using?

❯ docker-compose run --rm plextraktsync sh

/app $ find /usr/local/lib/python3.13/site-packages/trakt/ -name 'api.py'
/usr/local/lib/python3.13/site-packages/trakt/api.py

/app $ pip list|grep trakt
pytrakt            4.0.0

/app $ python -m trakt.api
/app $ 
❯ docker-compose run --rm plextraktsync info
PlexTraktSync Version: 0.34.0
Python Version: 3.13.1 (main, Dec  4 2024, 21:46:24) [GCC 13.2.1 20231014]
Plex API Version: 4.16.1
Trakt API Version: 4.0.0

@etsianavas
Copy link
Author

I'm using the docker compose as it is in the readme, with minor changes

services:
  plextraktsync:
    image: ghcr.io/taxel/plextraktsync
    command: sync
    container_name: plextraktsync
    restart: unless-stopped
    volumes:
      - ./config:/app/config
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Athens

@mattsizzle
Copy link

Encountered the same error on the latest docker tag. Using plextraktsync:0.33 image the error was not present.

@m8tec
Copy link

m8tec commented Jan 30, 2025

Got the same error after I updated to 0.34.0. After downgrading to 0.33.0 as suggested by @mattsizzle it works fine.

glensc added a commit to glensc/python-pytrakt that referenced this issue Jan 30, 2025
Apparently it wasn't included in pip package at all.

Fix for Taxel/PlexTraktSync#2167
@etsianavas
Copy link
Author

OK, so after repulling the latest image it works fine now.
Thank you for the update.

@glensc
Copy link
Collaborator

glensc commented Jan 30, 2025

Weird. The fix is not yet released... :)

@glensc
Copy link
Collaborator

glensc commented Jan 30, 2025

apparently, only trakt initial pin auth is broken, if you finished trakt auth other ways (older image), then this breakage does not affect you anymore...

@vanhecke
Copy link

vanhecke commented Jan 30, 2025

I have the exact same error on a vanilla debian 12 install. @etsianavas could you please reopen the issue?

Workaround is to downgrade for login:

pipx install PlexTraktSync==0.33.1 --force
plextraktsync login
plextraktsync self-update

@etsianavas etsianavas reopened this Jan 31, 2025
@etsianavas
Copy link
Author

Weird. The fix is not yet released... :)

apparently, only trakt initial pin auth is broken, if you finished trakt auth other ways (older image), then this breakage does not affect you anymore...

Yeah, I completed the auth with 0.33.0 first and the repulled the latest.

I have the exact same error on a vanilla debian 12 install. @etsianavas could you please reopen the issue?

Workaround is to downgrade for login:

pipx install PlexTraktSync==0.33.1 --force
plextraktsync login
plextraktsync self-update

Reopened

@glensc
Copy link
Collaborator

glensc commented Jan 31, 2025

err, plextraktsync self-update will update to latest again, what's the point?

@glensc
Copy link
Collaborator

glensc commented Jan 31, 2025

Should be fixed with #2171 and 0.34.1

@glensc glensc closed this as completed Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants