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

Different behaviour between conda-forge and pip wheel installed packages #45

Closed
patricksnape opened this issue Oct 11, 2019 · 3 comments

Comments

@patricksnape
Copy link

patricksnape commented Oct 11, 2019

@rggjan

Environment:

# Name                    Version                   Build  Channel
ca-certificates           2019.9.11            hecc5488_0    conda-forge
certifi                   2016.9.26                py36_0    conda-forge
clang_variant             1.0                     default    conda-forge
clangdev                  5.0.0             hf089d60_1005    conda-forge
icu                       64.2                 h6de7cb9_1    conda-forge
jpeg                      9c                h1de35cc_1001    conda-forge
libclang                  8.0.1                h770b8ee_1    conda-forge
libcxx                    9.0.0                         0    conda-forge
libcxxabi                 9.0.0                         0    conda-forge
libffi                    3.2.1             h6de7cb9_1006    conda-forge
libiconv                  1.15              h01d97ff_1005    conda-forge
libllvm8                  8.0.1                h770b8ee_0    conda-forge
libllvm9                  9.0.0                h770b8ee_2    conda-forge
libpng                    1.6.37               h2573ce8_0    conda-forge
libxml2                   2.9.9                h12c6b28_5    conda-forge
libxslt                   1.1.33               h320ff13_0    conda-forge
llvm-tools                9.0.0                         2    conda-forge
llvmdev                   9.0.0                h770b8ee_2    conda-forge
ncurses                   6.1               h0a44026_1002    conda-forge
nspr                      4.20              h0a44026_1000    conda-forge
nss                       3.46                 h39b4b1f_0    conda-forge
openssl                   1.1.1c               h01d97ff_0    conda-forge
pip                       19.2.3                   py36_0    conda-forge
pyside2                   5.13.1           py36h9cca949_1    conda-forge
python                    3.6.7             h94afb7f_1005    conda-forge
qt                        5.12.5               h1b46049_0    conda-forge
readline                  8.0                  hcfe32e1_0    conda-forge
setuptools                41.4.0                   py36_0    conda-forge
sqlite                    3.30.0               h93121df_0    conda-forge
tk                        8.6.9             h2573ce8_1003    conda-forge
wheel                     0.33.6                   py36_0    conda-forge
xz                        5.2.4             h1de35cc_1001    conda-forge
zlib                      1.2.11            h01d97ff_1006    conda-forge

System:

     active environment : forge-test
    active env location : /Users/psnape/miniconda/envs/forge-test
            shell level : 1
       user config file : /Users/psnape/.condarc
 populated config files : /Users/psnape/.condarc
          conda version : 4.7.11
    conda-build version : 3.18.5
         python version : 3.6.8.final.0
       virtual packages :
       base environment : /Users/psnape/miniconda  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/psnape/miniconda/pkgs
                          /Users/psnape/.conda/pkgs
       envs directories : /Users/psnape/miniconda/envs
                          /Users/psnape/.conda/envs
               platform : osx-64
             user-agent : conda/4.7.11 requests/2.22.0 CPython/3.6.8 Darwin/19.0.0 OSX/10.15
                UID:GID : 501:20
             netrc file : None
           offline mode : False

As explained here:

ContinuumIO/anaconda-issues#11297 (comment)

And mentioned on the QT bug reporter:

https://bugreports.qt.io/browse/PYSIDE-1083

The following example does not work correctly when using conda-forge but does work when using Homebrew installed Python and pip installing the pyside2 wheel:

import sys

from PySide2.QtCore import QSize, Qt
from PySide2.QtWidgets import *


class GraphicsView(QGraphicsView):
    def sizeHint(self):
        # Return scene size by default
        return QSize(500, 500)

    def __init__(self):
        super().__init__()
        self.setScene(QGraphicsScene())
        self.scene().addText('ABC')
        self.scale(20, 20)

    def test(self):
        self.scale(0.9, 0.9)
        # self.update() <= This doesn't help either


class Test(QWidget):
    def __init__(self):
        super().__init__()

        layout = QHBoxLayout()
        self.setLayout(layout)

        view = GraphicsView()
        layout.addWidget(view)

        auto_button = QPushButton('auto')
        auto_button.clicked.connect(view.test, Qt.AutoConnection) # Also doesn't work with DirectConnection
        layout.addWidget(auto_button)

        queued_button = QPushButton('queued')
        queued_button.clicked.connect(view.test, Qt.QueuedConnection)
        layout.addWidget(queued_button)


app = QApplication(sys.argv)
view = Test()
view.show()
sys.exit(app.exec_())

The intended behaviour is for both buttons to decrease the size of the text but using conda-forge the left button doesn't work correctly. I have only tested this on OSX.

@jschueller
Copy link
Contributor

See upstream.
If it helps, it works on Linux.

@rggjan
Copy link

rggjan commented Oct 14, 2019

Thanks @jschueller for the linux test!

I just updated the title to better reflect the issue. This is not only broken for this specific use case, but very often update calls seem to be broken.

For example, changing a label with setText doesn't do anything until an update is called. Many widgets don't redraw properly after content is changed. This makes PySide2 on OSX (with Anaconda/conda-forge) pretty much unusable, as you need to litter the code with updates or keep manually resizing / hiding and showing windows as a user to make the layout adapt...

@rggjan
Copy link

rggjan commented Oct 22, 2019

Another interesting observation: Running the example with dark mode enabled works fine with pyside2 but ignores the dark mode setting when using the anaconda compiled python2.

Screenshot 2019-10-22 at 10 35 23

Screenshot 2019-10-22 at 10 35 37

I suspect the reason for both issues is that anaconda compiles using a very old version of clang (4.0 instead of 11.0) and links against a very old OSX SDK (10.9), and both are not using Xcode to do the compiling:

https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html

Qt builds using a newer deployment target:

conda-forge/conda-forge.github.io#891

https://github.com/conda-forge/qt-feedstock/blob/master/recipe/conda_build_config.yaml

So I suspect that some OSX features are "enabled" in the Qt libs, but "disabled" in the python binary as it links against an old SDK, or something like this. You can see this difference also in the python binaries:

➜ otool -L ~/.pyenv/versions/3.6.8/bin/python3.6
➜ otool -L ~/.pyenv/versions/3.6.8/bin/python3.6/Users/user/.pyenv/versions/3.6.8/bin/python3.6:
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1665.10.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0)

vs

➜ otool -L ~/miniconda/envs/foo/bin/python3.6
/Users/user/miniconda/envs/foo/bin/python3.6:/Users/user/miniconda/envs/foo/bin/python3.6:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

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

3 participants