Why is this PySide2 build failing to find a generated C++ wrapper? - python

I'm trying to build the latest release of PySide2 on MacOs Sierra 10.12.2 (16C67) with python 3.6. As of now, the build invoked with
python3 setup.py build
is failing with the following error: (I have substituted my name out of my home directory...)
clang: error: no such file or directory: '/Users/myusername/pythonpackage/pyside-setup/pyside3_build/py3.6-qt5.8.0-64bit-release/pyside2/PySide2/QtCore/PySide2/QtCore/qabstractstate_wrapper.cpp'
I am using Qt 5.8 as installed by homebrew.
I have looked through the build log and cannot find where/if that file is generated, as I am not familiar with the binding generation. Using PyQt is not an option, as its license is not applicable to my application.
Why is this source missing, and what can I do to make the build succeed?
PySide2 was installed from this repo: git://code.qt.io/pyside/pyside-setup.git

Turns out I stated the issue in the actual question: The PySide2 README states that it supports Qt 5.5 and 5.6. I was trying to use 5.8.
I solved my problem by using an old homebrew qt installed via:
curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/fdfc724dd532345f5c6cdf47dc43e99654e6a5fd/Formula/qt5.rb
brew install ./qt5.rb
followed by the build invocation, and it worked.

Related

Python py2app and pillow error: Mach-O header is too large

I'm unable to use py2app to build a python application which contains the pillow package. I'm using:
Mac OSX El Capitan (10.11.16)
Python 3.7.3 (Installed via Homebrew)
Pillow 6.0.0
py2app 0.19
macholib 1.11
The script works fine when called from the command line and the py2app bundle works fine if compiled in alias mode python3 setup.py py2app -A
But, when I try to compile a standalone bundle using:
python3 setup.py py2app --packages=PIL
I get the following error message:
ValueError: New Mach-O header is too large to relocate in '/Users/RG/Library/Mobile Documents/com~apple~CloudDocs/iHal/Code/QuotesApp/dist/Quotes.app/Contents/Resources/lib/python3.7/PIL/.dylibs/liblcms2.2.dylib' (new size=1688, max size=1680, delta=48)
I've been searching but have had no luck finding help with this issue, is it possible it's an El Capitan (OSX 10.11.16) issue?
my system specs:
Mac OSX Mojave (10.14.15)
Python 3.7.4 (python.org)
Pillow 6.1.0
py2app 0.19
macholib 1.11
I had the same issues as you. The reason why it fails is that the library is wrong compiled. I figured out two solutions.
On my system the library is located at: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PIL/.dylibs/
If you do not use color management in your project you can delete the library "liblcms2.2.dylib". Now you can run py2app and it will build.
The second solution is more work and the way I use it in my project.
First, you need Xcode because we have to recompile the "littlecms" library.
Xcode is around 6gb and you get it from the Apple Appstore. On my system have the version 10.2.1.
Download the library littlecms in version 2.2: https://www.littlecms.com/
You will be redirected to SourceForge:
https://sourceforge.net/projects/lcms/files/lcms/2.2/
Download one of these files: lcms2-2.2.zip or lcms2-2.2.tar.gz and extract it on your system.
The library source comes with the Xcode project file and you will find in Projects/mac.
If you are familiar with the terminal you can build it without the Xcode GUI. In this case, go into the extracted folder of littlecms and type following commands.
./configure
make
make check
If the last command(make check) runs fine the library is ready for deployment.
You will find the compiled library in the folder: src/.libs/.
Replace the library which comes with the PIL package with your compiled library.
Finally, run py2app to build your project.
If this is not working you have to tell the linker a flag.
Go to your littlecms source folder and type the commands:
make clean
./configure LDFLAGS="-headerpad_max_install_names"
make
make check
Replace the compiled library with the PIL.
so long,
Phil

Installation for pyzmq for Windows fails with error C2143, C4142

I have a windows 7 machine with python 2.7 and I am trying to install pyzmq following these steps. I built libzmq got the binaries and copied them from libzmq\bin\Win32\Debug\v140\dynamic\ to libzmq\lib\ so the next step will work(compiler will have access to /lib and /includes from the same parent folder). But, on this step:
$ python setup.py configure --zmq=../libzmq
I installed pyzmq and libzmq on the same parent folder, as in the installation description related to pyzmq, libzmq is here: ../libzmq
But when I need to configure the pyzmq, I get this error:
I have VS Community 2015 installed and everything seems fine.
ZMQ usually provides sln files that will build from Microsoft Visual Studio. You will have to dig around a little to find it. You are better off trying to get that to work then going directly from the python setup.py that you are currently attempting. Note that you also need libsodium to be built and installed. Thankfully, they also provide Microsoft sln files.
In any case, you are probably better using one of the Python wheels like those from Christoph http://www.lfd.uci.edu/~gohlke/pythonlibs/
Just do
pip install <wheel file>
and you should be good.
Good luck!

Pyside Installation "Failed to find the MSVC compiler version 10.0 on your system"

I'm currently in the process of developing a gui for my python script and want to do that by using PySide.
Right now I just can't get it up and running. PIP alwyas exits with this error:
nmake not found. Trying to initialize the MSVC env...
Searching MSVC compiler version 10.0 error: Failed to find the MSVC compiler version 10.0 on your system.
I have the following components installed:
Python 3.4.4 (64Bit)
QT 5.6 / 5.7
Pycharm Community Edition
Windows 7 64Bit
I can run PIP and Python from the terminal without having to cd into the python directory. So my PATH Variables are set correctly.
Does anybody have the same issues or maybe a solution?
Best
Jo
PySide requires Python 2.6 or later and Qt 4.6 or better.
Qt 5.x is currently not supported.
From: https://pypi.python.org/pypi/PySide/1.2.4#installing-pyside-on-a-windows-system
So maybe using qt4.x(>=4.6) instead of qt5.x can fix your problem.
I think the reason is that pip on your system install PySide from source package so you need a c/c++ complier.
Maybe you can install PySide binary version directly following this:
pip install PySide --only-binary :all:
If it doesn't work, please try to download ".exe" file, and run it instead of using pip.
".exe" from: https://download.qt.io/official_releases/pyside/

Trouble installing PyQt on Mac, version mis-reading

So after installing the whole 5.5 Qt package, and installing SIP, and the Xcode command line tools, I get this problem when trying to install the PyQt folder i got from the .gz I downloaded from the website
Joshuas-MacBook-Pro-2:PyQt-gpl-5.5 Josh$ python configure.py -q /Users/Josh/Qt/5.5/clang_64/bin -d /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/
Querying qmake about your Qt installation...
sh: /Users/Josh/Qt/5.5/clang_64/bin: is a directory
Error: PyQt5 requires Qt v5.0 or later. You seem to be using v3. Use the
--qmake flag to specify the correct version of qmake.
However, I clearly have v5.5 of Qt.
Any idea how to fix this or type in a different command to install it directly?
After spending much time getting PyQt working smoothly on a Mac, my strong recommendation is to install PyQt via Homebrew. The steps are very simple:
1) Install homebrew from here
2) Edit your ~./bash_profile to include the following at the top, so that later installs will see the brew versions of installs:
export PATH=/usr/local/bin:$PATH
3) Refresh your terminal window:
>source ~/.bash_profile
4) Then, simply install python, sip, pyqt in that order:
>brew install python
>brew install sip
>brew install pyqt
You should now have a fully working python/pyqt environment that you can customize via pip etc.

Install PyQt5 on Mavericks

I'm trying to install PyQt5 on my Mavericks machine.
I have tried to do it like in this link here Installing PyQt5 with Python 3 On OS X
When I try to install qt5 with brew, there comes a warning:
qt5-5.2.1 already installed
But then when I type python configure.py
Terminal says:
querying qmake about your Qt installation... Error: PyQt5 requires Qt
v5.0 or later. You seem to be using v4.8.6. Use the
--qmake flag to specify the correct version of quake.
Can anyone please help me with this?
When you installed Qt via homebrew, you should have received a warning similar to:
This formula is keg-only, so it was not symlinked into /usr/local.
Qt 5 conflicts Qt 4 (which is currently much more widely used).
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/qt5/lib
CPPFLAGS: -I/usr/local/opt/qt5/include
While this information is very helpful, what you are specifically looking for will be in a directory under /usr/local/opt/qt5/$VERSION_OF_QT/bin/ as qmake is a binary utility.
For me, qmake is located at /usr/local/Cellar/qt5/5.3.1/bin/qmake. Take this path and feed it to your --configure switch and you'll be all set!
e.g. python configure.py --qmake /usr/local/Cellar/qt5/5.3.1/bin/qmake

Categories

Resources