jazzycamel / pymylabel Goto Github PK
View Code? Open in Web Editor NEWA minimal example of using SIP to create a Python wrapper for a C++ Qt5 library.
License: MIT License
A minimal example of using SIP to create a Python wrapper for a C++ Qt5 library.
License: MIT License
ive been trying to get this to work using qt5.5 but keep getting an error
C:\Users\Williams\PyMyLabel-master>%python3% configure.py QMake version 3.0 Using Qt version 5.5.0 in C:/Python34/Lib/site-packages/PyQt5/lib C:\python34\sip -t WS_WIN -t Qt_5_5_0 -I C:\Users\Williams\PyMyLabel-master\sip -I C:\python34\sip\PyQt5 -I C:\python34\include -I C:\Users\Williams\PyMyLabel-master\src -c C:\Users\Williams\PyMyLabel-master\modules -b C:\Users\Williams\PyMyLabel-master\modules\PyMyLabel.sbf -w -o C:\Users\Williams\PyMyLabel-master\sip\PyMyLabel.sip sip: Unable to find file "QtGui/QtGuimod.sip"
Recently I found myself in need to use SIP for wrapping some custom C++ Qt library and using it in python. Then I found this repository which looked very promising for my particular project. I have immediately tested code provided in this repo on Manjaro, with Python 3.6 and (Py)Qt 5.9 - no problems. Everything went smooth. But that was only for testing, because I need it to work on Windows 10. And here the problems begun...
My setup:
Problems with step one: python configure.py
Since the newest versions of python like to install themselves in C:\Program Files (x86)
almost or all the paths that are added to cmd in configure.py
must be in quotes in order to work. The only exception was config.sip_bin
which for whatever reason did throw error even in quotes, but since I had sip
on my system path I have just omitted the full path and used sip
.
Then of course the known problem with sip: Unable to find file "QtGui/QtGuimod.sip"
. I have managed to solve it with help of #1 so I will not elaborate on that.
Finally, since there is no more MSVC 2010 available, we have to use VS2017 Community. Which means that the line qmake_cmd += " -spec win32-msvc2010"
throws an error. Substituting win32-msvc2010
with win32-msvc
, winrt-x86-msvc2015
or winrt-x86-msvc2017
enabled me to move further (it did not throw an error) but I am still not sure whether it is correct and which should I use.
Eventually the python configure.py
did worked and it generated the makefile.
Problems with step two: make
I am not used to compiling stuff on windows, but as it appears windows uses nmake
instead of make
. I do not know how it was with MSVC 2010, but using nmake
with VS 2017 turns out to be a bit tricky. First I had to run cmd /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
to enter the VS 2017 Developer Command Prompt and then I had to source the environment variables with "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
. As stated on Microsoft Forum "it is not a bug, it's a feature" and it is the only way to use nmake
. Eventually the nmake
command worked. But it throws an error:
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
cd src
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f Makefile.Release
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
cd D:\Scripts\PyMyLabel-master\modules
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"
Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DLL /MANIFEST /MANIFESTFILE:PyMyLabel.pyd.manifest /SUBSYSTEM:WINDOWS /INCREMENTAL:NO /OUT:PyMyLabel.pyd @C:\Users\Devlig~1\AppData\Local\Temp\nm569E.tmp
LINK : fatal error LNK1181: cannot open input file 'Qt5Core.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.EXE"' : return code '0x49d'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
And here I am stuck with no idea how to proceed. I suppose that the configure.py
is still not working properly and generates buggy makefiles. I have tried adding some additional paths to sip that will point to where Qt dlls are but with no luck. Here is how my sip cmd looks like this:
sip -t WS_WIN -t Qt_5_9_2 -I "D:\Scripts\PyMyLabel-master\sip" -I "C:\Program Files (x86)\Python36-32\sip" -I "E:\Qt\5.9.1\mingw53_32\include" -I "E:\Qt\5.9.1\mingw53_32\lib" -I "C:\Program Files (x86)\Python36-32\include" -I "D:\Scripts\PyMyLabel-master\src" -c "D:\Scripts\PyMyLabel-master\modules" -b "D:\Scripts\PyMyLabel-master\modules\PyMyLabel.sbf" -w -o "D:\Scripts\PyMyLabel-master\sip\PyMyLabel.sip"
-I "E:\Qt\5.9.1\mingw53_32\include" -I "E:\Qt\5.9.1\mingw53_32\lib"
are the paths I have added but they change nothing.
I am not experienced with this so I might be missing something obvious. It would be so great if you @jazzycamel could update this minimal SIP example repository for newer versions of Windows, Python, (Py)Qt, SIP and VS. As I mentioned at the beginning, on Linux it worked for me out of the box. Or please direct me on the right path on how to proceed. Thank you.
Can anyone help me?
PS C:\Users\Huwei\Desktop\QCustomPlot-PyQt5-master> python .\setup.py install running install running build running build_ext Setting qmake to 'D:/Software/Qt/5.5/mingw492_32/bin/qmake.exe' Setting make to 'D:/Software/Qt/Tools/mingw492_32/bin/mingw32-make.exe' Setting Qt include dir to 'D:/Software/Qt/5.5/mingw492_32/include/' Make static qcustomplot library... D:/Software/Qt/5.5/mingw492_32/bin/qmake.exe C:\Users\Huwei\Desktop\QCustomPlot-PyQt5-master\lib/qcustomplot-static.pro D:/Software/Qt/Tools/mingw492_32/bin/mingw32-make.exe D:/Software/Qt/Tools/mingw492_32/bin/mingw32-make.exe -f Makefile.Release mingw32-make.exe[1]: Entering directory 'C:/Users/Huwei/Desktop/QCustomPlot-PyQt5-master/build/temp.win-amd64-3.6/Release' g++ -c -pipe -fno-keep-inline-dllexport -O2 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQCUSTOMPLOT_COMPILE_LIBRARY -DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\..\..\lib -I. -ID:\Software\Qt\5.5\mingw492_32\include -ID:\Software\Qt\5.5\mingw492_32\include\QtPrintSupport -ID:\Software\Qt\5.5\mingw492_32\include\QtWidgets -ID:\Software\Qt\5.5\mingw492_32\include\QtGui -ID:\Software\Qt\5.5\mingw492_32\include\QtANGLE -ID:\Software\Qt\5.5\mingw492_32\include\QtCore -Irelease -ID:\Software\Qt\5.5\mingw492_32\mkspecs\win32-g++ -o release\qcustomplot.o ..\..\..\lib\qcustomplot.cpp D:\Software\Qt\5.5\mingw492_32\bin\moc.exe -DUNICODE -DQCUSTOMPLOT_COMPILE_LIBRARY -DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D__GNUC__ -DWIN32 -ID:/Software/Qt/5.5/mingw492_32/mkspecs/win32-g++ -IC:/Users/Huwei/Desktop/QCustomPlot-PyQt5-master/lib -ID:/Software/Qt/5.5/mingw492_32/include -ID:/Software/Qt/5.5/mingw492_32/include/QtPrintSupport -ID:/Software/Qt/5.5/mingw492_32/include/QtWidgets -ID:/Software/Qt/5.5/mingw492_32/include/QtGui -ID:/Software/Qt/5.5/mingw492_32/include/QtANGLE -ID:/Software/Qt/5.5/mingw492_32/include/QtCore -I. ..\..\..\lib\qcustomplot.h -o release\moc_qcustomplot.cpp g++ -c -pipe -fno-keep-inline-dllexport -O2 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQCUSTOMPLOT_COMPILE_LIBRARY -DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I..\..\..\lib -I. -ID:\Software\Qt\5.5\mingw492_32\include -ID:\Software\Qt\5.5\mingw492_32\include\QtPrintSupport -ID:\Software\Qt\5.5\mingw492_32\include\QtWidgets -ID:\Software\Qt\5.5\mingw492_32\include\QtGui -ID:\Software\Qt\5.5\mingw492_32\include\QtANGLE -ID:\Software\Qt\5.5\mingw492_32\include\QtCore -Irelease -ID:\Software\Qt\5.5\mingw492_32\mkspecs\win32-g++ -o release\moc_qcustomplot.o release\moc_qcustomplot.cpp ar -ru release\libqcustomplot.a release/qcustomplot.o release/moc_qcustomplot.o ar: creating release\libqcustomplot.a mingw32-make.exe[1]: Leaving directory 'C:/Users/Huwei/Desktop/QCustomPlot-PyQt5-master/build/temp.win-amd64-3.6/Release' building 'qcustomplot' extension H:\Python36\sip.exe -t WS_WIN -t Qt_5_9_3 -c build\temp.win-amd64-3.6\Release -b build\temp.win-amd64-3.6\Release\qcustomplot.sbf -I H:\Python36\sip\PyQt5 qcustomplot.sip sip: Unable to find file "QtGui/QtGuimod.sip" error: command 'H:\\Python36\\sip.exe' failed with exit status 1 PS C:\Users\Huwei\Desktop\QCustomPlot-PyQt5-master>
It's just the sip: Unable to find file "QtGui/QtGuimod.sip"
make me so mad!
Can anyone help me???
Hello, I am on linux Python3.4, I am getting the following error:
Entering directory '/home/ilian/git-projects/pyqtlibtest/PyMyLabel-master/modules'
g++ -c -pipe -fPIC -O2 -Wall -W -DNDEBUG -DMYLABEL_LIBRARY -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -I. -I/home/ilian/git-projects/pyqtlibtest/PyMyLabel-master/src -I/home/ilian/opt/Qt5.7.1/5.7/gcc_64/include -I/home/ilian/git-projects/prosfitdesktop/include/python3.4m -I/usr/include/python3.4m -o sipPyMyLabelcmodule.o sipPyMyLabelcmodule.cpp
In file included from sipPyMyLabelcmodule.cpp:7:0:
sipAPIPyMyLabel.h:12:21: fatal error: QMetaType: No such file or directory
compilation terminated.
Makefile:17: recipe for target 'sipPyMyLabelcmodule.o' failed
make[1]: *** [sipPyMyLabelcmodule.o] Error 1
make[1]: Leaving directory '/home/ilian/git-projects/pyqtlibtest/PyMyLabel-master/modules'
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.