Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Mac M1 & PySide 2/6 can't Install lib



  • Hey

    I'm trying to install PySide2/6 on my m1 mac but all I get is >

    ERROR: Could not find a version that satisfies the requirement PySide2
    ERROR: No matching distribution found for PySide2
    
    

    Any ideas how to bite it?

    TIA


  • Lifetime Qt Champion

    Hi,

    How are you trying to install it ?
    Using the system pip ? Conda ? Brew ? Macports ?



  • Pycharm just in settings > interpreter + PySide2/ PySide6
    As well as I tried via pip install I think too.
    I'm new to Mac so perhaps thats totally wrong way of doing it ?
    TIA


  • Lifetime Qt Champion

    There are several possible ways to handle Python on macOS.

    However, based on the Qt for Python Wiki page, it looks like the M1 is not yet natively supported.

    I would check with homebrew and/or conda.



  • @SGaist F!ck big time. Bought mac so I can dev my apps for Apple & Qt and now Qt is not supported... ohh boy now I'm in trouble :- )
    Gotta start praying that M1 get supports... this... year... maybe? :- X


  • Lifetime Qt Champion

    Qt for Python is not yet supported.

    You can still develop in C++ or try to build PySide2/6 yourself.



  • Hi @Dariusz
    I use this article and I successfully build PySide6 - 6.1.2 from sources on my MacBook Pro with M1.

    In the begin I start install necessary utilities via brew:

    brew install qt@6 llvm cmake ninja
    

    After that I clone the setup repo, activate python venv and install python packages:

    git clone --recursive https://code.qt.io/pyside/pyside-setup
    cd pyside-setup && git checkout 6.1.2
    python3 -m venv testenv
    source testenv/bin/activate
    pip install -r requirements.txt
    

    I've found that the installation will work only if set this system variable:

    export CLANG_INSTALL_DIR=/opt/homebrew/opt/llvm
    

    Next I run the build process. It takes a while time (check the correct path for qmake - qmake -v):

    python setup.py build --qmake=/opt/homebrew/Cellar/qt/6.1.2/bin/qmake --build-tests --ignore-git --parallel=8
    

    In the result I see the finish message:

    --- Build completed (413s)
    

    To install the PySide into the current virtual env run this:

    python3 setup.py install --qmake=/opt/homebrew/Cellar/qt/6.1.2/bin/qmake --build-tests --ignore-git --parallel=8 --reuse-build
    

    Completed. You will see the PySide package in pip list:

    pip list | grep PySide
    PySide6                       6.1.2
    

    Also I use these commandd to copy the installed package to another project

    export MY_PROJECT_VENV_PATH=../another-project/venv
    rsync -av testenv/bin/shiboken6* $MY_PROJECT_VENV_PATH/bin
    rsync -av testenv/bin/pyside6-* .$MY_PROJECT_VENV_PATH/bin
    rsync -av testenv/lib/python3.9/site-packages/PySide6*  $MY_PROJECT_VENV_PATH/lib/python3.9/site-packages/
    rsync -av testenv/lib/python3.9/site-packages/shiboken6*  $MY_PROJECT_VENV_PATH/lib/python3.9/site-packages/
    


  • Hi this was of great help, however I cannot get it done.

    As of today the only difference for me is that the version downloaded by brew was 6.2.0.
    In the last compilation steps I get an error saying:

    CMake Error at cmake_install.cmake:61 (file):
      file INSTALL cannot find "/opt/homebrew/Cellar/qt/6.2.0/bin/Assistant.app":
      No such file or directory.
    

    I have no idea whay that is missing or how to get it. Any help is appreciated.

    Thanks,
    Santi



  • @sanpen
    just need to create some links, then you can walk around the issue.

    cd /opt/homebrew/Cellar/qt/6.2.0/bin
    ln -s /opt/homebrew/Cellar/qt/6.2.0/libexec/Assistant.app Assistant.app
    ln -s /opt/homebrew/Cellar/qt/6.2.0/libexec/Designer.app Designer.app
    ln -s /opt/homebrew/Cellar/qt/6.2.0/libexec/Linguist.app Linguist.app
    ln -s /opt/homebrew/Cellar/qt/6.2.0/libexec/pixeltool.app pixeltool.app
    ln -s /opt/homebrew/Cellar/qt/6.2.0/libexec/qdbusviewer.app qdbusviewer.app



  • I just saw this thread. @Dariusz, go into the /Applications folder on your Mac and right click the 'Terminal' app in the Utilities folder. You'll see a check box for 'Open using Rosetta'. If you check that, you should be good to go. Just close and reopen the Terminal app if it was already open. Hope that works.



  • @lyoo said in Mac M1 & PySide 2/6 can't Install lib:

    @sanpen
    just need to create some links, then you can walk around the issue.

    cd /opt/homebrew/Cellar/qt/6.2.0/bin
    ln -s /opt/homebrew/Cellar/qt/6.2.0/libexec/Assistant.app Assistant.app
    ln -s /opt/homebrew/Cellar/qt/6.2.0/libexec/Designer.app Designer.app
    ln -s /opt/homebrew/Cellar/qt/6.2.0/libexec/Linguist.app Linguist.app
    ln -s /opt/homebrew/Cellar/qt/6.2.0/libexec/pixeltool.app pixeltool.app
    ln -s /opt/homebrew/Cellar/qt/6.2.0/libexec/qdbusviewer.app qdbusviewer.app

    This worked, but interestingly the bin directory as of 6.2.2 contains aliases for these apps, just without the .app suffix.



  • FYI: PySide 6.2.2+ provide support for Apple Silicon, so you could simple run a pip install pyside6 and get it.
    Because PySide2 is in maintenance mode, there has been no discussion on backporting the support.


Log in to reply