Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ubuntu 20.04 + python3 packages #1419

Closed
carsonbrownlee opened this issue Dec 18, 2020 · 17 comments
Closed

ubuntu 20.04 + python3 packages #1419

carsonbrownlee opened this issue Dec 18, 2020 · 17 comments

Comments

@carsonbrownlee
Copy link

Description of Issue

I realize that python3 support is new and ubuntu is not listed as one of the tested distros, but I'm submitting this for anyone having similar issues with ubuntu release packages and USD with python3 (python2 is no longer shipped as part of ubuntu packages). It seams that pyside2-tools package (5.14.0) on ubuntu (and apparently arch as well now) no longer ship with pyside2-uic. According to google, this seems to be because pyside2 now favors using qt5's uic generator with python, "uic -g python", however users have reported that the output is compatible with pyqt5, not pyside. The standard release ubuntu packages for qt5 also do not include a python generator, so you would need to build/download ones outside of official ubuntu packages. My eventual workaround was just to install python2.7 from scripts outside of the package manager. Other steps tried: 1. pip3 pyside-utils missing for python3.8.
2. I added uic -g python in the cmake generator scirpt. It was not working due to lack of python generator in shipped qt5.
It does not produce an error, but simply generates java code without notice. Apparently it may have issues with pyside2 (vs pyqt5) anyway.
3. pyqt5 is listed as supported on USD docs, but is not called from the cmake generators. I added code to use pyqt5 instead of pyside2, but ran into issues with the generated code.

Steps to Reproduce

  1. python3 and pyside2-tools 5.14.0. try to build USD.

System Information (OS, Hardware)

ubuntu 20.04 amd64

Package Versions

pyside2-tools 5.14.0
python 3.8.5

Build Flags

python3 enabled, usdview

@rstelzleni
Copy link
Contributor

I've run into this on ubuntu also. For whatever reason I guess they stopped shipping a pyside2-uic with pyside2-tools. It seems like some people get around this by installing a package from a third party ppa, add-apt-repository ppa:thopiekar/pyside-git I've seen that in a lot of stack overflow questions.

Personally I have sometimes resorted to just copying pyside-uic into a pyside2-uic, then changing the #! line to invoke python3, and updated all the imports that use PySide => PySide2 or pyside => pyside2. I'll paste in a patch file of the differences between my pyside-uic and pyside2-uic on an ubuntu machine, in case its helpful. Your mileage may vary, but it has worked for me.

I'm not sure if USD could fix this in the build system. It seems more like an issue with the ubuntu pyside2 packages.

Here's that patch. I was going to attach it, but it seems like you can't do that in github issues.

--- /usr/bin/pyside-uic	2018-04-03 05:40:24.000000000 -0700
+++ /usr/bin/pyside2-uic	2020-03-30 16:06:18.124327633 -0700
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 # This file is part of the PySide project.
 #
 # Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies).
@@ -24,20 +24,20 @@
 import sys
 import optparse
 
-from PySide import QtCore
-from pysideuic.driver import Driver
-from PySide import __version__ as PySideVersion
-from pysideuic import __version__ as PySideUicVersion
+from PySide2 import QtCore
+from pyside2uic.driver import Driver
+from PySide2 import __version__ as PySideVersion
+from pyside2uic import __version__ as PySideUicVersion
 
-Version = "PySide User Interface Compiler version %s, running on PySide %s." % (PySideUicVersion, PySideVersion)
+Version = "PySide2 User Interface Compiler version %s, running on PySide2 %s." % (PySideUicVersion, PySideVersion)
 
 def main():
     if sys.hexversion >= 0x03000000:
-        from pysideuic.port_v3.invoke import invoke
+        from pyside2uic.port_v3.invoke import invoke
     else:
-        from pysideuic.port_v2.invoke import invoke
+        from pyside2uic.port_v2.invoke import invoke
 
