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

ImportError: ...PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices #9

Closed
lacygoill opened this issue Sep 11, 2018 · 3 comments
Closed

Comments

@lacygoill
Copy link

lacygoill commented Sep 11, 2018

Hello, and thank you very much for sharing your scripts.

I have the following issue:
when I try to start the program by pressing F5, the subtitles simply disappear, there are no interactive ones.

To get some error message, I've started mpv in the terminal:

$ mpv /path/to/file

Here's the error message which is printed in the terminal when I press F5:

Traceback (most recent call last):30%) A-V:  0.000
  File "/home/user/.config/mpv/scripts/interSubs.py", line 35, in <module>
    from PyQt5.QtCore import Qt, QThread, QObject, pyqtSignal, pyqtSlot, QSize
ImportError: /home/user/.local/lib/python3.5/site-packages/PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices

I installed the python modules listed in the requirements with these commands:

python3 -m pip install --user --upgrade pip
python3 -m pip install --user pyqt5
python3 -m pip install --user numpy
python3 -m pip install --user beautifulsoup4
python3 -m pip install --user requests

I tried to google a simplified version of the error message:

ImportError PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices

Which lead me to this issue.
I'm not sure, but it seems to be a problem of dependency versions.


Here are some detail about by my environment:

  • Operating system: Ubuntu 16.04.5 LTS
  • Terminal emulator: rxvt-unicode v9.22
  • Terminal multiplexer: tmux 2.8
  • $TERM: tmux-256color
  • Shell: zsh 5.5.1-dev-0 (x86_64-pc-linux-gnu)
mpv
$ mpv --version
mpv 0.29.0-29-g48c38f7 Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
 built on Mon Sep 10 17:26:56 CEST 2018
ffmpeg library versions:
   libavutil       56.19.101
   libavcodec      58.29.100
   libavformat     58.18.100
   libswscale      5.2.100
   libavfilter     7.29.100
   libswresample   3.2.100
ffmpeg version: N-91866-g90ba176
python3
$ python3 --version
Python 3.5.2
PyQt5
$ python3 -m pip show pyqt5
Name: PyQt5
Version: 5.11.2
Summary: Python bindings for the Qt cross platform UI and application toolkit
Home-page: https://www.riverbankcomputing.com/software/pyqt/
Author: Riverbank Computing Limited
Author-email: info@riverbankcomputing.com
License: GPL v3
Location: /home/user/.local/lib/python3.5/site-packages
Requires: PyQt5-sip
Required-by:
composite manager
$ xfwm4 --version

This is xfwm4 version 4.12.3 (revision 7fdcb53) for Xfce 4.12
Released under the terms of the GNU General Public License.
Compiled against GTK+-2.24.30, using GTK+-2.24.30.

Build configuration and supported features:
- Startup notification support:                 Yes
- XSync support:                                Yes
- Render support:                               Yes
- Xrandr support:                               Yes
- Embedded compositor:                          Yes
- KDE systray proxy (deprecated):               No
numpy
$ python3 -m pip show numpy
Name: numpy
Version: 1.15.1
Summary: NumPy: array processing for numbers, strings, records, and objects.
Home-page: http://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: /home/user/.local/lib/python3.5/site-packages
Requires:
Required-by:
beautifulsoup4
$ python3 -m pip show beautifulsoup4
Name: beautifulsoup4
Version: 4.6.3
Summary: Screen-scraping library
Home-page: http://www.crummy.com/software/BeautifulSoup/bs4/
Author: Leonard Richardson
Author-email: leonardr@segfault.org
License: MIT
Location: /home/user/.local/lib/python3.5/site-packages
Requires:
Required-by: rtv, subliminal
requests
$ python3 -m pip show requests
Name: requests
Version: 2.19.1
Summary: Python HTTP for Humans.
Home-page: http://python-requests.org
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: Apache 2.0
Location: /home/user/.local/lib/python3.5/site-packages
Requires: chardet, urllib3, idna, certifi
Required-by: streamlink, rtv, grip, subliminal
lua
$ lua -v
Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio
socat
$ socat -V
socat by Gerhard Rieger - see www.dest-unreach.org
socat version 1.7.3.1 on Feb  2 2016 21:25:06
   running on Linux version #160-Ubuntu SMP Wed Aug 15 14:58:00 UTC 2018, release 4.4.0-134-generic, machine x86_64
pkill
$ pkill --version
pkill from procps-ng 3.3.10
xdotool
$ xdotool --version
xdotool version 3.20150503.1
lua
$ lua -v
Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio
@lacygoill lacygoill changed the title ImportError: ... undefined symbol: PySlice_AdjustIndices ImportError: ...PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices Sep 11, 2018
@oltodosel
Copy link
Owner

What PyQt version do you have?

from PyQt5.Qt import PYQT_VERSION_STR
print("PyQt version:", PYQT_VERSION_STR)

/home/user/.local/lib/python3.5/

v3.5 is 2y.o - you may try to update your whole system - it might help.

@lacygoill
Copy link
Author

lacygoill commented Sep 11, 2018

My PyQt version seems to be 5.5.1:

('PyQt version:', '5.5.1')

v3.5 is 2y.o - you may try to update your whole system - it might help.

I can't update at the moment, but you're right, updating the system would probably help.
But before that, I may try compiling a more recent version of python (3.7), and re-install the python modules:

$ python3.7 -m pip install --user pyqt5
...

If you don't mind, I would like to let the issue open a little while, until I can update my system, in case someone else has found a simpler fix and can share it here.
If updating python or the system fixes the issue, I will report it back and close the issue.

Anyway, thank you very much for answering so quickly.

@lacygoill
Copy link
Author

lacygoill commented Sep 11, 2018

Updating Python, and installing the modules six and lxml seems to have fixed the issue.


In case it helps someone else, here's what I did:

Go to this page to find all the latest source releases of the Python interpreter.
At the moment, the latest release is python3.7.0.

Download the .xz tarball, and its .asc signature.

Extract its contents:

$ tar xvf Python-3.7.0.tar.xz

cd into the directory:

$ cd Python-3.7.0

Import the release manager public keys via the public key file:

$ curl https://www.python.org/static/files/pubkeys.txt | gpg --import -

Check the authenticity of the tarball:

$ gpg --verify Python-3.7.0.tar.xt.asc

The output should contain a message containing the text Good signature:

gpg: Good signature from "Ned Deily (Python release signing key) nad@python.org"
gpg: aka "Ned Deily nad@baybryj.net"
gpg: aka "keybase.io/nad nad@keybase.io"
gpg: aka "Ned Deily (Python release signing key) nad@acm.org"

Install some dependencies:

sudo apt-get install libssl-dev libffi-dev

You need libssl-dev otherwise pip install may fail later because of errors due to ssl connections.
And you need libffi-dev for the next checkinstall command to succeed.

Configure:

./configure --enable-optimizations --with-lto --with-ensurepip=install

You don't need the --enable-optimizations option, but it makes the Python binary a little faster at executing Python code, at the expense of a much longer compiling time.

You need the --with-ensurepip option to be able to execute python3.7 -m pip ... commands later.

Compile:

$ make profile-opt
       │
       └ only useful if you used the `--enable-optimizations` option

Test the binary:

$ make test

If a test fails, re-run it in verbose mode:

$ make test TESTOPTS="-v test_that_failed"

A failed test may be due to a missing python module necessary to perform the test:

2 tests failed:
test_gdb test_urllib2net

Use $ apt-file search to search for a missing dependency, and install it if necessary:

$ apt-file search test_urllib2net
...
$ apt-file search test_gdb
...

Install the binary:

$ sudo apt-get install checkinstall && sudo checkinstall --pkgname mypython -y

Using this new Python interpreter, update pip and install the python modules six and lxml:

$ python3.7 -m pip install --user --upgrade pip
$ python3.7 -m pip install --user six
$ python3.7 -m pip install --user lxml

As well as the modules listed in the requirements of the README page:

$ python3.7 -m pip install --user pyqt5
$ python3.7 -m pip install --user numpy
$ python3.7 -m pip install --user beautifulsoup4
$ python3.7 -m pip install --user requests

I had to install the Python module six, because of this error:

[interSubs] Starting interSubs ...
Traceback (most recent call last):58%) A-V: 0.000
File "/home/user/.config/mpv/scripts/interSubs.py", line 23, in
from six.moves import urllib
ModuleNotFoundError: No module named 'six'

And I had to install the Python module lxml, because of such errors:

[interSubs] Starting interSubs ...
[py part] Starting interSubs ... (58%) A-V: 0.000
QApplication: invalid style override passed, ignoring it.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/user/.config/mpv/scripts/interSubs.py", line 429, in dict_cc
p = open(fname).read().split('=====/////-----')
FileNotFoundError: [Errno 2] No such file or directory: 'urls/https:--en-fr.dict.cc-?s=going'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/home/user/.config/mpv/scripts/interSubs.py", line 445, in dict_cc
soup = BeautifulSoup(p, "lxml")
File "/home/user/.local/lib/python3.7/site-packages/bs4/init.py", line 198, in init
% ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?


Thank you again for pointing me in the right direction.

simon2x pushed a commit to simon2x/Buildertron that referenced this issue Sep 14, 2018
oltodosel/interSubs#9

Specify pyqt versions as pyqt5.11 is incompatible with <python3.5
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

2 participants