Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: ketank on November 13, 2021, 11:25:17 AM

Title: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 13, 2021, 11:25:17 AM
Hi

I am struggling to install pyqt5.
All the dependencies get installed successfully but then it fails with
pip install -v --no-cache-dir --prefer-binary pyqt5

fails with - AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

environment - RPi 4 with 8 GB RAM, python - 3.8.7, pip 21.3.1

complete error message

Code: [Select]
Using pip 21.3.1 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
Defaulting to user installation because normal site-packages is not writeable
Collecting pyqt5
  Downloading PyQt5-5.15.6.tar.gz (3.2 MB)
     |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 3.2 MB 1.8 MB/s
  Running command /usr/local/bin/python3 /tmp/pip-standalone-pip-v8_euyno/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-9e__4znn/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --prefer-binary -- 'sip >=6.4, <7' 'PyQt-builder >=1.9, <2'
  Collecting sip<7,>=6.4
    Using cached sip-6.4.0-cp36-abi3-linux_armv7l.whl
  Collecting PyQt-builder<2,>=1.9
    Using cached PyQt_builder-1.12.2-py3-none-any.whl (5.6 MB)
  Collecting packaging
    Using cached packaging-21.2-py3-none-any.whl (40 kB)
  Collecting setuptools
    Using cached setuptools-58.5.3-py3-none-any.whl (946 kB)
  Collecting toml
    Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
  Collecting pyparsing<3,>=2.0.2
    Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
  Installing collected packages: pyparsing, toml, setuptools, packaging, sip, PyQt-builder
  Successfully installed PyQt-builder-1.12.2 packaging-21.2 pyparsing-2.4.7 setuptools-58.5.3 sip-6.4.0 toml-0.10.2
  Installing build dependencies ... done
  Running command /usr/local/bin/python3 /usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpa50av598
  Getting requirements to build wheel ... done
  Running command /usr/local/bin/python3 /usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp_16ohk2q
  Traceback (most recent call last):
    File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
      hook = backend.prepare_metadata_for_build_wheel
  AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

  During handling of the above exception, another exception occurred:

Code: [Select]
  Traceback (most recent call last):
    File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 160, in prepare_metadata_for_build_wheel
      whl_basename = backend.build_wheel(metadata_directory, config_settings)
    File "/tmp/pip-build-env-9e__4znn/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 51, in build_wheel
      project = AbstractProject.bootstrap('pep517')
    File "/tmp/pip-build-env-9e__4znn/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
      project.setup(pyproject, tool, tool_description)
    File "/tmp/pip-build-env-9e__4znn/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 587, in setup
      self.apply_user_defaults(tool)
    File "project.py", line 63, in apply_user_defaults
      super().apply_user_defaults(tool)
    File "/tmp/pip-build-env-9e__4znn/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
      super().apply_user_defaults(tool)
    File "/tmp/pip-build-env-9e__4znn/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 234, in apply_user_defaults
      self.builder.apply_user_defaults(tool)
    File "/tmp/pip-build-env-9e__4znn/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 67, in apply_user_defaults
      raise PyProjectOptionException('qmake',
  sipbuild.pyproject.PyProjectOptionException
  Preparing metadata (pyproject.toml) ... error

    [EDIT]: Added code tags.  Rich
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Juanito on November 13, 2021, 12:35:58 PM
If pyqt5 involves installing qt5, which is huge, using pip is going to use a lot of ram.

You'd probably be better off compiling qt5 and pyqt5 and making extensions out of them.
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 13, 2021, 01:01:05 PM
Thank you Juanito

compiling qt5 is something I was avoiding but seems no option ...

let me try and that post an update if I could do that
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 14, 2021, 03:35:47 AM
Hi

I am trying to compile qt5 following the instructions at - http://tinycorelinux.net/11.x/x86_64/tcz/src/qt-5.x/

The problem is step to where I have to extract the qt5 tar. It end with
tar: can't open 'qt-everywhere-src-5.14.0/qtwebengine/src/3rdparty/chromium/cc/raster/raster_buffer.h': No space left on device

I am using a 32 G card and 8 GB RAM.
I feel it is limited by the RAM...

PLEASE HELP!!!!
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Juanito on November 14, 2021, 03:43:20 AM
You need to compile on permanent storage - I use an external usb hd, but you can also use a usb stick.

It is surprising you can't extract the qt5 tarball in 4gb ram (limited by 32-bit piCore) - what else do you have in ram?
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 14, 2021, 04:18:48 AM
I will try extracting to a USB drive.

Its a fresh installation and have just installed the requirements based on compile_qt-5.x. nothing else.

RMA is using 738 MB (see attached)

Code: [Select]
/etc/os-release
AME=piCore
VERSION="13.0.3"
ID=piCore
VERSION_ID=13.0.3
PRETTY_NAME="piCore Linux 13.0.3"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:picore:picore_linux:13.0.3"
HOME_URL="http://tinycorelinux.net/"
SUPPORT_URL="http://forum.tinycorelinux.net/"
BUG_REPORT_URL="http://forum.tinycorelinux.net/"


Code: [Select]
tc@box:/etc$ uname -a
Linux box 5.10.16-piCore-v7l #1 SMP Tue Feb 16 16:38:31 UTC 2021 armv7l GNU/Linux

    [EDIT]: Added code tags.  Rich
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Rich on November 14, 2021, 10:37:21 AM
Hi Juanito
... It is surprising you can't extract the qt5 tarball in 4gb ram ...
Not really that surprising. If you look here:
http://tinycorelinux.net/11.x/x86_64/tcz/src/qt-5.x/
The listing shows the compressed tarball is over 500Mb in size:
Code: [Select]
qt-everywhere-src-5.14.0.tar.xz                    11-Dec-2019 12:00           547854788Since the contents are primarily text, I imagine it compresses very nicely. At 8 to 1 you are over 4Gb plus whatever
workspace is required to decompress plus the 700Mb shown being used in his screenshot.

The screenshot also shows 2Gb of swap. Is that on permanent storage or also in RAM?

Out of curiosity I placed a few source files into a directory and made a compressed tarball out of them:
Code: [Select]
tc@E310:~/compress$ ls -l
total 208
-rw-r--r-- 1 tc staff 34342 Nov 14 10:24 All.tar.xz
-rw-r--r-- 1 tc staff 20023 Nov 14 09:57 AutoCursor.c
-rw-r--r-- 1 tc staff  6329 Nov 14 09:57 HideMouse.c
-rw-r--r-- 1 tc staff 62903 Nov 14 09:57 ImageEdge.c
-rw-r--r-- 1 tc staff 16630 Nov 14 09:57 PicFormat.c
-rw-r--r-- 1 tc staff 17968 Nov 14 09:57 Resizer.c
-rw-r--r-- 1 tc staff 20412 Nov 14 09:57 TapDrill.c
-rw-r--r-- 1 tc staff   263 Nov 14 09:57 TapDrill.h
-rw-r--r-- 1 tc staff 15177 Nov 14 09:58 TapDrillSizes.h
tc@E310:~/compress$ du -bc *.c *.h | tail -n1
159705  total
tc@E310:~/compress$ calc 159705/34342
4.65043
tc@E310:~/compress$
Even with this small sample size I got a 4.65 to 1 compression ratio.
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 14, 2021, 12:35:06 PM
Hi Rich,

It is a separate SWAP file.
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 15, 2021, 01:09:02 AM
Current status -
Could not build qt5 based on http://tinycorelinux.net/11.x/x86_64/tcz/src/qt-5.x/
If is failing to create the libraries.

Working to build the latest version 5.12 from source. Will update the progress.

Question - I have to build some other components for the same.
I am building the tcz packages say for cmake right now (the one available in the Pi Core release is older one).

Who and How should I send these packages so they can be used by others too?
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Rich on November 15, 2021, 01:15:01 AM
Hi ketank
If you are considering submitting an extension, Instructions can be found here:
https://web.archive.org/web/20200208152109/http://wiki.tinycorelinux.net/wiki:creating_extensions#submitting

Use the  tcesubmit  email address, not the  picoresubmit  address.
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 15, 2021, 01:26:15 AM
Thank you Rich
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Juanito on November 15, 2021, 02:48:23 AM
If is failing to create the libraries.

What error did you get?
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 15, 2021, 06:58:45 AM
It was an issue with old version of cmake.
built and installed cmake.

now the problem is with perl.
I have installed perl5.tcz but perl command not found. It is a requirement for qt5

I have no idea about perl so ... reading around...

any help will be appreciated.
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Juanito on November 15, 2021, 07:00:52 AM
qt5 is probably looking for /usr/bin/perl - you can make a symlink to /usr/local/bin/perl
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 15, 2021, 07:19:58 AM
perl is not even available in /usr/local/bin/ also
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Juanito on November 15, 2021, 07:29:33 AM
It is there, maybe perl5 is not actually loaded - check with "tce-status -i | grep perl"
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 15, 2021, 07:50:27 AM
perl5
perl_xml_parser
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 15, 2021, 07:51:36 AM
Code: [Select]
tc@box:~/temp/qt5$ /usr/local/bin/perl
-sh: /usr/local/bin/perl: not found
tc@box:~/temp/qt5$ /usr/local/perl
-sh: /usr/local/perl: not found


Code: [Select]
tc@box:~/temp/qt5$ which perl
tc@box:~/temp/qt5$

    [EDIT]: Added code tags.  Rich
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Juanito on November 15, 2021, 08:00:27 AM
I double checked on an RPi3 and /usr/local/bin/perl is present.

What does "ls /tmp/tcloop/perl5/usr/local/bin" give?
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 15, 2021, 08:06:04 AM
Code: [Select]
tc@box:~$ ls /tmp/tcloop/perl5/usr/local/bin
ls: cannot access '/tmp/tcloop/perl5/usr/local/bin': No such file or directory
tc@box:~$ ls /tmp/tcloop/perl5/
tc@box:~$

There is nothing inside this folder.

I checked for perl_xml_parser .. it has usr folder.

    [EDIT]: Added code tags.  Rich
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Juanito on November 15, 2021, 09:06:43 AM
Maybe your perl5 extension download is corrupted, you could check its size and md5sum against the repo version.
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Rich on November 15, 2021, 09:24:59 AM
Hi ketank
Please use  Code Tags  when posting commands and responses seen in a terminal. To use  Code Tags  click on the  #  icon
above the reply box and paste your text between the  Code Tags  as shown in this example:

Quote
[code][   36.176529] pcm512x 1-004d: Failed to get supply 'AVDD': -517
[   36.176536] pcm512x 1-004d: Failed to get supplies: -517
[   36.191753] pcm512x 1-004d: Failed to get supply 'AVDD': -517[/code]

It will appear like this in your post:
Code: [Select]
[   36.176529] pcm512x 1-004d: Failed to get supply 'AVDD': -517
[   36.176536] pcm512x 1-004d: Failed to get supplies: -517
[   36.191753] pcm512x 1-004d: Failed to get supply 'AVDD': -517

Code Tags  serve as visual markers between what you are trying to say and the information you are posting. They also preserve
spacing so column aligned data displays properly. Code tags also automatically add horizontal and or vertical scrollbars
to accommodate long lines and listings.
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 15, 2021, 09:28:29 AM
Juanito - will try again.

The SD card crashed... need to start again ...

Hi Rich,
I will follow the instructions... Thank you
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 15, 2021, 12:43:32 PM
Maybe your perl5 extension download is corrupted, you could check its size and md5sum against the repo version.

looks like that was the case.
On the fresh install, perl seems to be working ..

now building qt5
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 15, 2021, 05:27:18 PM
Tired....

going off to sleep... hope there is some help on the other side in the morning

Code: [Select]

CMake Error at /usr/local/lib/cmake/clang/ClangConfig.cmake:10 (find_package):
  Could not find a package configuration file provided by "LLVM" with any of
  the following names:

    LLVMConfig.cmake
    llvm-config.cmake

  Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
  "LLVM_DIR" to a directory containing one of the above files.  If "LLVM"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  qttools/cmake/FindWrapLibClang.cmake:14 (find_package)
  qtbase/cmake/QtFindPackageHelpers.cmake:130 (find_package)
  qttools/configure.cmake:19 (qt_find_package)
  qtbase/cmake/QtFeature.cmake:573 (include)
  qttools/src/CMakeLists.txt:21 (qt_feature_evaluate_features)


-- Configuring incomplete, errors occurred!
See also "/tmp/sda/qt5/CMakeFiles/CMakeOutput.log".
See also "/tmp/sda/qt5/CMakeFiles/CMakeError.log".
CMake Error at qtbase/cmake/QtProcessConfigureArgs.cmake:928 (message):
  CMake exited with code 1.
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Juanito on November 15, 2021, 11:25:07 PM
You could try "sudo cp /tmp/tcloop/llvm-dev/usr/local/lib/llvm-config /usr/local/bin"

Alternatively "export LLVM_DIR=/usr/local/lib/cmake/llvm"
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 16, 2021, 12:00:07 AM
You could try "sudo cp /tmp/tcloop/llvm-dev/usr/local/lib/llvm-config /usr/local/bin"

Alternatively "export LLVM_DIR=/usr/local/lib/cmake/llvm"

Thank you.

I will try it and get back to you.

Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Juanito on November 16, 2021, 01:23:02 AM
btw, why are you using cmake/make rather than configure/make?
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Juanito on November 16, 2021, 02:59:31 AM
I made a quick test, albeit with piCore64 - you need:

Code: [Select]
$ sudo rm /usr/local/bin/llvm-config
$ sudo cp /tmp/tcloop/llvm-dev/usr/local/bin/llvm-config /usr/local/bin
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 16, 2021, 08:26:20 AM
You could try "sudo cp /tmp/tcloop/llvm-dev/usr/local/lib/llvm-config /usr/local/bin"

Alternatively "export LLVM_DIR=/usr/local/lib/cmake/llvm"

The above export worked for me.

Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 16, 2021, 08:29:06 AM
btw, why are you using cmake/make rather than configure/make?

just following https://wiki.qt.io/Building_Qt_5_from_Git#Getting_the_source_code

I realized that ninja is the way to go.
make failed for me and then switched to ninja.

was using make -j$(nproc) and it crashed with excessive memory usage!!!

running again  ;) ;) ;)
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 16, 2021, 01:09:42 PM
Thank you for all you support especially Rich and Juanito :) :)

1. I installed qt5 and built it.
2. set the path to qmake
3. installed pyqt5 using pip.

Interesting problem though - the X has stopped working.
I see following error -
Quote
failed in waitforX

NOTE: It was working before the QT5 installation as I know...

Once I have it working, will test if I can really have the qt5 UI working...

any ideas how to fix the above issue will help.

Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 16, 2021, 01:16:13 PM
The additional components I installed were
Quote
Xorg-3d.tcz
Xorg-fonts.tcz

it was part of the required libraries for building qt5 as per http://tinycorelinux.net/11.x/x86_64/tcz/src/qt-5.x/compile_qt-5.x
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: Rich on November 16, 2021, 01:27:42 PM
Hi ketank
My guess is  Xorg-3d.tcz  is causing the error.
Title: Re: pyqt5 picore 13.0.3 rpi 4
Post by: ketank on November 16, 2021, 01:31:01 PM
Hi Rich,

Thank you for the help.
After second reboot, X is working fine.

Tried a basic QT app and I need to have the external drive connected to run the applications. If not, it fails with the libraries not found.
Seems some hard links while installing the PyQt5..