[Qt-creator] Qt for Python / deploy to Remote Linux Target

Cristián Maureira-Fredes Cristian.Maureira-Fredes at qt.io
Thu May 16 20:46:06 CEST 2019

Hello Pablo,

let me answer inline:

On 5/16/19 7:40 PM, Pablo Rogina wrote:
> Hi,
> I've been trying to use Qt Creator to write a Qt for Python
> application in my PC machine, but I want to deploy and run it to a
> Raspberry Pi (the device has Arch Linux ARM 32 bit, with Pyside2
> packages installed there).

The Qt for Python compatibility in Creator is limited.
After the LSP we wanted to only add the option for people
to include simple projects, using the PythonEditor plugin,
and two simple options to create a project witht the wizard.

Everything else, is not supported, nor tested.

> So far I've tried 2 things:
> 1. created a Python project in Qt Creator but I'm not currently able
> to get the list of files to deploy populated. I used a .pro file with
> INSTALLS variable but it didn't work either

.pro files are not designed to handle projects based in Python,
all the hacks you can manage to write to achieve something will probably
not work at some stage.

> 2. created a Generic project, and used the QCreatorDeployment.txt.
> Here I removed all the steps in the Build Settings

I'm surprised this option even kind of work.

> In both cases, in the Run Settings I used a Custom Executable (remote
> device) where I used python as the remote executable and the name of
> the initial Python script (i.e. main.py) as command line arguments. I
> also enabled the Forward to local display option. And something
> annoying in both cases is that I created a kit with the generic Linux
> device but removed the compiler settings and it's showing an
> exclamation sign icon.

Because that's not supported.

> Only with case #2 I was able to get the app running in the remote
> device displaying in my local PC.

I guess that worked because the python files were shipped as additional
script files, to a fake project, but I don't have much experience
deploying on Creator.

> Could it be possible to just create a Python project, and pick the
> remote Linux device while having the list of files to deploy
> populated?
> Thanks.

Deployment doesn't work the same for C++/QML and Python applications.
In Python that concept is called "freezing".

In the Qt for Python project, the freezing subject was resolved
by providing tutorials on how to use ad-hoc tools for python applications:


if under the need ot freezing python application,
use the command-line options provided in the official documentation,
trying to bypass the Creator way of deploying applications
with some tricks will end up only in many issues.

The next steps in the compatibility with Creator are:
- Improve the RunConfiguration for .pyproject files,
- Integration with uic/rcc,
- Deployment (Still using one of the tools mentioned in the docs).

The only possible ways to use Creator with Qt for Python are:
- Create simple projects,
- Edit Python files,
- Execute Python files.

If you feel like digging into Creator's code to improve the
compatibility between Creator and Qt for Python, I would more
than happily review your patches, because at the moment it's not
a high priority task, and we don't have a deadline to make
Creator 100% compatible.


PS: For any questions related to Qt for Python, we are really active on 
the #qt-pyside channel (freenode).

Dr. Cristián Maureira-Fredes
Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin

More information about the Qt-creator mailing list