-
Notifications
You must be signed in to change notification settings - Fork 6
pyside2-uic missing #44
Comments
Hm, could it be that we need to compile |
I can't say for sure, but it kind of looks like that is a pure-Python package. I'll give it a try. |
Some steps to actually be able to execute
|
Would it be possible to include these in the wheel too? |
Most likely. Right off the bat, I'm not sure how to do it. I would have to read up on wheel building. |
I've noticed that on my system I actually did get pyside2uic installed when pip installing the PySide2 wheel. It's just that the You can do a |
Yes, I got that too. |
@mottosso What OS is that on? |
Ubuntu 14, from the wheel. |
The full reproducible is in the original post. |
hello everyone. Sorry for my english ;( I had a error when I try compile UI from pysideUIC on OS X: Unknown Qt widget: QFont I followed your recomendation...
Finally, remplace all pyside2uic installation from site-packagesdir for https://github.com/pyside/pyside2-tools and works for me. |
Wow, the reported bug is still open/unresolved. 😞 |
Same here, I tried the workaround from davidherran, but still get the error: ImportError: cannot import name 'compileUi' |
@davidherran @bjquinn it would be much better to poke QtC about this. The issue seems to be on their end. You can make a comment of this here for example: https://bugreports.qt.io/browse/PYSIDE-357 |
Yep, I tried to do that there as well, but my registration confirmation from them seems to get lost in the ether, so I'm not able to complete registration. I'll try again later. |
I just hit this long-standing issue and am best unpleased.
Yes, that is exactly what it could be. We have to do that. Because we didn't do that, the Yes, this is arguably poor package installation design – and that at least is not our fault. A new upstream issue requesting that the For inscrutable reasons that remain unclear to me, QtC elected not to merge the
this is awful ↗ Likewise, QtC performed literally no work on PySide2 during August because:
this is awful ↗ Which means that, even if QtC technically could help us, they won't. Which means that:
Your time appears limited, @fredrikaverpil. I can appreciate the pained expression presumably now sprouting across your face. My face is similarly distraught. Nonetheless, this is a significant blocker for numerous users (notably, me). It's also well within our capacity to fix. Would you like a bit of assistance in doing so? My intuition is that the Ubuntu 16.04 + Python 3.5 Dockerfile would be a reasonable place for us to start hammering out a working solution. For reasons that should become clear shortly, the Yes, a new upstream issue requesting that this be clarified and/or corrected should probably be opened. Again, I am lazy and overtired and increasingly grumpy and shall not be doing that. I'm afraid your Docker expertise exceeds my own by a generous margin. While completely untested, amending the aforementioned Dockerfile as follows should nudge us closer to where we want to be:
The above instructions derive entirely from our working Gentoo ebuild for I leave this to your capable expertise, Team PySide2-Wheels. Because I am tired and penniless. |
This gave me a good chuckle, thanks for the well articulated and humorous, late-night write-up @leycec. XD |
Thank you! I'll be performing all evening for pennies and toothless grimaces. 😬 Actually, I'm about to collapse. I couldn't help but investigate this a bit further, however, as the From what little I can tell of that vast morass of illegible "wizardry," the underlying issue might be that their Since QtC have been out-to-lunch for over a year on this issue, we can't really depend on a timely fix from their end. Instead, it would probably behove us to attempt to fix this on our end by manually installing |
Hm. I was under the impression that all that was missing was the
Do you mean that cloning the 5.6 branch of PySide2 is not enough? Here is the $ git clone --recursive --branch 5.6 https://codereview.qt-project.org/pyside/pyside-setup
Cloning into 'pyside-setup'...
remote: Counting objects: 38108, done
remote: Finding sources: 100% (38108/38108)
remote: Total 38108 (delta 28036), reused 37909 (delta 28036)
Receiving objects: 100% (38108/38108), 13.00 MiB | 305.00 KiB/s, done.
Resolving deltas: 100% (28036/28036), done.
Submodule 'sources/pyside2-examples' (https://codereview.qt-project.org/pyside/examples.git) registered for path 'sources/pyside2-examples'
Submodule 'sources/pyside2-tools' (https://codereview.qt-project.org/pyside/pyside-tools.git) registered for path 'sources/pyside2-tools'
Submodule 'wiki' (https://github.com/PySide/pyside2.wiki.git) registered for path 'wiki'
Cloning into '/Users/fredrik/code/repos/pyside-setup/sources/pyside2-examples'...
remote: Counting objects: 3814, done
remote: Finding sources: 100% (3814/3814)
remote: Total 3814 (delta 1918), reused 3803 (delta 1918)
Receiving objects: 100% (3814/3814), 9.89 MiB | 2.22 MiB/s, done.
Resolving deltas: 100% (1918/1918), done.
Cloning into '/Users/fredrik/code/repos/pyside-setup/sources/pyside2-tools'...
remote: Counting objects: 586, done
remote: Finding sources: 100% (586/586)
remote: Total 586 (delta 379), reused 585 (delta 379)
Receiving objects: 100% (586/586), 181.38 KiB | 1.23 MiB/s, done.
Resolving deltas: 100% (379/379), done.
Cloning into '/Users/fredrik/code/repos/pyside-setup/wiki'...
remote: Counting objects: 241, done.
remote: Total 241 (delta 0), reused 0 (delta 0), pack-reused 241
Receiving objects: 100% (241/241), 138.59 KiB | 403.00 KiB/s, done.
Resolving deltas: 100% (106/106), done.
Submodule path 'sources/pyside2-examples': checked out '8df6dccecc5165f7c3ec5896c9be8baceda7161f'
Submodule path 'sources/pyside2-tools': checked out '7fe32567c75b6b9985b9efbecf74477c9e829fb2'
Submodule path 'wiki': checked out 'ac1b69fabc1a9f81da585fe1a1aa4188862ced66'
$ ll pyside-setup/sources/pyside2-tools
total 144
drwxr-xr-x 16 fredrik staff 544B Aug 19 21:43 ./
drwxr-xr-x 7 fredrik staff 238B Aug 19 21:43 ../
-rw-r--r-- 1 fredrik staff 49B Aug 19 21:43 .git
-rw-r--r-- 1 fredrik staff 61B Aug 19 21:43 .gitattributes
-rw-r--r-- 1 fredrik staff 12B Aug 19 21:43 .gitignore
-rw-r--r-- 1 fredrik staff 168B Aug 19 21:43 AUTHORS
-rw-r--r-- 1 fredrik staff 3.2K Aug 19 21:43 CMakeLists.txt
-rw-r--r-- 1 fredrik staff 18K Aug 19 21:43 LICENSE-rcc
-rw-r--r-- 1 fredrik staff 19K Aug 19 21:43 LICENSE-uic
-rw-r--r-- 1 fredrik staff 817B Aug 19 21:43 README.md
-rw-r--r-- 1 fredrik staff 940B Aug 19 21:43 cmake_uninstall.cmake
drwxr-xr-x 17 fredrik staff 578B Aug 19 21:43 pylupdate/
drwxr-xr-x 7 fredrik staff 238B Aug 19 21:43 pyrcc/
-rw-r--r-- 1 fredrik staff 2.7K Aug 19 21:43 pyside2-uic
drwxr-xr-x 14 fredrik staff 476B Aug 19 21:43 pyside2uic/ <------------------ !
drwxr-xr-x 5 fredrik staff 170B Aug 19 21:43 tests/
What the... are you sure?
Yes, unfortunately.
Absolutely 🙂
Works for me!
It seems you have already investigated this quite thoroughly, possibly more than QtC has done, so I really think you should report this when you have the time. Perhaps use the already opened issue and append your findings: https://bugreports.qt.io/browse/PYSIDE-357
But what you do there is actually installing
Could you set up a PR where you update the Xenial Python 3.5 Dockerfile where you run the cmake command to set those tags just prior to building the wheel? ENTRYPOINT \
cd /pyside-setup/sources/pyside2-tools && \
# Delete the port_v2 also?
/opt/cmake-3.5.2-Linux-x86_64/bin/cmake \
-DPYTHON_EXTENSION_SUFFIX=".cpython-35m" \
-DPYTHON_BASENAME=".cpython-35m" && \
cd /pyside-setup && \
python3 setup.py \
bdist_wheel \
--ignore-git \
--qmake=/opt/qt56/bin/qmake \
--cmake=/opt/cmake-3.5.2-Linux-x86_64/bin/cmake Then; # Build image
docker build . -f Dockerfile-ubuntu16.04-qt5.6-py3.5 -t fredrikaverpil/pyside2-ubuntu16.04-qt5.6-py3.5 .
# Build PySide, generate wheel
docker run --rm -v $(pwd):/pyside-setup/dist fredrikaverpil/pyside2-ubuntu16.04-qt5.6-py3.5 |
By the way, when I build PySide2 with the Xenial/Python3.5 Dockerfile, I see this: |
So, if you build PySide2 right now using the Xenial/Python 3.5 Dockerfile, this is what happens during the build phase when it reaches
|
But even so, the $ docker run --rm --interactive --tty -v $(pwd):/pyside-setup/dist --entrypoint=bash fredrikaverpil/pyside2-ubuntu16.04-qt5.6-py3.5
root@ea6cfb5cadf1:/# pip3 install pyside-setup/dist/PySide2-5.6-cp35-cp35m-linux_x86_64.whl
Processing /pyside-setup/dist/PySide2-5.6-cp35-cp35m-linux_x86_64.whl
Installing collected packages: PySide2
Successfully installed PySide2-5.6
root@ea6cfb5cadf1:/# /usr/local/bin/pyside2-uic
Traceback (most recent call last):
File "/usr/local/bin/pyside2-uic", line 7, in <module>
from PySide2.scripts.uic import main
File "/usr/local/lib/python3.5/dist-packages/PySide2/scripts/uic.py", line 28, in <module>
from pyside2uic.driver import Driver
File "/usr/local/lib/python3.5/dist-packages/pyside2uic/__init__.py", line 27, in <module>
from pyside2uic.Compiler import indenter, compiler
ImportError: No module named 'pyside2uic.Compiler' And this is because the root@ea6cfb5cadf1:/# ll /usr/local/lib/python3.5/dist-packages/pyside2uic
total 88
drwxr-sr-x 3 root staff 4096 Aug 19 22:03 ./
drwxrwsr-x 1 root staff 4096 Aug 19 22:03 ../
-rw-r--r-- 1 root staff 5000 Aug 19 22:03 __init__.py
drwxr-sr-x 2 root staff 4096 Aug 19 22:03 __pycache__/
-rw-r--r-- 1 root staff 4039 Aug 19 22:03 driver.py
-rw-r--r-- 1 root staff 1101 Aug 19 22:03 exceptions.py
-rw-r--r-- 1 root staff 4533 Aug 19 22:03 icon_cache.py
-rw-r--r-- 1 root staff 3986 Aug 19 22:03 objcreator.py
-rw-r--r-- 1 root staff 16295 Aug 19 22:03 properties.py
-rw-r--r-- 1 root staff 32268 Aug 19 22:03 uiparser.py But if we move it there (along with root@ea6cfb5cadf1:/# cp -r /pyside-setup/sources/pyside2-tools/pyside2uic/Compiler /usr/local/lib/python3.5/dist-packages/pyside2uic/
root@ea6cfb5cadf1:/# cp -r /pyside-setup/sources/pyside2-tools/pyside2uic/port_v3
root@ea6cfb5cadf1:/# /usr/local/bin/pyside2-uic
Error: one input ui-file must be specified
root@ea6cfb5cadf1:/# /usr/local/bin/pyside2-uic --help
Usage: pyside2-uic [options] <ui-file>
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-p, --preview show a preview of the UI instead of generating code
-o FILE, --output=FILE
write generated code to FILE instead of stdout
-x, --execute generate extra code to test and display the class
-d, --debug show debug output
-i N, --indent=N set indent width to N spaces, tab if N is 0 (default:
4)
Code generation options:
--from-imports generate imports relative to '.' Now why was |
Thanks for investigating this deeper, Fred. You are a scholar and a bearded gentleman.
All Which brings us to No, really. This script is inane, insane, redundant, and patently ridiculous. Someone – Nokia, QtC, I have no idea who – thought that reinventing the entire makefile toolchain by implementing an ad-hoc (and plainly broken) CMake and GNU They were dead wrong. The result is an unreadable, undocumented, and unmaintainable swamp of detritus that should never be. Just remembering it makes my scalp psoriasis itch with bloody pustules.
Exactly. Because apparently copying directories is hard when you try to do it in
EDIT: None of the following work, for the obvious reason that they fail to modify the binary wheel – exactly as you note. I too now know shame. The opposite, rather. I no longer trust the But that's probably overkill. There's a fine line between mistrust and tinfoil-hat paranoia – and tinfoil hats no longer appear to be in fashion. As you cleverly suggest, recursively copying from the source to target Unrelatedly, here's a poetic Git emoticon. I call it Blood Moon over Bridge over Troubled Water. 🌉
...if
Right. Let's drop the code bomb, because things are about to get heavyweight. When compiling To see why this is, locate the system-wide CMake directory containing PySide2-specific
These files are the hot glue integrating the The contents of
Thus, the need to explicitly specify these environment variables.
Excellent catch. That would be the one... for the Python 3.5 Dockerfile, anyway. Presumably, each platform will have its own unique extension tag. Because. Just because.
In my defense, I claim self-inflicted insanity. You're... absolutely right. I neglected the critically important Very well, cruel fate. The proper solution is to fix QtC's
Pray for my burning soul. I tread into dark waters. |
@leycec hehe, thanks for clarifying all of this. Okay, so I propose something like this: Let's find something in
And replace that with injected custom code which'll copy the files so that it will be included in the wheel. Kind of what I did here to work around PYSIDE-552 (or RUN sed -i.bak $'s/if(Qt5Designer_FOUND)/find_package(Qt5Designer)\\\nif(Qt5Designer_FOUND)/g' pyside-setup/sources/pyside2/CMakeLists.txt Then we'll add this fix prior to building, in all Dockerfile files. When we know it works, you or I can submit our solution as a patch to QtC. By the way. I know QtC is aware of the state of |
One idea to achieve this is to create a # Replace
# # <install>/lib/site-packages/pyside2uic/* -> <setup>/pyside2uic
# with...
import pyside2uicfix
pyside2uicfix.apply_fix() |
Exactly. Brilliant minds think brilliantly. This is the line I've been inspecting for the past hour. For reasons unclear to me, "they" decided to reinvent the stdlib It's there. Somewhere. Deep within the metastasised tumour of Further meditation and scowling into the darkness are needed.
I vomit inside every time I rifle through this file. Every time.
Nice. Let's rummage a bit deeper and see where we can slot that into. Completely unrelatedly, were you aware of the This option only appears to be supported under Linux, but sumthin's better'n nuthin'. |
f!ck f!!cK f!!!CK f@CK F@@ck Did a three year-old toddler with an adolescent neckbeard author this It's the The In our PySide-based multiphysics biology simulator, for example, we define this keyword as follows:
We leverage a blacklist-style approach, packaging everything except the six specified top-level directories. Because it's dynamic, it's fully future-proofed against unexpected codebase changes. It just works. Excellent. Prepare to have your blood curdled, because this is how
Note the omission of a call to In this case, QtC leveraged neither a blacklist- nor whitelist-style approach. They did it manually. Which you're never supposed to do. Predictably, they failed spectacularly. Because it's static, it's guaranteed to catastrophically blow up on the first codebase change. Which it did. Not so excellent. One year, people. This issue was open for one year because somebody neglected to learn about packaging standards and how to implement sane Coddling toddlers is not currently listed in my job description. This was my Sunday evening and I frankly had better things to do. Like shoot vengeance into murderous Russian war criminals as Nathan Drake in the critically acclaimed Uncharted 2: Among Thieves remake bundled with the Uncharted Collection for the best-selling PlayStation 4! Only $59.95, while limited supplies last. Fortunately, the fix is trivial – slowly transforming my dour frown into a grim, shark-toothed smile. For us at least, the fix is just to roll our eyes and manually patch their
That's it. Done. |
Oh. My. God. |
I got an error during PySide2 wheel building on CentOS 7 (Python 3.6) when applying your sed hack.
Tracked down the issue by glancing through if sys.version_info[0] > 2:
rmtree("{dist_dir}/pyside2uic/port_v2".format(**vars))
else:
rmtree("{dist_dir}/pyside2uic/port_v3".format(**vars)) Meaning, your sed hack needs either So; # Python 2
RUN sed -i -e 's~\b\(packages\b.*\)],~\1, "pyside2uic.Compiler", "pyside2uic.port_v2"],~' pyside-setup/setup.py
# Python 3
RUN sed -i -e 's~\b\(packages\b.*\)],~\1, "pyside2uic.Compiler", "pyside2uic.port_v3"],~' pyside-setup/setup.py |
Although it would've been much better with a RUN sed -i -e "s~\b\(packages\b.*\)],~\1, 'pyside2uic.Compiler', 'pyside2uic.port_v' + str(sys.version_info[0])],~" pyside-setup/setup.py Will be updating all Dockerfile files and merging this shortly. Thanks @leycec 👍 for narrowing it down to a single sed. |
You guys rock. Very excited about this! |
Okay, I believe this is now fixed on all platforms. Wheels are currently uploading for Windows and should be done within the next couple of hours. |
Absolutely. I knew you'd be onto that like a hot potato on day-old pizza. I meant to mention it, but felt too livid with red-eyed rage to form coherent sentences or valid Thankfully, you picked up the muddy ball and carried us into the home stretch. 🏈
That's... clever. I like clever.
And you are amazing. Thanks for devoting scarce time and sanity to finalizing this. We're all exceptionally grateful! We owe you several buckets worth of organic free-range craft microbrew, delivered to the discrete back alley stairwell of your discretion. |
Haha. |
Thank you! Started using it today, works perfectly so far! |
There might be something missing, or I'm doing it wrong. :(
Stack trace
Full reproducible
The text was updated successfully, but these errors were encountered: