Install PySide on Mac: is there a working method?

I may be doing something wrong, but I was trying to install pyside on Mac 10.12 (Sierra). Here is what I tried (after installing Qt with brew):

  • C precompiled package (1.2.1); fails due to an "incompatible package".
  • With sudo -H pip install pyside (1.2.4): a crash occurs with the following error:
  Qt QTGUI library not found. Qt QTXML library not found. Qt QTCORE library not found. CMake Error at ApiExtractor/CMakeLists.txt:82 (qt4_add_resources): Unknown CMake command "qt4_add_resources". 
  • With brew install pyside==1.2.2 : it works successfully, but when you call it from the python program, ImportError: dlopen(/Library/Python/2.7/site-packages/PySide/QtCore.so, 2): Libmrary not loaded: libpyside-python2.7.1.2.dylib Referenced from: /Library/Python/2.7/site-packages/PySide/QtCore.so Reason: unsafe use of relative rpath libpyside-python2.7.1.2.dylib in /Library/Python/2.7/site-packages/PySide/QtCore.so with restricted binary fails ImportError: dlopen(/Library/Python/2.7/site-packages/PySide/QtCore.so, 2): Libmrary not loaded: libpyside-python2.7.1.2.dylib Referenced from: /Library/Python/2.7/site-packages/PySide/QtCore.so Reason: unsafe use of relative rpath libpyside-python2.7.1.2.dylib in /Library/Python/2.7/site-packages/PySide/QtCore.so with restricted binary

The last one gave some hope, and I tried PySide Mac OS X El Capitan import error, library not loaded: @ rpath / libpyside.cpython-34m.1.2.dylib . Unfortunately, the explanation was pretty elliptical, and I ended up breaking everything.

Am I missing something obvious? The fact that the pre-compiled packages are outdated and the web document is not updated, that the brew installation does not work (and this is not mentioned in the documentation) and in general the number of questions asked about pyside and the technical complication of the answers do not seem to be very good signs.

Does anyone know what happens with installing PySide on Mac OS, technically? What is the best solution in my particular case?

Overall, is there any hope of improvement with PySide on Mac?

Update (January 25, 2017): Workaround?

Since we are waiting for the update from Pyside, someone wants to accept the installation call 1.2.2 on OS Sierra using brew and allow "unsafe use of the relative path" ,? Perhaps suggest a step-by-step guide?

This could save a day for PySide on Mac ... while reducing the time pressure on the Pyside development team?

+5
source share
6 answers

I have a MAC osSierra (10.12.6). I needed to install PySide 1.2.4 for Python 3.3.6. To create and install PySide 1.2.4, I did the following. You can do the following for any Python 3.3.x, I think.

I am new to Mac and Python. Please ignore if I have any errors.

  • Install pyenv
    brew install pyenv
  • Install Python 3.3.6 using pyenv
    pyenv install 3.3.6
  • Add python 3.3.6 to the system path
    PATH = "/Users/Myname/.pyenv/version/3.3.6/ben: $ {PATH}"
    export PATH
  • Install Xcode from the app store, then do the following. Downloading and installing Xcode took me 30-40 minutes.
    xcode-select --install
    sudo xcodebuild -license
  • Install cmake
    brew install cmake
  • Make sure cmake is installed. I see version 3.10.0 installed
    cmake -version
  • Press qt4. Note. I tried qt5, but pyside build does not work for me with qt5.
    brew tap cartr / qt4
    brew trolley / qt4
  • Set qt @ 4.
    brew install qt @ 4
  • Verify that qmake is installed. I see version 2.01a installed
    qmake -version
    (If qmake is not recognized, create links to it using the command below)
    brew link cartr / qt4 / qt @ 4 --force
  • If you use PySide.QtWebKit in your programs, you need to install qt-webkit. Install pyside (1.2.2 ??), which will install qt-webkit. I'm not sure if qt-webkit can be installed directly if someone can fix me.
    brew install pyside
  • Download the tar PySide 1.2.4 file.
    wget https://pypi.python.org/packages/source/P/PySide/PySide-1.2.4.tar.gz
  • Cancel tar file
    tar -xvf PySide-1.2.4.tar.gz
  • Go to the folder
    cd PySide-1.2.4
  • Build a pyside. This build step took me almost 30-40 minutes
    python setup.py bdist_wheel
  • Make sure the dist folder is created and there is a file with the pyside file in it.
  • Go to the "dist" folder
    cd dist
  • Instal PySide, the last step!
    pip install PySide-1.2.4-cp33-cp33m-macosx_10_12_x86_64.whl
  • Congratulations !, you now have PySide 1.2.4 for Python 3.3.x
+3
source

This is not an answer, but unfortunately there was no output from the pyside command for macOS sierra. Only supported OS from Apple

  • 10.6 Snow LeopardOS X

  • 10.7 LionOS X

  • 10.8 Mount LionOS X

  • 10.9 MavericksOS X

  • 10.10 Yosemite

Update: (you can try it yet)

  curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/fdfc724dd532345f5c6cdf47dc43e99654e6a5fd/Formula/qt5.rb brew install ./qt5.rb 

If the above lines do not work:

You will need the Xcode command line tools:

  xcode-select --install sudo xcodebuild -license 

Then the following packages can be easily installed via brew:

  brew install qt5 cmake libxslt libxml2 

This will install Qt 5.6.1-1 and cmake 3.5.2 your system.

Now is the time to clone! Not from github, but from this link: So, clone the pyside-setup repository and remove gitmodules as well:

  git clone --recursive https://codereview.qt-project.org/pyside/pyside-setup 

This command works great for people using Python 2.7.11 and Python 3.5.1. Remember that you have a package with a wheel installed or you will receive a bdist_wheel error message.

  python setup.py bdist_wheel --ignore-git --qmake=/usr/local/Cellar/qt5/5.6.1-1/bin/qmake --cmake=/usr/local/bin/cmake --openssl=/usr/local/Cellar/openssl/1.0.2h_1/bin 

(Note: The exact paths given in the arguments may not be the same on your system, so check them out before compiling)

Install the wheel:

The wheel was built reliably in the dist folder. So just cd dist and pip install away!

Notes on precompiled wheels

Unfortunately, and, as in the case of PySide, these wheels are not "portable" and are not installed on systems that no longer have the installed version of Qt5 used at compile time. This, I believe, is due to the fact that PySide2 is dynamically linked (instead of statically) to the Qt5 installation. Hopefully this is what Qt will call through the official PySide2 wheels, as Riverbank Software now provides the fully portable PyQt5 wheel for Python 3, which is absolutely awesome.

New repository (not from github)

Link

+1
source

Mac steps from here worked for me: https://fredrikaverpil.imtqy.com/2016/08/17/compiling-pyside2/

You will need the Xcode command line tools:

 xcode-select --install sudo xcodebuild -license 

Then the following packages, easily installed via brew:

 brew install qt5 cmake libxslt libxml2 

Clone the pyside-setup repository and also pull out its gitmodules:

 git clone --recursive https://codereview.qt-project.org/pyside/pyside-setup 

Build it. This command worked perfectly for me using Python 2.7.11 and Python 3.5.1. Remember that you have a package with a wheel installed or you will receive a bdist_wheel error message.

 cd pyside-setup python setup.py bdist_wheel --ignore-git --qmake=/usr/local/Cellar/qt5/5.6.1-1/bin/qmake --cmake=/usr/local/bin/cmake --openssl=/usr/local/Cellar/openssl/1.0.2h_1/bin 

Last but not least, install the wheel:

 cd dist pip install PySide2-2.0.0.dev0-cp27-cp27m-macosx_10_12_x86_64.whl 

All loans go to the wonderful post of Fredrick Averpil.

+1
source

You need a specific version of Qt and pyside.

Install both QT 4.8.5 and pyside from Mac installers on the page below:

https://wiki.qt.io/PySide_Binaries_MacOSX

+1
source

You need QT4 to install PySide on 10.11 (not sure about 10.12).

Install QT5 either through Brew or through the installer, get cmake through Brew and get the latest PySide source ( https://pypi.python.org/packages/source/P/PySide/PySide-1.2.4.tar.gz ) Run the following to get Qt4:

 brew tap cartr/qt4 brew tap-pin cartr/qt4 brew install qt_4 

As soon as you do it; cd in the source folder and run the following command:

 python setup.py bdist_wheel --ignore-git --qmake=[QMAKE_FROM_QT4_PATH] --cmake=[YOUR_CMAKE_PATH] cd dist pip install [YOUR_BUILT_PYSIDE_WHEEL] 

Once you do this, you can verify that PySide is working correctly by opening the Python console and typing import PySide

+1
source

I still don't have a solution, but I found an alternative.

First of all, I'm not an expert (I'm a super new code). Based on my own experience below, you will also find a solution.

First I need to clarify something, there are two ways to use this QT GUI - PyQt from Riverbank Computing and / or PySide, originally developed by Nokia.

I tried many different ways to install PySide on my MacOS Sierra version 10.12.5, but did not succeed, so I found PyQt, which does the same.

Watching this video, I installed PyQT5 on my Mac OS and it works now. https://www.youtube.com/watch?v=2kHk8ZjxH64

Hello World example using PyQT http://pythoncentral.io/intro-to-pysidepyqt-basic-widgets-and-hello-world/

Wiki.qt.io says: "PySide has included support for Python 3.2 since version 1.0.8." but it does not work for me.

Good luck.

0
source

Source: https://habr.com/ru/post/1262315/


All Articles