-    parser = optparse.OptionParser(usage="pyside-uic [options] <ui-file>",
+    parser = optparse.OptionParser(usage="pyside2-uic [options] <ui-file>",
             version=Version)
     parser.add_option("-p", "--preview", dest="preview", action="store_true",
             default=False,

@carsonbrownlee
Copy link
Author

thanks.
"I'm not sure if USD could fix this in the build system. It seems more like an issue with the ubuntu pyside2 packages."
yes that is my understanding, and I already submitted a bug report with that repo. The caveat would be properly supporting pyqt5, or at least taking out references to it as supported in the docs.

@jtran56
Copy link

jtran56 commented Dec 21, 2020

Filed as internal issue #USD-6524

@carsonbrownlee
Copy link
Author

carsonbrownlee commented Mar 23, 2021 via email

@cedricp
Copy link

cedricp commented Mar 23, 2021

Sorry, I deleted my post, I thought it was working, but it generated C++ code. I had to install pyside2-uic with pip3 install pyside2

@carsonbrownlee
Copy link
Author

got it, yeah same story.

@sherholz
Copy link

sherholz commented Apr 8, 2021

For me, the USD build scrip works fine under Ubuntu 20.04 and Python3.
I just had to make sure to not use the Ubuntu pyside package but install PySide2 and PyOpenGL using pip3:

pip3 install --user PySide2
pip3 install --user PyOpenGL

I installed both packages locally, I haven't tested a global install without --user.
@carsonbrownlee and @cedricp have you could try to remove the package version of pyside2, maybe the USD build script is still picking this one.

@musicinmybrain
Copy link
Contributor

musicinmybrain commented Apr 23, 2021

I am seeing a similar issue while reviewing a candidate USD package for Fedora Linux. I think upstream should support using uic-qt5 directly. However, the following workaround works for me:

cat > uic-wrapper <<'EOF'
#!/bin/sh
exec uic-qt5 -g python "$@"
EOF
chmod +x uic-wrapper

Then, in the CMake options:

-DPXR_USE_PYTHON_3:BOOL=ON \
-DPYSIDE_AVAILABLE:BOOL=ON \
-DPYSIDEUICBINARY:PATH="${PWD}/uic-wrapper"

Note that the UI compiler is needed only at build time.

This is similar to what @carsonbrownlee suggested, but a little simpler, and without altering the PATH.

@alexmyczko
Copy link

alexmyczko commented Jun 21, 2023

remind me when it's not python2 anymore, the software archive debian doesn't support python2 anymore.

# python3 build_scripts/build_usd.py /opt/USD
ERROR: uic not found -- please install PySide2 or PySide6 and adjust your PATH. (Note that this program may be named pyside2-uic or python2-pyside2-uic or pyside6-uic or pyside2-uic-2.7 depending on your platform)

@sunyab
Copy link
Contributor

sunyab commented Jun 21, 2023

@alexmyczko Where are you seeing Python 2 required? USD no longer supports Python 2 as of 23.05 and both PySide2 and PySide6 support Python 3.

@carsonbrownlee
Copy link
Author

I'm going to go ahead and close out this issue as it is 2 years old and no longer relevant.

@alexmyczko
Copy link

@sunyab when i try this:

me@sid:/var/www/debian/usd/usd-23.05/build_scripts$ python3 build_usd.py /opt/usd       
ERROR: uic not found -- please install PySide2 or PySide6 and adjust your PATH. (Note that this program may be named pyside6-uic or pyside2-uic-2.7 or python2-pyside2-uic or pyside2-uic depending on your platform)

I then end up with

# pip3 install pyside --break-system-packages
*many letters*
    only these python versions are supported: [(2, 6), (2, 7), (3, 2), (3, 3), (3, 4)]
*more letters*

but

$ python3 --version
Python 3.11.4

@alexmyczko
Copy link

@musicinmybrain

on Debian i've got these:

ls -la /usr/bin/uic*
lrwxrwxrwx 1 root root 9 May  3  2019 /usr/bin/uic -> qtchooser
lrwxrwxrwx 1 root root 9 May  3  2019 /usr/bin/uic3 -> qtchooser

@alexmyczko
Copy link

@carsonbrownlee does this work for you on Ubuntu 22.04?

@carsonbrownlee
Copy link
Author

carsonbrownlee commented Jun 22, 2023

yeah unfortunately it's a bit of a game of version roulette on many systems and I believe there are some posted issues related to python 3.11 on previous releases. On USD 22.03 I am able to build on mac with python 3.9 and PySide 6 (installed via pip3.9) currently. I got 22.03 building on ubuntu as well, but suspect it may have similar issues with python 3.11.

@sunyab
Copy link
Contributor

sunyab commented Jun 22, 2023

@alexmyczko Just noting that PySide, PySide2, and PySide6 are all distinct packages. PySide is very old at this point and support is deprecated in USD. To install the latter two, try pip3 install PySide2 or pip3 install PySide6

@alexmyczko
Copy link

alexmyczko commented Jun 22, 2023

@sunyab so I got this far:

usd-23.05/build_scripts# python3 ./build_usd.py /opt/http://sid.ethz.ch/debian/usd/usd-23.05/usd

but that failed at

[ 33%] Copying vtBufferSource.h ...
[ 33%] Built target hd_headerfiles
gmake: *** [Makefile:136: all] Error 2

ERROR: Failed to run 'cmake --build . --config Release --target install -- -j16'

i was missing PySide6, let me try with that added... thanks for the feedback

aha now it says:

ERROR: Failed to run 'cmake --build . --config Release --target install -- -j16'
See /opt/usd/build/usd-23.05/log.txt for more details.

which is here: http://sid.ethz.ch/debian/usd/usd-23.05/build_scripts/log.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants