conda-forge / pyqt-feedstock

A conda-smithy repository for pyqt.
BSD 3-Clause "New" or "Revised" License
5 stars 36 forks source link

PyQt 5.9 - Error while loading QtDesigner: Symbol not found: _Py_IsInitialized #53

Closed hhslepicka closed 4 years ago

hhslepicka commented 5 years ago

Issue:

When loading the QtDesigner with custom python widgets it fails with the following message:

dyld: lazy symbol binding failed: Symbol not found: _Py_IsInitialized
  Referenced from: /Users/slepicka/mc/envs/py37/plugins/designer/libpyqt5.dylib
  Expected in: flat namespace

dyld: Symbol not found: _Py_IsInitialized
  Referenced from: /Users/slepicka/mc/envs/py37/plugins/designer/libpyqt5.dylib
  Expected in: flat namespace

This was not happening with PyQt 5.6 and Qt 5.6.


Environment (conda list):

``` $ conda list # packages in environment at /Users/slepicka/mc/envs/py37: # # Name Version Build Channel bzip2 1.0.6 h1de35cc_1002 conda-forge ca-certificates 2019.3.9 hecc5488_0 conda-forge certifi 2019.3.9 py37_0 conda-forge dbus 1.13.6 h2f22bb5_0 conda-forge expat 2.2.5 h0a44026_1002 conda-forge gettext 0.19.8.1 h46ab8bc_1002 conda-forge glib 2.58.3 h2836805_1001 conda-forge icu 58.2 h0a44026_1000 conda-forge jpeg 9c h1de35cc_1001 conda-forge libcxx 8.0.0 2 conda-forge libcxxabi 8.0.0 2 conda-forge libffi 3.2.1 h6de7cb9_1006 conda-forge libiconv 1.15 h01d97ff_1005 conda-forge libpng 1.6.37 h2573ce8_0 conda-forge ncurses 6.1 h0a44026_1002 conda-forge openssl 1.1.1b h01d97ff_2 conda-forge pcre 8.41 h0a44026_1003 conda-forge pip 19.1 py37_0 conda-forge pyqt 5.9.2 py37h2a560b1_0 conda-forge python 3.7.3 h0d93f26_0 conda-forge qt 5.9.7 h93ee506_1 conda-forge readline 7.0 hcfe32e1_1001 conda-forge setuptools 41.0.1 py37_0 conda-forge sip 4.19.8 py37h0a44026_1000 conda-forge sqlite 3.26.0 h1765d9f_1001 conda-forge tk 8.6.9 ha441bb4_1001 conda-forge wheel 0.33.4 py37_0 conda-forge xz 5.2.4 h1de35cc_1001 conda-forge zlib 1.2.11 h1de35cc_1004 conda-forge ```


Details about conda and system ( conda info ):

``` $ conda info active environment : py37 active env location : /Users/slepicka/mc/envs/py37 shell level : 1 user config file : /Users/slepicka/.condarc populated config files : /Users/slepicka/.condarc conda version : 4.5.11 conda-build version : 3.0.19 python version : 3.6.7.final.0 base environment : /Users/slepicka/mc (writable) channel URLs : https://repo.anaconda.com/pkgs/main/osx-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/osx-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/osx-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/osx-64 https://repo.anaconda.com/pkgs/pro/noarch package cache : /Users/slepicka/mc/pkgs /Users/slepicka/.conda/pkgs envs directories : /Users/slepicka/mc/envs /Users/slepicka/.conda/envs platform : osx-64 user-agent : conda/4.5.11 requests/2.12.4 CPython/3.6.7 Darwin/17.7.0 OSX/10.13.6 UID:GID : 1918637911:1704612529 netrc file : None offline mode : False ```
hhslepicka commented 5 years ago

@ccordoba12 @mingwandroid can it be that the fix to avoid the static Python is resulting in a Designer Plugin that was not linked against the shared library provided?

ccordoba12 commented 5 years ago

You probably need to add again what you did before because the recipe for 5.9 is not an improvement over the 5.6 one, but it was taken directly from Anaconda.

hhslepicka commented 5 years ago

@ccordoba12 I’m not sure if I understood what you said correctly. Do you mean the patch that I had on the old PR to link against the python shared library?

ccordoba12 commented 5 years ago

Yes, that's what I meant. Sorry if I was not clear enough.

hhslepicka commented 5 years ago

I was just confirming to be sure... I will put a PR up soon.

ocefpaf commented 5 years ago

The xref'ed PR was close. Is this no longer an issue? Can we close it?

hhslepicka commented 5 years ago

It is still an issue. At least for who uses the designer plugin. PR was closed as the solution was not accepted so it is better to wait for an official patch from maintainers. (my 2cents)

ocefpaf commented 5 years ago

It is still an issue. At least for who uses the designer plugin.

Can you past the conda list from that environment?

PR was closed as the solution was not accepted so it is better to wait for an official patch from maintainers. (my 2cents)

I'll look into the PR but maybe those who close could chime in here.

ccordoba12 commented 5 years ago

I'll look into the PR but maybe those who close could chime in here.

https://github.com/conda-forge/pyqt-feedstock/pull/54#discussion_r285350107

ccordoba12 commented 5 years ago

The author himself closed the PR.

hhslepicka commented 5 years ago

@ocefpaf the conda list is at the beginning of this issue. And @ccordoba12 is correct. I closed the PR that I opened with the proposed fix.

ocefpaf commented 5 years ago

@hhslepicka maybe

@ocefpaf the conda list is at the beginning of this issue.

That was from 10 days ago and we have new packages.

And @ccordoba12 is correct. I closed the PR that I opened with the proposed fix.

Looks like we need an alternative fix b/c that one is a no-no according to @isuruf. But before we try to fix it please try again with the new packages.

hhslepicka commented 5 years ago

@ocefpaf do you mind to point me to the release notes of this new package or the version of it? I am currently using a similar fix at the one at this PR to build a local PyQt against qt (from source) using Anaconda & Python. So far no weird issues and crashes as reported by @isuruf but I do understand the risks of mixing shared and static of a library.

I would like to understand why Python was switched to static linking (which is the root of this and other issues around the Anaconda ecosystem) but that is something that I need to study and look for the answer.

hhslepicka commented 5 years ago

@ocefpaf the latest pyqt package is from 16 days ago so I was at the latest by the time of this issue. https://anaconda.org/conda-forge/pyqt/files

hhslepicka commented 5 years ago

Any lucky from someone to find a proper fix for it? The fix that I proposed at #54 worked for me and I used it without problems for a bit more than a month (I am no longer using it since I needed to move to a newer version of Qt & PyQt).

klauer commented 4 years ago

I'm also experiencing this on OSX, with the designer failing to load the pyqt plugin.

The only fix I've found so far is reverting to a very old pyqt5 through anaconda (specifically, pyqt-5.6.0-py37h8210e8a_7.tar.bz2), which doesn't seem to be a good long-term solution.

hhslepicka commented 4 years ago

@conda-forge/pyqt ideas?

isuruf commented 4 years ago

Are these plugins loaded as an extension or are they loaded by qt designer only?

hhslepicka commented 4 years ago

Designer only... it is a plugin for QtDesigner so it can load widgets and other code made with PyQt.

isuruf commented 4 years ago

Then, we can make plugins/designer/libpyqt5.dylib link to libpython and keep the rest as is. I don't know how to do this though.

hhslepicka commented 4 years ago

My old PR (https://github.com/conda-forge/pyqt-feedstock/pull/54) was doing this... the one you mentioned that would cause a conflict... Since that is not loaded by Python I think there is no problem into merging it. Do you mind to take another look with this new information in mind?

isuruf commented 4 years ago

@hhslepicka, doesn't that PR make the python extensions link to libpython.so as well?

hhslepicka commented 4 years ago

@isuruf which extensions are you concerned about? I was running with the fix on PR 54 for a while.

isuruf commented 4 years ago

Any library in lib/python3.7/site-packages/PyQt5

hhslepicka commented 4 years ago

They don't link against libpython.so. The only one that does is that cursed plugin.

hhslepicka commented 4 years ago

To be fair... Only the QtDesigner and QMLScene will link to libpython.so. Here is the proof: https://github.com/baoboa/pyqt5/search?q=PYSHLIB&unscoped_q=PYSHLIB

isuruf commented 4 years ago

Indeed. conda-build log shows

   INFO (pyqt,plugins/designer/libpyqt5.so): Needed DSO lib/libpython2.7.so.1.0 found in conda-forge::python-2.7.15-h5a48372_1009
   INFO (pyqt,plugins/PyQt5/libpyqt5qmlplugin.so): Needed DSO lib/libpython2.7.so.1.0 found in conda-forge::python-2.7.15-h5a48372_1009