trakt / Plex-Trakt-Scrobbler

Add what you are watching on Plex to trakt.tv
1.44k stars 167 forks source link

Critical Error: Unable to import the playhouse.apsw_ext library (No module named apsw) #521

Open lazy-gipsy-bear opened 5 years ago

lazy-gipsy-bear commented 5 years ago

Hi.

I have (strange) problem with plex on docker container based on linuxserver/plex image on Odroid HC2 (Odroid XU4) Message "Critical Error: Unable to import the playhouse.apsw_ext library (No module named apsw)" in Plex web interface.

plugin log: com.plexapp.plugins.trakttv.zip I created the Plug-in Support\Data\com.plexapp.plugins.trakttv\advanced.ini file with the following contents: [libraries] cache_path = /var/lib/tfp/libraries libraries_path = /var/lib/tfp/libraries

I copied Linux/armv7_hf folder from Plug-ins/Trakttv.bundle/Contents/Libraries to /var/lib/tfp/libraries. I set permission for content /var/lib/tfp/libraries

This configuration work on docker contaner based on lsioarmhf/plex image and work perfect. But after i tried turn container to linuxserver/plex (after linuxserver team include multiarch support to this image) trakttv plugin stop work :(

I tried add to the Plug-in Support\Data\com.plexapp.plugins.trakttv\advanced.ini file next content: cpu_architecture = armv7_hf

And I copied Linux/armv6_hf folder from Plug-ins/Trakttv.bundle/Contents/Libraries to /var/lib/tfp/libraries because linuxserver/plex image support exactly armv6-32 architecture.

Did not help for me

theFeverDog commented 5 years ago

I have the same issue on a Synology RS814 (armv7_hf) if I‘m running a 1.15.x Plex server version. If I downgrade to 1.14.x the plugin runs without issues.

ydkn commented 5 years ago

Same problem here.

Here is the output from the plugin (the interesting parts):

2019-03-04 23:32:59,953 - plugin                           (-490de980) :  INFO (plugin:19) - Configured trakt.py (timeout=(6.0499999999999998, 24), base_url='https://api.trakt.tv', keep_alive=True, adapter_kwargs={'pool_connections': 10, 'pool_maxsize': 10, 'max_retries': Retry(total=3, connect=None, read=0, redirect=None)})
2019-03-04 23:32:59,987 - plugin                           (-490de980) :  INFO (plugin:19) - Initialized 0 modules: 
2019-03-04 23:32:59,988 - plugin.modules.core.manager      (-490de980) :  INFO (plugin.modules.core.manager:41) - Module construction has been cancelled due to a critical plugin error
2019-03-04 23:32:59,989 - com.plexapp.plugins.trakttv      (-490de980) :  INFO (com.plexapp.plugins.trakttv:611) - Started plug-in
2019-03-04 23:32:59,990 - plugin                           (-50703ba0) :  INFO (plugin:19) - X-Plex-Token: available
2019-03-04 23:33:00,315 - com.plexapp.plugins.trakttv      (-490de980) :  INFO (com.plexapp.plugins.trakttv:184) - Socket server started on port 38077
2019-03-04 23:33:00,317 - com.plexapp.plugins.trakttv      (-490de980) :  INFO (com.plexapp.plugins.trakttv:25) - Entering run loop
2019-03-04 23:33:01,771 - plugin.modules.migrations.main   (-50703ba0) :  WARNING (plugin.modules.migrations.main:31) - Database connection failed: 'APSWDatabaseWrapper' object has no attribute 'timeout'
Traceback (most recent call last):
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/plugin/modules/migrations/main.py", line 26, in start
    db.connect()
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/peewee.py", line 3089, in connect
    **self.connect_kwargs)
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/exception_wrappers/database/apsw/peewee.py", line 19, in _connect
    if self.timeout is not None:
AttributeError: 'APSWDatabaseWrapper' object has no attribute 'timeout'
2019-03-04 23:33:01,783 - plugin.preferences.main          (-50703ba0) :  WARNING (plugin.preferences.main:43) - Unable to retrieve option 'activity.mode': 'APSWDatabaseWrapper' object has no attribute 'timeout'
Traceback (most recent call last):
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/plugin/preferences/main.py", line 39, in get
    option = option_cls.get(account)
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/plugin/preferences/options/core/base/simple.py", line 48, in get
    'value': self._pack(self.default),
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/peewee.py", line 4106, in get_or_create
    return sq.get(), False
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/peewee.py", line 2725, in get
    return clone.execute().next()
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/peewee.py", line 2769, in execute
    self._qr = ResultWrapper(model_class, self._execute(), query_meta)
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/peewee.py", line 2455, in _execute
    return self.database.execute_sql(sql, params, self.require_commit)
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/peewee.py", line 3150, in execute_sql
    cursor = self.get_cursor()
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/peewee.py", line 3116, in get_cursor
    return self.get_conn().cursor()
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/peewee.py", line 3109, in get_conn
    self.connect()
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/peewee.py", line 3089, in connect
    **self.connect_kwargs)
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Shared/exception_wrappers/database/apsw/peewee.py", line 19, in _connect
    if self.timeout is not None:
AttributeError: 'APSWDatabaseWrapper' object has no attribute 'timeout'
jpatriarca commented 5 years ago

Same problem here:

Odroid C2 (aarch64) DietPi v6.21.1 Plex Media Server 1.15 Plex-Trakt-Scrobbler 3.0.0

Waiting feedback to correct this issue

vrachnis commented 5 years ago

For plex 1.15, you will have to compile the APSW binding manually. Here's what I had to do on a raspberry pi:

Compile a custom version of python2.7

Since Plex is running a python version that's compiled with UCS-2, and the raspbian python is compiled with UCS-4, the apsw library that's distributed in the repos is UCS-4, that cannot be loaded in plex.

  1. Download python 2.7 from https://github.com/python/cpython/releases
  2. extract it somewhere, and build it: ./configure --enable-unicode=ucs2 && make

Build python-apsw using the custom python version

  1. Install libsqlite3-dev
  2. Checkout https://github.com/rogerbinns/apsw/
  3. Chekout the commit 64a42163b0b056d9f30cd645a581343e4052e331, which corresponds to the libsqlite version that raspbian is distributing
  4. Build APSW: ~/cpython-2.7/python setup.py bdist
  5. Copy the library file to its proper place: sudo cp /tmp/apsw/build/lib.linux-armv7l-2.7/apsw.so /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload

Restart plex, and you're done.

JBeresford commented 5 years ago

Anyone have any ideas on how to fix this on a Seagate Personal Cloud. I've tried dropping it into the directory I think it should be, and it's wiped out by the restart - thus giving me an infinite loop of no apsw library available

klebercabral commented 5 years ago

For plex 1.15, you will have to compile the APSW binding manually. Here's what I had to do on a raspberry pi:

Compile a custom version of python2.7

Since Plex is running a python version that's compiled with UCS-2, and the raspbian python is compiled with UCS-4, the apsw library that's distributed in the repos is UCS-4, that cannot be loaded in plex.

  1. Download python 2.7 from https://github.com/python/cpython/releases
  2. extract it somewhere, and build it: ./configure --enable-unicode=ucs2 && make

Build python-apsw using the custom python version

  1. Install libsqlite3-dev
  2. Checkout https://github.com/rogerbinns/apsw/
  3. Chekout the commit 64a42163b0b056d9f30cd645a581343e4052e331, which corresponds to the libsqlite version that raspbian is distributing
  4. Build APSW: ~/cpython-2.7/python setup.py bdist
  5. Copy the library file to its proper place: sudo cp /tmp/apsw/build/lib.linux-armv7l-2.7/apsw.so /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload

Restart plex, and you're done.

Tkz

lucaspir7 commented 5 years ago

For plex 1.15, you will have to compile the APSW binding manually. Here's what I had to do on a raspberry pi:

Compile a custom version of python2.7

Since Plex is running a python version that's compiled with UCS-2, and the raspbian python is compiled with UCS-4, the apsw library that's distributed in the repos is UCS-4, that cannot be loaded in plex.

1. Download python 2.7 from https://github.com/python/cpython/releases

2. extract it somewhere, and build it: ./configure --enable-unicode=ucs2 && make

Build python-apsw using the custom python version

1. Install `libsqlite3-dev`

2. Checkout https://github.com/rogerbinns/apsw/

3. Chekout the commit 64a42163b0b056d9f30cd645a581343e4052e331, which corresponds to the libsqlite version that raspbian is distributing

4. Build APSW: `~/cpython-2.7/python setup.py bdist`

5. Copy the library file to its proper place: `sudo cp /tmp/apsw/build/lib.linux-armv7l-2.7/apsw.so /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload`

Restart plex, and you're done.

I'm very sorry for my ignorance. Can you please write me what to do one point after another so that I only have to write it in the terminal possibly without causing damages? Thanks

andreformosa commented 5 years ago

@vrachnis could you upload your compiled apsw.so by any chance?

Belphemur commented 5 years ago

I've follow the instructions of @vrachnis and here is the apsw.so file. https://www.aaflalo.me/sdm_downloads/apsw-so-for-python-2-7-for-plex/

It works for and Odroid HC2 and should also for a Raspberry Pi. You might need to update your sqlite to stretch-backports.

andreformosa commented 5 years ago

That worked just fine @Belphemur, thanks a lot for the upload. I couldn't get it to compile due to the compilation requiring a newer version SQLite, which I didn't manage to update.

theFeverDog commented 5 years ago

Does anyone have an idea how to do this on a Synology with an ARMv7?

Belphemur commented 5 years ago

@theFeverDog Should work with the file I gave. Odroid HC2 is also a ARMv7 (armhf).

Doesn't cost anything to try :)

martinlaune commented 5 years ago

hi @Belphemur i tried your file but it did not work on a raspberry pi

Belphemur commented 5 years ago

Should work on a Raspberry Pi 3. Not for the older version that aren't based on armv7 armhf


From: martinlaune notifications@github.com Sent: Wednesday, April 3, 2019 12:24 To: trakt/Plex-Trakt-Scrobbler Cc: Antoine Aflalo; Mention Subject: Re: [trakt/Plex-Trakt-Scrobbler] Critical Error: Unable to import the playhouse.apsw_ext library (No module named apsw) (#521)

hi @Belphemur i tried your file but it did not work on a raspberry pi

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

martinlaune commented 5 years ago

Hi @Belphemur after copying the file apsw.so into /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload and reboot the Rpi3 (RPi 3 Model B (armv7l)) i got the folowing message in Trakt "Exception: SQLError: no such column: t1.deleted"

Belphemur commented 5 years ago

@martinlaune that's a whole different error.

It means you have a problem with the sqlite database used by the plug-in. I'd advise to reinstall the plug-in or open a new issue about that to see with the devs.


From: martinlaune notifications@github.com Sent: Thursday, April 4, 2019 12:05 To: trakt/Plex-Trakt-Scrobbler Cc: Antoine Aflalo; Mention Subject: Re: [trakt/Plex-Trakt-Scrobbler] Critical Error: Unable to import the playhouse.apsw_ext library (No module named apsw) (#521)

Hi @Belphemur after copying the file apsw.so into /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload and reboot the Rpi3 (RPi 3 Model B (armv7l)) i got the folowing message: "Exception: SQLError: no such column: t1.deleted"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

OrangeTang16 commented 5 years ago

Is this an issue thats going to up fixed in an updated version of the plugin or are we required to follow the suggestions above to get this working again?

RemyPsq commented 5 years ago

For plex 1.15, you will have to compile the APSW binding manually. Here's what I had to do on a raspberry pi:

Compile a custom version of python2.7

Since Plex is running a python version that's compiled with UCS-2, and the raspbian python is compiled with UCS-4, the apsw library that's distributed in the repos is UCS-4, that cannot be loaded in plex.

  1. Download python 2.7 from https://github.com/python/cpython/releases
  2. extract it somewhere, and build it: ./configure --enable-unicode=ucs2 && make

Build python-apsw using the custom python version

  1. Install libsqlite3-dev
  2. Checkout https://github.com/rogerbinns/apsw/
  3. Chekout the commit 64a42163b0b056d9f30cd645a581343e4052e331, which corresponds to the libsqlite version that raspbian is distributing
  4. Build APSW: ~/cpython-2.7/python setup.py bdist
  5. Copy the library file to its proper place: sudo cp /tmp/apsw/build/lib.linux-armv7l-2.7/apsw.so /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload

Restart plex, and you're done.

How to update all files for a Synology NAS ?

bengt-a commented 5 years ago

How can I find out what Trakt Scrobbler program - and version - I have? It seems like mine stopped scrobbling a few weeks ago. I have a Raspberry Pi 3, with Plex Media Server 1.15.3.858

bengt-a commented 5 years ago
  1. Install libsqlite3-dev

  2. Checkout https://github.com/rogerbinns/apsw/

  3. Chekout the commit 64a42163b0b056d9f30cd645a581343e4052e331, which corresponds to the libsqlite version that raspbian is distributing

  4. Build APSW: ~/cpython-2.7/python setup.py bdist

  5. Copy the library file to its proper place: sudo cp /tmp/apsw/build/lib.linux-armv7l-2.7/apsw.so /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload

    
    Restart plex, and you're done.

I'm very sorry for my ignorance. Can you please write me what to do one point after another so that I only have to write it in the terminal possibly without causing damages? Thanks

Did you ever get the step-by-step procedure? I am not an expert (either?) and I am not sure how to do steps 2-3 in the build section. [EDIT] I figured out #2, but #3 I have no idea how to check out...

treshed commented 5 years ago

Hi, I just got it working, and here is the step by step procedure;

remove the trakt plugin (from the WebTools - UnsupportedAppStore) or uninstall from Plex.

Compile a custom version of python2.7

Since Plex is running a python version that's compiled with UCS-2, and the raspbian python is compiled with UCS-4, the apsw library that's distributed in the repos is UCS-4, that cannot be loaded in plex.

Download python 2.7 from https://github.com/python/cpython/releases
extract it somewhere, and build it: ./configure --enable-unicode=ucs2 && make

Build python-apsw using the custom python version

Install libsqlite3-dev
`apt-get install libsqlite3-dev`

Checkout https://github.com/rogerbinns/apsw/
Go to commits, go back as far as the commit starting with 64a421, open this commit and download it. 

unzip the 64a421.....apsw file and cd into it.

Build APSW: ~/cpython-2.7/python setup.py bdist
Copy the library file to its proper place: sudo cp /tmp/apsw/build/lib.linux-armv7l-2.7/apsw.so /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload

Restart plex, Reinstall the trakt.tv plugin and you're done

galactorus83 commented 5 years ago

Hi, I just got it working, and here is the step by step procedure;

remove the trakt plugin (from the WebTools - UnsupportedAppStore) or uninstall from Plex.

Compile a custom version of python2.7

Since Plex is running a python version that's compiled with UCS-2, and the raspbian python is compiled with UCS-4, the apsw library that's distributed in the repos is UCS-4, that cannot be loaded in plex.

Download python 2.7 from https://github.com/python/cpython/releases
extract it somewhere, and build it: ./configure --enable-unicode=ucs2 && make

Build python-apsw using the custom python version

Install libsqlite3-dev
`apt-get install libsqlite3-dev`

Checkout https://github.com/rogerbinns/apsw/
Go to commits, go back as far as the commit starting with 64a421, open this commit and download it. 

unzip the 64a421.....apsw file and cd into it.

Build APSW: ~/cpython-2.7/python setup.py bdist
Copy the library file to its proper place: sudo cp /tmp/apsw/build/lib.linux-armv7l-2.7/apsw.so /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload

Restart plex, Reinstall the trakt.tv plugin and you're done

@treshed do you know if this step by step procedure could work on Synology ARMv7 devices? I have Plex Media Server 1.15.4.993 installed on Synology NAS DS414 and since PMS 1.15.x, the Plex-Trakt-Scrobbler 3.0.0 stopped working due to this APSW issue, so I wonder if your guide is applicable to Synology?

bengt-a commented 5 years ago

Checkout https://github.com/rogerbinns/apsw/
Go to commits, go back as far as the commit starting with 64a421, open this commit and download it. 

unzip the 64a421.....apsw file and cd into it.

Sorry for obviously beeing a complete n00b, but would you be able to provide the exact steps for "checkout" and going to commits and downloading? I checked the web site but there are no commits there... I would really like to get this working again...

marine1988 commented 5 years ago
pi@orangepipc:~/apsw$ sudo ~/cpython-2.7/python setup.py bdist
[sudo] password for pi:
running bdist
running bdist_dumb
running build
running build_ext
SQLite: Using system sqlite include/libraries
installing to build/bdist.linux-armv7l/dumb
running install
running install_lib
running install_egg_info
Removing build/bdist.linux-armv7l/dumb/usr/local/lib/python2.7/site-packages/apsw-3.16.2_r1-py2.7.egg-info
Writing build/bdist.linux-armv7l/dumb/usr/local/lib/python2.7/site-packages/apsw-3.16.2_r1-py2.7.egg-info
Creating tar archive
Traceback (most recent call last):
  File "setup.py", line 896, in <module>
    'win64hackvars': win64hackvars}
  File "/home/pi/cpython-2.7/Lib/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/home/pi/cpython-2.7/Lib/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/home/pi/cpython-2.7/Lib/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/pi/cpython-2.7/Lib/distutils/command/bdist.py", line 146, in run
    self.run_command(cmd_name)
  File "/home/pi/cpython-2.7/Lib/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/home/pi/cpython-2.7/Lib/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/pi/cpython-2.7/Lib/distutils/command/bdist_dumb.py", line 124, in run
    owner=self.owner, group=self.group)
  File "/home/pi/cpython-2.7/Lib/distutils/cmd.py", line 392, in make_archive
    owner=owner, group=group)
  File "/home/pi/cpython-2.7/Lib/distutils/archive_util.py", line 245, in make_archive
    filename = func(base_name, base_dir, **kwargs)
  File "/home/pi/cpython-2.7/Lib/distutils/archive_util.py", line 101, in make_tarball
    tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress])
  File "/home/pi/cpython-2.7/Lib/tarfile.py", line 1703, in open
    stream = _Stream(name, filemode, comptype, fileobj, bufsize)
  File "/home/pi/cpython-2.7/Lib/tarfile.py", line 426, in __init__
    raise CompressionError("zlib module is not available")
tarfile.CompressionError: zlib module is not available

Im having this error compiling the commit

brassica77 commented 5 years ago

I have the same issue on a Synology RS814 (armv7_hf) if I‘m running a 1.15.x Plex server version. If I downgrade to 1.14.x the plugin runs without issues.

Hi, I recently switched from Emby To Plex on my Synology DS116 NAS (armv7_hf). Using the integrated Plex version and the plugin installed with UAS following the indications in the Wiki, everything is working fine. But as soon as I update Plex to the recent version, I encounter the error "Critical Error: Unable to import the playhouse.apsw_ext library (No module named apsw)". The only workaround I found was using Trakt plugin in Kodi, with Kodi's own Plex addon. Is there a tutorial about compiling that apsw file for my NAS?

galactorus83 commented 5 years ago

The only workaround I found was using Trakt plugin in Kodi, with Kodi's own Plex addon. Is there a tutorial about compiling that apsw file for my NAS?

Hi @brassica77, thanks for the workaround tip! Until we get a solution for our Synology NAS I will try to use the Trakt plugin in Kodi's own Plex addon. I still have a doubt because if your Plex Media Server is installed in your Synology NAS, then regardless of what Plex client you run Trakt from, it should trigger the APSW error because the Trakt plugin is installed in the server, not in Kodi's Plex addon. Could you please give more details about how you successfully run the Trakt plugin from the Kodi's Plex addon?

brassica77 commented 5 years ago

In my case, I was coming from Emby, been using it since years, and I was already using Kodi on my desktop pc to access Emby's server on the NAS on my local network. I simply installed Kodi's Trakt plugin from their own repository, by doing a search and typing Trakt. When I switched to Plex two days ago, I installed the Plex plugin from the same Kodi repository, again just by searching for Plex, and when I watch videos, without touching anything else, I still get the Trakt notifications in Kodi, and I see the red scrobbling indications on Trakt's site. I hope this helps!

galactorus83 commented 5 years ago

@brassica77 OK I understand, so you installed the Trakt plugin in Kodi, outside of Kodi's Plex addon. I will give that a try. Thanks a lot!

trex005 commented 5 years ago
pi@orangepipc:~/apsw$ sudo ~/cpython-2.7/python setup.py bdist
[sudo] password for pi:
running bdist
running bdist_dumb
running build
running build_ext
SQLite: Using system sqlite include/libraries
installing to build/bdist.linux-armv7l/dumb
running install
running install_lib
running install_egg_info
Removing build/bdist.linux-armv7l/dumb/usr/local/lib/python2.7/site-packages/apsw-3.16.2_r1-py2.7.egg-info
Writing build/bdist.linux-armv7l/dumb/usr/local/lib/python2.7/site-packages/apsw-3.16.2_r1-py2.7.egg-info
Creating tar archive
Traceback (most recent call last):
  File "setup.py", line 896, in <module>
    'win64hackvars': win64hackvars}
  File "/home/pi/cpython-2.7/Lib/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/home/pi/cpython-2.7/Lib/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/home/pi/cpython-2.7/Lib/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/pi/cpython-2.7/Lib/distutils/command/bdist.py", line 146, in run
    self.run_command(cmd_name)
  File "/home/pi/cpython-2.7/Lib/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/home/pi/cpython-2.7/Lib/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/pi/cpython-2.7/Lib/distutils/command/bdist_dumb.py", line 124, in run
    owner=self.owner, group=self.group)
  File "/home/pi/cpython-2.7/Lib/distutils/cmd.py", line 392, in make_archive
    owner=owner, group=group)
  File "/home/pi/cpython-2.7/Lib/distutils/archive_util.py", line 245, in make_archive
    filename = func(base_name, base_dir, **kwargs)
  File "/home/pi/cpython-2.7/Lib/distutils/archive_util.py", line 101, in make_tarball
    tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress])
  File "/home/pi/cpython-2.7/Lib/tarfile.py", line 1703, in open
    stream = _Stream(name, filemode, comptype, fileobj, bufsize)
  File "/home/pi/cpython-2.7/Lib/tarfile.py", line 426, in __init__
    raise CompressionError("zlib module is not available")
tarfile.CompressionError: zlib module is not available

Im having this error compiling the commit

I cobbled this together from various sources

sudo apt-get install zlib1g-dev cd PYTHONPATH/Modules/ nano Setup Uncomment this line: zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz then exit ./configure cd PYTHONPATH make clean ./configure --enable-unicode=ucs2 && make cd APSWPATH PYTHONPATH/python setup.py bdist ... Note my binary was located at ~/apsw/build/lib.linux-armv7l-2.7 instead of in /tmp/ most likely because I did not sudo anything other than the apt-get.

michealespinola commented 5 years ago

Same problem on aarch64 platform running with Plex on Nvidia Shield.

Amandysha commented 5 years ago

Same problem on Orange Pi running Plex version 1.16.1.1291- with Trakt 1.3.3-7f0f38e-linux_armv7. Very frustrated with that!

miKL63200 commented 5 years ago

Not exactly the same problem on Nvidia Shield TV : Critical Error: Unable to import the playhouse.apsw_ext library (dlopen failed: cannot locate symbol "PyFloat_Type" referenced by "/data/data/com.plexapp.mediaserver.smb/Plex Media Server/Plug-in Support/Data/com.plexapp.plugins.trakttv/Libraries/Android/aarch64/ucs2/apsw.so"...)

How to solve it ?

agneevX commented 4 years ago

Still getting the t1.deleted error. Anyone have a solution?

Vaxter commented 4 years ago

If anyone stumbles upon this, @Belphemur build should also work on most QNAP NAS with ARM.

JeeDeWee commented 4 years ago

Just found a way to avoid reinstalling the apsw.so file after each Plex update on a ARMV7 Synology. You can download the correct apsw.so file as explained in https://github.com/trakt/Plex-Trakt-Scrobbler/issues/521#issuecomment-476844277

This file you can copy into the following directory:

/volume1/Plex/Library/Application Support/Plex Media Server/Plug-ins/Trakttv.bundle/Contents/Libraries/Linux/armv7_hf/marvell-pj4/ucs2

The directory ucs2 did not exist and I had to create that folder, copy the apsw.so file in there and set the permissions using chown -R plex:users ucs2.

After this the plugin starts without error message and I (hopefully) do not need to reinstall this library after every update of Plex.

fpatrick commented 4 years ago

I've follow the instructions of @vrachnis and here is the apsw.so file. https://www.aaflalo.me/sdm_downloads/apsw-so-for-python-2-7-for-plex/

It works for and Odroid HC2 and should also for a Raspberry Pi. You might need to update your sqlite to stretch-backports.

You're the best.

michaljuris commented 4 years ago

Still getting the t1.deleted error. Anyone have a solution?

As mentioned above the problem is with the database file. The workaround is to copy workign db file from somewhere else:

https://github.com/trakt/Plex-Trakt-Scrobbler/issues/528#issuecomment-486758464

johnmarshall515 commented 4 years ago

For plex 1.15, you will have to compile the APSW binding manually. Here's what I had to do on a raspberry pi:

Compile a custom version of python2.7

Since Plex is running a python version that's compiled with UCS-2, and the raspbian python is compiled with UCS-4, the apsw library that's distributed in the repos is UCS-4, that cannot be loaded in plex.

  1. Download python 2.7 from https://github.com/python/cpython/releases
  2. extract it somewhere, and build it: ./configure --enable-unicode=ucs2 && make

Build python-apsw using the custom python version

  1. Install libsqlite3-dev
  2. Checkout https://github.com/rogerbinns/apsw/
  3. Chekout the commit 64a42163b0b056d9f30cd645a581343e4052e331, which corresponds to the libsqlite version that raspbian is distributing
  4. Build APSW: ~/cpython-2.7/python setup.py bdist
  5. Copy the library file to its proper place: sudo cp /tmp/apsw/build/lib.linux-armv7l-2.7/apsw.so /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload

Restart plex, and you're done.

Im trying to do this on a nvidia shield and after using the apsw.mo given in this thread, my error is now:

ImportError: dlopen failed: “/storage/emulated/0/Android/data/com.plexapp.mediaserver.smb/Plex Media Server/Plug-in Support/Data/com.plexapp.plugins.trakttv/Libraries/Android/aarch64/ucs2/apsw.so” is 32-bit instead of 64-bit

Do you know how to compile for aarch64 for the shield?

TonioBDS commented 4 years ago

Hello everybody, I think I have a similar issue on Nvidia Shield, but unfortunately I couldn't find any clue of how to resolve it on the internet. Is anyone so kind to let me know if it is finaly possible to make Trakt working and provide a step by step how-to ?

My conf is the following:

Please let me know what you think about it. Many thanks

simonc56 commented 4 years ago

For those who do not achieve to use this plugin, there is a working python script that syncs Plex & Trakt : https://github.com/Taxel/PlexTraktSync

TonioBDS commented 4 years ago

For those who do not achieve to use this plugin, there is a working python script that syncs Plex & Trakt : https://github.com/Taxel/PlexTraktSync

Very interesting ! Seems promissing. I'll have a look as soon as I can. Has anyone made it work with PMS on Shield?

Looking at the link shared, I have to say that I'm quite unfamiliar to such Python script and for now I have no idea how to "install" it and make it run. But I am persistent !!

Has anyone tried to instal this script with a cron running on a Synology NAS? I was also thinking about asking my domotic (jeedom) system to provide the cron for script running... Well.. So much interrogations...

trex005 commented 4 years ago

I'm quite unfamiliar to such Python script and for now I have no idea how to "install" it and make it run.

It has been a while since I installed it, but here is an attempt to make their instructions more user-friendly.

Make sure Python 3 and git are installed. Log into: https://trakt.tv/oauth/applications/new (FB login seems to be broken at the moment) name: Plex Trakt Sync redirect url: urn:ietf:wg:oauth:2.0:oobas leave Javascript origins and the checkboxes blank. After submitting, leave the page up as you will need some of the information in a few moments.

cd ~
git clone https://github.com/Taxel/PlexTraktSync.git
cd PlexTraktSync
pip3 install -r requirements.txt
cp .env_example .env
python3 main.py

Answer the prompts then run: (This takes a very long time)

./plex_trakt_sync.sh

Install the cronjob if so desired:

crontab -e

Add the line:

0 */2 * * * cd ~/PlexTraktSync/ && ./plex_trakt_sync.sh

Save and Exit

Has anyone tried to instal this script with a cron running

Yes, but if I mark something as unwatched in plex so I can rewatch it (usually TV series I am rewatching with my kids), the sync keeps marking it as watched. This made it so I constantly lost my spot while rewatching, so I got rid of the cron.

on a Synology NAS?

Nope :)

TehRobot commented 4 years ago

Anyone got this working on Windows?

pax0707 commented 4 years ago

Noticed this too recently: Critical Error: Unable to import the playhouse.apsw_ext library (DLL load failed: The specified module could not be found.)

Windows 10

TehRobot commented 4 years ago

Noticed this too recently: Critical Error: Unable to import the playhouse.apsw_ext library (DLL load failed: The specified module could not be found.)

Windows 10

Exact error I am getting. I ran a sync using a seperate program and am now using Webhooks to keep current watch/collection up to date on Trakt. But would be great to get the plugin working again.

pax0707 commented 4 years ago

After way too much time spent what worked was a reinstall of Visual C++ 2013 x86.

wolfeinkc commented 4 years ago

Windows 10 Solved: I've been fighting with this since the plugin stopped working last week.
Solution: I deleted the plugin through WebTools. Then, in Plug-in Support > Databases I deleted the 3 trakttv DB files. I reinstalled the plugin, set it up, and was able to access it through Kitana and run a full update.

Altaess commented 4 years ago

I have same problem since 1 week on Windows 10... Plugin not working anymore and have this error on log file : 2020-04-17 16:00:30,368 - plugin.modules.migrations.main (219c) : WARNING (plugin.modules.migrations.main:31) - Database connection failed: 'APSWDatabaseWrapper' object has no attribute 'timeout'

sickyd commented 4 years ago

Tried fully uninstalling and deleting db files. Didn't seem to work, although admittedly I did not restart PMS. I then tried the reinstall of Visual C++ 2013 x86, restarted entire machine, everything now working. I'm using Kitana with Docker on Win 10.

Altaess commented 4 years ago

I finaly solved the issue, thanks you all for your comments. I had to reinstall Visual C++ 2013 x86, fully restart my computer, then everything working great! I'm using PMS on Windows 10 x64bits