From de29b5ddca038393256a1cdc4a3e7c1eee129d2d Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Tue, 16 Apr 2019 18:50:14 +0200 Subject: Add Some Hints For Dealing With PyInstaller PyInstaller has a bug when multiple versions are installed. There are also some other traps which can give additional trouble. The "--reuse-build" problems have vanished meanwhile and were removed. The numpy problem with Python 2.7.16 was added. Change-Id: I6c60d8ee823963b59fc6b65a6ab8007314e4098c Reviewed-by: Friedemann Kleint --- sources/pyside2/doc/deployment-pyinstaller.rst | 49 ++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'sources/pyside2') diff --git a/sources/pyside2/doc/deployment-pyinstaller.rst b/sources/pyside2/doc/deployment-pyinstaller.rst index 8e6a76052..f361daf4a 100644 --- a/sources/pyside2/doc/deployment-pyinstaller.rst +++ b/sources/pyside2/doc/deployment-pyinstaller.rst @@ -122,3 +122,52 @@ an executable inside the `dist/` directory that you can execute:: cd dist/ ./MyApplication + + +Current Caveats To Be Aware Of +============================== + + +PyInstaller Problem +------------------- + +As already mentioned, `PyInstaller` will pick a system installation of PySide2 or +Shiboken2 instead of your virtualenv version without notice, if it exists. +This may be no problem if those PySide2 or shiboken2 versions are the same. + +If you are working with different versions, this can result in frustrating sessions, +when you think you are testing a new version, but `PyInstaller` +is silently working with a different, older version. + + +Problem with numpy in Python 2.7.16 +----------------------------------- + +A recent problem of PyInstaller is the appearance of Python 2.7.16 . +This Python version creates a problem that is known from Python 3 as a `Tcl/Tk` problem. +This does rarely show up in Python 3 because `Tcl/Tk` is seldom used with `PyInstaller. + +On Python 2.7.16, this problem is very much visible, since many people are using numpy. +For some reason, installing `numpy` creates a dependency of `Tcl/Tk`, which can +be circumvented only by explicitly excluding `Tcl/Tk` related things by adding +this line to the analysis section of the spec-file:: + + excludes=['FixTk', 'tcl', 'tk', '_tkinter', 'tkinter', 'Tkinter'], + + +Safety Instructions +------------------- + +o When using `PyInstaller` with `virtualenv`, make sure that there is no system + installation of PySide2 or shiboken2. + +o Before compiling, use `pip -uninstall pyside2 shiboken2 -y` multiple times, until + none of the programs is found anymore. + +o Pip is usually a good tool. But to be 100 % sure, you should directly remove + the PySide2 and shiboken2 folders from site-packages. + +o Be sure to use the right version of pip. The safest way to really run the right + pip, use the Python that you mean: Instead of the pip command, better use:: + + python -m pip -- cgit v1.2.3 From 8689054da961be4cede5cfae7c6a6f9d6efc36a4 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 14 May 2019 11:21:46 +0200 Subject: Fix pyi generation on Windows When trying to generate the pyi files on Windows, the python modules failed to be imported due to Qt dlls not being in PATH. This happened because we overrode PATH instead of prepending to it. When generating pyi files on Windows, make sure to prepend new values to PATH while also keeping the old values. Amends 97df448edbc035a2f531508a5cfe5739fb2de18d Change-Id: I74c374c3a9687169dd4af0ed232bda76a0267fc4 Reviewed-by: Christian Tismer --- sources/pyside2/cmake/Macros/PySideModules.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'sources/pyside2') diff --git a/sources/pyside2/cmake/Macros/PySideModules.cmake b/sources/pyside2/cmake/Macros/PySideModules.cmake index cbf401102..77dc8c8ac 100644 --- a/sources/pyside2/cmake/Macros/PySideModules.cmake +++ b/sources/pyside2/cmake/Macros/PySideModules.cmake @@ -169,6 +169,19 @@ macro(create_pyside_module) set(ld_prefix "LD_LIBRARY_PATH=") endif() set(ld_prefix "${ld_prefix}${pysidebindings_BINARY_DIR}/libpyside${PATH_SEP}${SHIBOKEN_SHARED_LIBRARY_DIR}") + + # On Windows we also need to propagate the whole environment PATH value, because pyside modules + # import Qt, and the Qt modules are found from PATH. + if(WIN32) + # Get the value of PATH with CMake separators. + file(TO_CMAKE_PATH "$ENV{PATH}" path_value) + + # Replace the CMake list separators with "\;"s, to avoid the PATH values being + # interpreted as CMake list elements, we actually want to pass the whole string separated + # by ";" to the command line. + make_path(path_value "${path_value}") + string(APPEND ld_prefix "${PATH_SEP}${path_value}") + endif() set(generate_pyi_options run --skip --sys-path "${pysidebindings_BINARY_DIR}" "${SHIBOKEN_PYTHON_MODULE_DIR}") -- cgit v1.2.3