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

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

Open
lazy-gipsy-bear opened this issue Mar 3, 2019 · 64 comments

Comments

@lazy-gipsy-bear
Copy link

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
Copy link

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
Copy link

ydkn commented Mar 4, 2019

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
Copy link

jpatriarca commented Mar 17, 2019

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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

@Belphemur
Copy link

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
Copy link

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
Copy link

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

@Belphemur
Copy link

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

Doesn't cost anything to try :)

@martinlaune
Copy link

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

@Belphemur
Copy link

Belphemur commented Apr 3, 2019 via email

@martinlaune
Copy link

martinlaune commented Apr 4, 2019

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
Copy link

Belphemur commented Apr 4, 2019 via email

@OrangeTang16
Copy link

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
Copy link

RemyPsq commented Apr 10, 2019

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
Copy link

bengt-a commented Apr 11, 2019

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
Copy link

bengt-a commented Apr 14, 2019

  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
Copy link

treshed commented Apr 30, 2019

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
Copy link

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
Copy link

bengt-a commented May 12, 2019

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

@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
Copy link

trex005 commented Jun 4, 2019

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.

@fpatrick
Copy link

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
Copy link

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:

#528 (comment)

@johnmarshall515
Copy link

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
Copy link

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:

  • Shield Pro (2019) with PMS on shield, media files on my Synology NAS (DS218+) and metadata on high speed USB3-microSD (128Go)
  • Trakt.tv and webtools plugin files are copied on "Android\data\com.plexapp.mediaserver.smb\Plex Media Server\Plug-ins" folder
  • Access of Trakt by the means of Kitana with the following errors:
    Trakt.tv: Critical Error: Unable to import the playhouse.apsw_ext library (dlopen failed: couldn't map "/storage/0123-4567/Android/data/com.plexapp.mediaserver.smb/Plex Media Server/Plug-in Support/Data/com.plexapp.plugins.trakttv/Libraries/Android/aarch64/ucs2/apsw.so" segment 0: Permission denied)

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

@simonc56
Copy link

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
Copy link

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
Copy link

trex005 commented Mar 12, 2020

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
Copy link

TehRobot commented Apr 3, 2020

Anyone got this working on Windows?

@pax0707
Copy link

pax0707 commented Apr 5, 2020

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
Copy link

TehRobot commented Apr 6, 2020

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
Copy link

pax0707 commented Apr 11, 2020

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

@wolfeinkc
Copy link

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
Copy link

Altaess commented Apr 17, 2020

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
Copy link

sickyd commented Apr 20, 2020

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
Copy link

Altaess commented Apr 21, 2020

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

@pax0707
Copy link

pax0707 commented Apr 21, 2020

Glad that helped.
One of the recent PMS updates broke something.
I tied so many things before that worked.

@TehRobot
Copy link

Can confirm 'repairing' my Visual C++ 2013 x86 install and a restart worked for getting the plugin back up and running.

Cheers.

@chrisweetman
Copy link

im getting this same issue on Synology NAS - DS2015XS - its based on the Arm7 CPU. I migrated plex to Windows machine, but with 5 years of watched history on the Synology, I was hoping to sync that data across to the new system. I keep getting the no apsw module issues, but trying even the step by step approach isn't working for me as pip3 isn't available on the NAS, I get the following when I try to run through the commands

admin@diskstation:/PlexTraktSync$ pip3 install -r requirements.txt
-sh: pip3: command not found
admin@diskstation:
/PlexTraktSync$ cp .env_example .env
admin@diskstation:~/PlexTraktSync$ python3 main.py
Traceback (most recent call last):
File "main.py", line 2, in
import plexapi.server
ImportError: No module named 'plexapi'

I only need to run the sync once on the Synology, but this is taking so much effort as I am out of my knowledge area with this issue. Any help would be appreciated!

Windows install did work, and is updating with information gathered since setup.

@airdrummingfool
Copy link

@chrisweetman as a workaround, could you copy the Synology’s Plex history database file(s) to Windows and sync to Trakt from there?

@chrisweetman
Copy link

i could give that a go, is it just the file com.plexapp.plugins.library.db

@chrisweetman
Copy link

That appears to have worked for me!! all entries are now showing up in trakt, will now revert to the new version of the db file and check that all remains, if so, you have helped me get rid of an issue which has been bugging me for weeks! Simple when you know how!!

@linust
Copy link

linust commented Jun 20, 2020

On Windows 10 64bit
Installing/reinstalling Visual C++ 2013 x86 redistributable available from
https://www.microsoft.com/en-us/download/details.aspx?id=40784
and restarting did the trick.

@TonioBDS
Copy link

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 :)

Hello , I am finaly trying to follow your instruction to run his script on my Synology NAS.
When I get to run the command python3 main.py, I get the followng error:

root@Tonio-NAS:/volume1/GitProjects/PlexTraktSync# python3 main.py Traceback (most recent call last): File "main.py", line 11, in <module> from dotenv import load_dotenv File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/dotenv/__init__.py", line 2, in <module> from .main import load_dotenv, get_key, set_key, unset_key, find_dotenv, dotenv_values File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/dotenv/main.py", line 10, in <module> from typing import (Dict, Iterator, List, Match, Optional, # noqa ImportError: cannot import name 'TYPE_CHECKING'
Does anyone willing to help ?
Thank you

@TonioBDS
Copy link

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 :)

Hello , I am finaly trying to follow your instruction to run his script on my Synology NAS.
When I get to run the command python3 main.py, I get the followng error:

root@Tonio-NAS:/volume1/GitProjects/PlexTraktSync# python3 main.py Traceback (most recent call last): File "main.py", line 11, in <module> from dotenv import load_dotenv File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/dotenv/__init__.py", line 2, in <module> from .main import load_dotenv, get_key, set_key, unset_key, find_dotenv, dotenv_values File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/dotenv/main.py", line 10, in <module> from typing import (Dict, Iterator, List, Match, Optional, # noqa ImportError: cannot import name 'TYPE_CHECKING'
Does anyone willing to help ?
Thank you

Did anyone manage to install this script on a Synology NAS? Many thanks to all of you.

@Klemart3D
Copy link

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 chmod -R plex:users ucs2.

@JeeDeWee it's not chmod but chown : chown -R plex:users ucs2

@alecaputo13
Copy link

alecaputo13 commented Mar 4, 2021

Hey guys I'm having the same problem with the apsw.so library i think. I already followed all the steps provided by vrachnis here #521 (comment)
But it's not working .-.
Here's my traktv log file if anyone wants to help https://pastebin.com/uSep3u82
Anyway I'm on a raspberry pi4 with ubuntu

@TonioBDS
Copy link

TonioBDS commented Mar 5, 2021

Hey guys I'm having the same problem with the apsw.so library i think. I already followed all the steps provided by vrachnis here #521 (comment)
But it's not working .-.
Here's my traktv log file if anyone wants to help https://pastebin.com/uSep3u82
Anyway I'm on a raspberry pi4 with ubuntu

Hello,

I have never managed to make the trakt plugin work on my plex. However I am quite happy about PlexTraktSync. Have you tried it?

@shotfirer
Copy link

After copying apsw.so I have the following error:
ImportError: Error loading shared library libsqlite3.so.0: No such file or directory (needed by /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload/apsw.so)

I've found libsqlite3.so.0 in my system and tried to add the path to LD_LIBRARY_PATH, tried to use ldconfig and even tried to copy the file directly to the /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload/, nothing works, I still have the same error.

What's weird, the plugin was working fine until the last Plex update (about a week ago or so).

Any clue will be much appreciated.

@grasuoare
Copy link

Could someone solve this shitty issue?

copying the apsw.so is not longer working.

PLEASE!!!!!

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