achille-martin / pyqt-crom

Create cross-platform apps (Android for now) using only Python and the Qt Framework (PyQt5 for now).
MIT License
25 stars 2 forks source link

Bug: folder name with dot not found by PyQt5 #44

Open stone-cloud opened 1 month ago

stone-cloud commented 1 month ago

Hi @achille-martin, It's me! Opening a new issue is for the convenience of others who encounter the same problem to query. Thank you so much again. pyqt-crom is very simple and user-friendly.

Description

When I run my own app, python package file copying failed. I found the reason is that some folder names contain " . ", such as "Models.2" . But when copying, it will be replaced with " / ". TO BE HONEST, I feel strange. Because the demo ran successfully and also included the pyqt5 package. If you know how to solve it, please let me know.

Issues

----- REVIEWING COMMAND-LINE ARGS -----

[INFO] The .pdt path received is: /home/gw/LYH/androidDepoly/QTgui/config.pdt
[INFO] The number of jobs received is: 1
[INFO] The qmake path received is: /home/gw/Qt/5.15.2/android/bin/qmake
[INFO] The request to reload the sysroot is: False
[INFO] The request to disable progress messages is: False
[INFO] The request to enable verbose progress messages is: True

----- INITIALISING AND COLLECTING VARIABLES -----

[INFO] Pdt directory location is: /home/gw/LYH/androidDepoly/QTgui. This is the reference directory.
[INFO] The sysroot path received is: /home/gw/LYH/androidDepoly/QTgui/sysroot.toml
[INFO] Setting application name to: imageClass
[INFO] The app entrypoint name received is: classifier
[INFO] The app package path received is: /home/gw/anaconda3/envs/androidDeploy/lib/python3.10/site-packages
[INFO] The app release dir is set to: /home/gw/anaconda3/envs/androidDeploy/lib/python3.10/site-packages/../releases/2024_05_17-15_42_36

----- BUILDING TARGET SYSROOT -----

Verifying host architecture 'linux-64'...
Verifying target architecture 'android-64'...
zlib: verifying...
zlib: determining installed version from '/home/gw/Android/Sdk/ndk/21.4.7075529/sysroot/usr/include/zlib.h'.
zlib: verified v1.2.7.
Qt: verifying...
Running '/home/gw/Qt/5.15.2/android/bin/qmake -query'.
Qt: verified v5.15.2.
Python: verifying...
WARNING: Python: v3.8.19 is untested.
Python: verified v3.8.19.
SIP: verifying...
Running 'sip-module --version'.
SIP: verified v6.7.12.
PyQt: verifying...
PyQt: verified v5.15.2.
Creating /home/gw/LYH/androidDepoly/QTgui/sysroot-android-64/build.
Deleting /home/gw/LYH/androidDepoly/QTgui/sysroot-android-64/build.

----- BUILDING THE PYQTDEPLOY PROJECT -----

Verifying host architecture 'linux-64'...
Verifying target architecture 'android-64'...
zlib: verifying...
zlib: determining installed version from '/home/gw/Android/Sdk/ndk/21.4.7075529/sysroot/usr/include/zlib.h'.
zlib: verified v1.2.7.
Qt: verifying...
Running '/home/gw/Qt/5.15.2/android/bin/qmake -query'.
Qt: verified v5.15.2.
Python: verifying...
WARNING: Python: v3.8.19 is untested.
Python: verified v3.8.19.
SIP: verifying...
Running 'sip-module --version'.
SIP: verified v6.7.12.
PyQt: verifying...
PyQt: verified v5.15.2.
Cleaning /home/gw/LYH/androidDepoly/QTgui/build-android-64.
Creating /home/gw/LYH/androidDepoly/QTgui/build-android-64.
Traceback (most recent call last):
  File "/home/gw/anaconda3/envs/androidDeploy/bin/pyqtdeploy-build", line 8, in <module>
    sys.exit(main())
  File "/home/gw/anaconda3/envs/androidDeploy/lib/python3.10/site-packages/pyqtdeploy/pyqtdeploybuild_main.py", line 82, in main
    builder.build(args.opt, args.resources, args.clean, args.build_dir)
  File "/home/gw/anaconda3/envs/androidDeploy/lib/python3.10/site-packages/pyqtdeploy/builder/builder.py", line 168, in build
    resource_names = self._generate_resources(parts, job_writer,
  File "/home/gw/anaconda3/envs/androidDeploy/lib/python3.10/site-packages/pyqtdeploy/builder/builder.py", line 316, in _generate_resources
    self._write_python_modules(project.application_package.parts,
  File "/home/gw/anaconda3/envs/androidDeploy/lib/python3.10/site-packages/pyqtdeploy/builder/builder.py", line 594, in _write_python_modules
    self._write_python_module(name, part, parts, part_root_dir,
  File "/home/gw/anaconda3/envs/androidDeploy/lib/python3.10/site-packages/pyqtdeploy/builder/builder.py", line 585, in _write_python_module
    shutil.copy2(src_path, dst_path)
  File "/home/gw/anaconda3/envs/androidDeploy/lib/python3.10/shutil.py", line 434, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/home/gw/anaconda3/envs/androidDeploy/lib/python3.10/shutil.py", line 254, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/home/gw/anaconda3/envs/androidDeploy/lib/python3.10/site-packages/PyQt5/Qt5/qml/QtQml/Models/2/plugins.qmltypes'
achille-martin commented 1 month ago

Hi @stone-cloud, Thank you for your persistence (and for opening a new issue).

I am not exactly sure that I understand your problem.

Can you send me a very minimal example of your app so that I can test on my end (reproduce the error)?

Can you explain as well:

stone-cloud commented 1 month ago

Ok, I am building an app, the repo address is classdemo. It can select a picture and perform classification prediction, then return and print the classification results. The program will use Python packages opencv onnxruntime numpy pyqt5. When I run my program, I get the error.

achille-martin commented 1 month ago

@stone-cloud, thank you for sharing.

I had a look at the code: do you have an issue with PyQt5 or any python dependency then? (that means you don't have an issue with pyqtdeploy or PyQt-CroM right?)

If that is the case, then I will set the priority as low and come back later if I can!

Besides, a little warning: I am still trying to figure out how to "cleanly" add non-standard python packages (like numpy) into the Android app (reference: https://github.com/achille-martin/pyqt-crom/issues/32). This means that for now you might not be able to port your app to Android just yet. Unless you figure things out before I do!

stone-cloud commented 1 month ago

I am not exactly sure that I understand what you mean. I am confused because my demo and the demo in PyQt-CroM both include the Python packagePyQt5, but it is not working in my demo.

achille-martin commented 1 month ago

Ok, let's take a step back then because there is mutual confusion there.

I suppose that you are trying to create a custom app based on the demo app.

1) Have you tried running the demo app first? (this one -> https://github.com/achille-martin/pyqt-crom/tree/main/examples/demo/demo_project/demo_pkg)

If no -> try it If yes -> great

2) Does the demo app run on Linux?

If no -> let's see what is going on If yes -> great

3) Does the demo app run on Android?

If no -> let's see what is going on If yes -> great

4) Does your custom app run on Linux?

If no -> you'll have to debug that first If yes -> great

5) Does your custom app run on Android?

According to the initial message, it does not.

To narrow the problem down:

6) Which module is the source of the problem?

I suggest that you remove the "imported modules" (and associated functions) one by one until you figure out which one is the problem.

For instance, run your app with only PyQt5, then PyQt5 + numpy, and so on, until the problem appears.

stone-cloud commented 1 month ago

I will try it and am excited for the next version. Thank you.