Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved]PyQt5 issues w/ openssl-1.1 and wayland with python3
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
provod
n00b
n00b


Joined: 18 Oct 2017
Posts: 8

PostPosted: Mon Oct 28, 2019 4:21 pm    Post subject: [Solved]PyQt5 issues w/ openssl-1.1 and wayland with python3 Reply with quote

Hi,

Starting any PyQt5 application with python3 results in (a) it not finding wayland QPA plugin:
Code:
"qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found."


And (b) also any attempt to use QtNetwork component to perform SSL (e.g. HTTPS requests) will fail with:
Code:
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_num_locks
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_id_callback
qt.network.ssl: QSslSocket: cannot resolve CRYPTO_set_locking_callback
qt.network.ssl: QSslSocket: cannot resolve ERR_free_strings
qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_cleanup
qt.network.ssl: QSslSocket: cannot resolve EVP_CIPHER_CTX_init
qt.network.ssl: QSslSocket: cannot resolve sk_new_null
qt.network.ssl: QSslSocket: cannot resolve sk_push
qt.network.ssl: QSslSocket: cannot resolve sk_free
qt.network.ssl: QSslSocket: cannot resolve sk_num
qt.network.ssl: QSslSocket: cannot resolve sk_pop_free
qt.network.ssl: QSslSocket: cannot resolve sk_value
qt.network.ssl: QSslSocket: cannot resolve SSL_library_init
qt.network.ssl: QSslSocket: cannot resolve SSL_load_error_strings
qt.network.ssl: QSslSocket: cannot resolve SSL_get_ex_new_index
qt.network.ssl: QSslSocket: cannot resolve SSLv3_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv23_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv3_server_method


Python2 does not trigger any of these, both work as expected.

Compiling openssl-1.0 manually and running python3 PyQt5 app under LD_LIBRARY_PATH=/path/to/built/openssl-1.0 works around the SSL issue.
There are no traces of openssl-1.0 in my system that I know of, so I'm not even sure where pyqt gets an idea of openssl-1.0 at all.

I haven't found workaround for the wayland issue yet.

Has anyone experienced anything similar, or has any ideas what could be wrong?

Thanks!

[Moderator edit: changed [quote] tags to [code] tags to preserve output layout. -Hu]


Last edited by provod on Tue Oct 29, 2019 5:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
mike155
Veteran
Veteran


Joined: 17 Sep 2010
Posts: 1956
Location: Frankfurt, Germany

PostPosted: Mon Oct 28, 2019 4:36 pm    Post subject: Reply with quote

provod wrote:
"qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found."

I haven't found workaround for the wayland issue yet.

  1. Do you want to run the program in Wayland mode? (in other words: did you install Wayland and do you want to use it?) Or do you want to run the program in X11 mode - and you're surpised to get this message about Wayland?

  2. Please show us the output of the statement below, run as 'root':
    Code:
    emerge --info

  3. Please show us the output of the statement below, run as the user you used when you got the message 'Could not load the Qt platform plugin "wayland"'
    Code:
    export | egrep "(QT|XDG|DISPLAY|WAYLAND|WESTON|TERM)"

Back to top
View user's profile Send private message
provod
n00b
n00b


Joined: 18 Oct 2017
Posts: 8

PostPosted: Mon Oct 28, 2019 5:21 pm    Post subject: Reply with quote

Thanks for the very quick reply!

  1. Yes. I'd expect everything that can run natively under wayland. It does properly fallback to x11 mode, which is fine for now. I mentioned it here because both issues seem to be related to some kind of common shared library issue with specifically python 3.

  2. Code:
    Portage 2.3.76 (python 2.7.16-final-0, default/linux/amd64/17.1/hardened, gcc-8.3.0, glibc-2.29-r2, 5.2.14-gentoo x86_64)
    =================================================================
    System uname: Linux-5.2.14-gentoo-x86_64-AMD_Ryzen_Threadripper_1950X_16-Core_Processor-with-gentoo-2.6
    KiB Mem:    32800164 total,  16336636 free
    KiB Swap:   33554428 total,  31335288 free
    Timestamp of repository gentoo: Sat, 26 Oct 2019 17:00:01 +0000
    Head commit of repository gentoo: 794fad9f9c72ed80d660c7c8c5454414e6f484a8
    sh bash 4.4_p23-r1
    ld GNU ld (Gentoo 2.32 p2) 2.32.0
    distcc 3.3.3 x86_64-pc-linux-gnu [disabled]
    ccache version 3.7.4 [enabled]
    app-shells/bash:          4.4_p23-r1::gentoo
    dev-lang/perl:            5.28.2-r1::gentoo
    dev-lang/python:          2.7.16::gentoo, 3.6.9::gentoo
    dev-util/ccache:          3.7.4::gentoo
    dev-util/cmake:           3.14.6::gentoo
    dev-util/pkgconfig:       0.29.2::gentoo
    sys-apps/baselayout:      2.6-r1::gentoo
    sys-apps/openrc:          0.41.2::gentoo
    sys-apps/sandbox:         2.13::gentoo
    sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
    sys-devel/automake:       1.11.6-r3::gentoo, 1.16.1-r1::gentoo
    sys-devel/binutils:       2.32-r1::gentoo
    sys-devel/gcc:            8.3.0-r1::gentoo
    sys-devel/gcc-config:     2.0::gentoo
    sys-devel/libtool:        2.4.6-r3::gentoo
    sys-devel/make:           4.2.1-r4::gentoo
    sys-kernel/linux-headers: 5.0-r1::gentoo (virtual/os-headers)
    sys-libs/glibc:           2.29-r2::gentoo
    Repositories:

    gentoo
        location: /usr/portage
        sync-type: rsync
        sync-uri: rsync://rsync.gentoo.org/gentoo-portage
        priority: -1000
        sync-rsync-verify-jobs: 1
        sync-rsync-verify-metamanifest: yes
        sync-rsync-extra-opts:
        sync-rsync-verify-max-age: 24

    UsrLocal
        location: /usr/local/portage
        masters: gentoo

    brother-overlay
        location: /var/lib/layman/brother-overlay
        masters: gentoo
        priority: 50

    steam-overlay
        location: /var/lib/layman/steam-overlay
        masters: gentoo
        priority: 50

    ACCEPT_KEYWORDS="amd64"
    ACCEPT_LICENSE="*"
    CBUILD="x86_64-pc-linux-gnu"
    CFLAGS="-O2 -pipe -O2 -pipe -march=native -fomit-frame-pointer -ggdb"
    CHOST="x86_64-pc-linux-gnu"
    CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/share/gnupg/qualified.txt"
    CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
    CXXFLAGS="-O2 -pipe -O2 -pipe -march=native -fomit-frame-pointer -ggdb"
    DISTDIR="/var/tmp/distfiles"
    ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
    FCFLAGS="-O2 -pipe"
    FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs ccache cgroup config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
    FFLAGS="-O2 -pipe"
    GENTOO_MIRRORS="http://mirror.yandex.ru/gentoo-distfiles/ ftp://mirror.yandex.ru/gentoo-distfiles/ http://91.121.189.201/gentoo-distfiles/ rsync://ftp.snt.utwente.nl/gentoo ftp://gentoo.imj.fr/pub/gentoo/"
    LANG="en_GB.utf8"
    LDFLAGS="-Wl,-O1 -Wl,--as-needed"
    LINGUAS="ru en"
    MAKEOPTS="-j32 -l32"
    PKGDIR="/usr/portage/packages"
    PORTAGE_CONFIGROOT="/"
    PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
    PORTAGE_TMPDIR="/var/tmp/portage"
    USE="256-color X aac aacplus acl alsa amd64 apng avahi bs2b bzip2 cairo cjk clang crypt cscope cups cxx cycles d3d9 dbus djvu dts dvd egl elogind exif fam fdk ffmpeg flac fontconfig freerdp fuse gif glamor gnome-keyring gtk3 gtkstyle hardened ibus iconv icu infinality ipv6 iso14755 ithreads jack jpeg jpg kdrive ladspa lcms libass libnotify libtirpc lightning llvm lzma lzo mad matroska mng mod modplug mp3 mp4 mpeg multilib musepack ncurses nls nptl offensive ogg opencl openexr opengl openimageio openmax openmp opus pam pango pcre pdf pie png policykit postscript pulseaudio qt5 quvi readline rtmp s3tc schroedinger sdl seccomp speex spell split-usr ssl ssp startup-notification steamgames_bioshock_infinite steamgames_portal steamgames_source_engine steamgames_trine2 steamgames_witcher2 svg tahoma theora thin threads tiff tinfo truetype udev udisks unicode usb v4l vaapi vdpau vim vorbis vpx vulkan wavpack wayland webp widevine x264 x265 xattr xcb xcomposite xcsecurity xft xkb xrandr xtpax xv xvid xvmc zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="usb-audio hda-intel seq-dummy virmidi" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" CAMERAS="ptp2" COLLECTD_PLUGINS="cpu cpufreq contexswitch conntrack cgroups df disk entropy ethstat fhcount filecount hddtemp ipc lvm mbmon memory nut processes protocol sensors smart tcpconns thermal threshold uptime users vmem rrdtool syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3 sse4 sse4_1 sse4_2 avx aes f16c fma3 fma4 popcnt xop" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" L10N="ru en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="AMDGPU" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" QEMU_USER_TARGETS="arm i386 x86_64" RUBY_TARGETS="ruby24 ruby25" SANE_BACKENDS="net" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
    Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS


  3. Code:
    declare -x COLORTERM="truecolor"
    declare -x DISPLAY=":0"
    declare -x QT_GRAPHICSSYSTEM="raster"
    declare -x QT_IM_MODULE="ibus"
    declare -x TERM="xterm-256color"
    declare -x WAYLAND_DISPLAY="wayland-0"
    declare -x XDG_CONFIG_DIRS="/etc/xdg"
    declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share"
    declare -x XDG_GREETER_DATA_DIR="/var/lib/lightdm-data/w23"
    declare -x XDG_RUNTIME_DIR="/run/user/1000"
    declare -x XDG_SEAT="seat0"
    declare -x XDG_SEAT_PATH="/org/freedesktop/DisplayManager/Seat0"
    declare -x XDG_SESSION_CLASS="user"
    declare -x XDG_SESSION_DESKTOP="sway"
    declare -x XDG_SESSION_ID="122"
    declare -x XDG_SESSION_PATH="/org/freedesktop/DisplayManager/Session1"
    declare -x XDG_SESSION_TYPE="wayland"
    declare -x XDG_VTNR="8"


[Moderator edit: changed [quote] tags to [code] tags to preserve output layout; changed manual numbered list to [list] tag. -Hu]
Back to top
View user's profile Send private message
mike155
Veteran
Veteran


Joined: 17 Sep 2010
Posts: 1956
Location: Frankfurt, Germany

PostPosted: Mon Oct 28, 2019 8:00 pm    Post subject: Reply with quote

Thanks for your answer. It seems that you use Sway as desktop environment? If that's the case, you surely want to use Wayland as often as possible :)

  1. Let's start with the OpenSSL error messages. A month ago, a new version of OpenSSL was stabilized. After the update to OpenSSL 1.1.1, it was necessary to re-emerge all packages that depend on OpenSSL. I wonder if you did that? Because if you didn't, you would get error the messages like the ones you showed in your first post.

  2. Please look at the ouput of
    Code:
    ls -la /usr/share/doc/PyQt5-*/README.bz2 /usr/share/doc/openssl-*/README.bz2

    Was PyQt5 installed AFTER OpenSSL?

  3. Please run the statements below:
    Code:
    emerge --update --deep --newuse -av @world
    emerge -a @preserved-rebuild
    revdep-rebuild
    emerge -a --depclean

  4. If the steps shown above don't solve the problem: please tell me the name of a PyQt5 based program that generates the errors you showed in your first post - maybe one from the PyQt5 examples? I would like to reproduce the error you posted on my machine.
Back to top
View user's profile Send private message
provod
n00b
n00b


Joined: 18 Oct 2017
Posts: 8

PostPosted: Tue Oct 29, 2019 4:03 am    Post subject: Reply with quote

TLDR: Ahaha, I'm super dumb! Sorry for wasting your time! :oops:
Apparently I had a very old PyQt5 installed in ~/.local/lib64/python3.6/site-packages that I didn't even know about (maybe some pip thing installed it as a dependency a long time ago; i don't even use python a lot), and that messed with everything. pip3 uninstall PyQt5 solved everything.



I'm leaving investigation below intact as a caution for future generations.

1. IIRC I had to unmask openssl-1.1 for something before it was stabilized. But that shouldn't matter. I did re-emerge everything that depended on it.

2. PyQt was built more recently than openssl. Basically I emerged it and immediately noticed the issue.
Code:
-rw-r--r-- 1 root root 1608 Oct 13 11:01 /usr/share/doc/openssl-1.1.1d-r2/README.bz2
-rw-r--r-- 1 root root  988 Oct 27 22:44 /usr/share/doc/PyQt5-5.12.2/README.bz2
-rw-r--r-- 1 root root  499 Oct 27 22:36 /usr/share/doc/PyQt5-sip-4.19.17/README.bz2


3. These report nothing actionable. I regularly run emerge -DuNtav --with-bdeps and whatnot and emerge -ca afterwards. (Is revdep-rebuild still a thing? I haven't had to run that in many years.)

4. Noticed this with media-sound/picard, but using just this example https://github.com/pyqt/examples/tree/master/network/http is way easier to reproduce the issue.

Interestingly, python2 http.py will try to link with /usr/lib64/libssl.so.1.1 directly first and succeeds:
Code:
openat(AT_FDCWD, "/usr/lib64/libssl.so.1.1", O_RDONLY|O_CLOEXEC) = 4

While python3 http.py will try local site-packages (?!) first and then fall back to generic system-wide .so without version:
Code:
...
openat(AT_FDCWD, "/home/w23/.local/lib64/python3.6/site-packages/PyQt5/Qt/lib/libssl.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 20
fstat(20, {st_mode=S_IFREG|0644, st_size=244028, ...}) = 0
mmap(NULL, 244028, PROT_READ, MAP_PRIVATE, 20, 0) = 0x7f92dc08a000
close(20)                               = 0
openat(AT_FDCWD, "/usr/lib64/libssl.so", O_RDONLY|O_CLOEXEC) = 20
read(20, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\353\1\0\0\0\0\0"..., 832) = 832
fstat(20, {st_mode=S_IFREG|0755, st_size=593648, ...}) = 0
mmap(NULL, 596336, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 20, 0) = 0x7f92bc14f000
mmap(0x7f92bc16c000, 319488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 20, 0x1d000) = 0x7f92bc16c000
mmap(0x7f92bc1ba000, 106496, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 20, 0x6b000) = 0x7f92bc1ba000
mmap(0x7f92bc1d4000, 53248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 20, 0x84000) = 0x7f92bc1d4000
close(20)                               = 0
mprotect(0x7f92bc1d4000, 36864, PROT_READ) = 0
munmap(0x7f92dc08a000, 244028)          = 0
write(2, "qt.network.ssl: QSslSocket: cann"..., 60qt.network.ssl: QSslSocket: cannot resolve CRYPTO_num_locks


Here I noticed that python was built before the most recent openssl build, but then both py2 and py3 were built within 2 minutes of each other (threadripper <3) so ¯\_(ツ)_/¯.
Back to top
View user's profile Send private message
mike155
Veteran
Veteran


Joined: 17 Sep 2010
Posts: 1956
Location: Frankfurt, Germany

PostPosted: Tue Oct 29, 2019 11:47 am    Post subject: Reply with quote

I'm glad you found it :)

What about the Wayland issue (Could not load the Qt platform plugin "wayland")? Is it solved, too?
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 7428
Location: Austria

PostPosted: Tue Oct 29, 2019 12:05 pm    Post subject: Reply with quote

Do you have qtwayland installed?
_________________
backend.cpp:92:2: warning: #warning TODO - this error message is about as useful as a cooling unit in the arctic
Back to top
View user's profile Send private message
provod
n00b
n00b


Joined: 18 Oct 2017
Posts: 8

PostPosted: Tue Oct 29, 2019 4:12 pm    Post subject: Reply with quote

Wayland issue had the same underlying reason: the plugin was trying to link with a library in ~/.local
After I cleaned up ~/.local, wayland also started working properly.

Thank you very much!
Back to top
View user's profile Send private message
mike155
Veteran
Veteran


Joined: 17 Sep 2010
Posts: 1956
Location: Frankfurt, Germany

PostPosted: Tue Oct 29, 2019 4:51 pm    Post subject: Reply with quote

Please edit your first post and add a '[Solved]' to the subject line :-)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum