Error python is required to build qtqml

Type: Bug

  • Type:


    Bug

  • Status:

    Closed


  • Priority:


    P3: Somewhat important

  • Resolution:

    Done


  • Affects Version/s:



    5.15.0 RC


  • Platform/s:


    All


  • Commits:

    2b41025fc967b37c8bff77c4b75bab333ae13f46 (qt/qtdeclarative/dev) 1c6a70e1880a8fe0f3d8da4932c4f3533693219c (qt/qtdeclarative/5.15)

We use Ubuntu 20.04 as our build system for Android. As python2 is deprecated we install python3 packages.

But Ubuntu won’t provide a «python» binary for that. A «python3» binary is the only one. So we get this error if we try to build Qt 5.15.0-rc.

It would be helpful if Qt could check for python3 binary, too.

Error

sh: 1: python: not found
Project ERROR: Building QtQml requires Python.

Sources
https://code.qt.io/cgit/qt/qtdeclarative.git/tree/qtdeclarative.pro?h=5.15.0

CONFIG += tests_need_tools examples_need_tools
load(qt_parts)

!python_available {
    py_out = $$system('python -c "print(1)"')
    !equals(py_out, 1): error("Building QtQml requires Python.")
    tmp = python_available
    CONFIG += $$tmp
    cache(CONFIG, add, tmp)
}

Directory listing

$ ll /usr/bin/python*
lrwxrwxrwx 1 root root       9 Mar 13 12:20 /usr/bin/python3 -> python3.8*
lrwxrwxrwx 1 root root      16 Mar 13 12:20 /usr/bin/python3-config -> python3.8-config*
-rwxr-xr-x 1 root root 5457568 Mar 13 10:14 /usr/bin/python3.8*
lrwxrwxrwx 1 root root      33 Mar 13 10:14 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config*
relates to

Bug - A problem which impairs or prevents the functions of the product.

QTBUG-51753
Building QtQml requires Python version 2

  • P2: Important - Urgent, should be fixed, but will not stop the release.
  • Closed


No reviews matched the request. Check your Options in the drop-down menu of this sections header.

I get the following error when building qt5, specifically the qtdeclarative module. From what I can tell it is having problems using python to generate the source files. I have python27 installed and it is functional for everything else on the system.

Console Output:

Building package qt5:x64-windows...
-- CURRENT_INSTALLED_DIR=C:/src/vcpkg/installed/x64-windows
-- DOWNLOADS=C:/src/vcpkg/downloads
-- CURRENT_PACKAGES_DIR=C:/src/vcpkg/packages/qt5_x64-windows
-- CURRENT_BUILDTREES_DIR=C:/src/vcpkg/buildtrees/qt5
-- CURRENT_PORT_DIR=C:/src/vcpkg/ports/qt5/.
-- Using cached C:/src/vcpkg/downloads/qt-5.8.0.7z
-- Testing integrity of cached file...
-- Testing integrity of cached file... OK
-- Extracting done
-- Applying patch C:/src/vcpkg/ports/qt5/fix-qalgorithms-vs2017.patch
-- Applying patch failed. This is expected if this patch was previously applied.

-- Applying patch C:/src/vcpkg/ports/qt5/fix-qalgorithms-vs2017.patch done
-- Applying patch C:/src/vcpkg/ports/qt5/fix-commandline-overrides.patch
-- Applying patch failed. This is expected if this patch was previously applied.

-- Applying patch C:/src/vcpkg/ports/qt5/fix-commandline-overrides.patch done
-- Configuring x64-windows-rel
-- Configuring x64-windows-rel done
-- Configuring x64-windows-dbg
-- Configuring x64-windows-dbg done
-- Package x64-windows-rel
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:43 (message):
    Command failed: C:/src/vcpkg/downloads/tools/jom/jom-1.1.2/jom.exe;/J;8
    Working Directory: C:/src/vcpkg/buildtrees/qt5/x64-windows-rel
    See logs for more information:
      C:srcvcpkgbuildtreesqt5build-x64-windows-rel-out.log
      C:srcvcpkgbuildtreesqt5build-x64-windows-rel-err.log

Call Stack (most recent call first):
  ports/qt5/install_qt.cmake:19 (vcpkg_execute_required_process)
  ports/qt5/portfile.cmake:67 (install_qt)
  scripts/ports.cmake:72 (include)


Error: Building package qt5:x64-windows failed with: BUILD_FAILED

Error Log:

Fatal Python error: Py_Initialize: unable to load the file system codec
ImportError: No module named 'encodings'

Current thread 0x00000428 (most recent call first):
Project ERROR: Building QtQml requires Python.
jom: C:srcvcpkgbuildtreesqt5x64-windows-relMakefile [module-qtdeclarative-make_first] Error 3

The encodings module imports fine on the CLI, I’m not sure why it doesn’t work when vcpkg tries to build.

python
>>> import encodings
>>> encodings.codecs
  • Windows Version: 7
  • Visual Studio: 2015
  • Python Version: 2.7.13

Недавно мне удалось собрать статический Qt 5.7.0 с использованием MinGW 5.3.0, который поставляется с динамической версией. Для того, как я это сделал, я следовал инструкциям по ссылке:

https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW

Никаких ошибок не возникало при создании статических предупреждений Qt (ожидаем (MANY) об устаревших std::auto_ptr). После установки Qt Version и Kit в Qt Creator, он успешно создал статически связанный исполняемый файл (нет даже CONFIG += static был необходим).

Но, кажется, что код может быть скомпилирован только с версией MinGW, с которой был собран статический Qt, где это условие не присутствовало в динамической версии, так как я мог компилировать и связывать код Qt как с MinGW 5.3.0, так и с MinGW 6.3. 0. Попытка использовать MinGW 6.3.0 со статическим Qt (построенным с MinGW 5.3.0) приводит к множеству неопределенных ошибок ссылок, таких как:

error: undefined reference to `QApplication::QApplication(int&, char**, int)'

Так что, похоже, ни одна библиотека Qt не связана здесь (qmake не совместимо или что-то).

Но это не обескуражило меня. Я просто повторил шаги из ссылки снова, но теперь собираю статический Qt с MinGW 6.3.0 (можно установить флаги, чтобы скрипт мог знать, какую версию MinGW использовать).

Это было многообещающе, скрипт собирал Qt около 50 минут, а затем ошибка остановила весь процесс:

// [...millions of console lines...]
cd qtdeclarative && ( if not exist Makefile C:QtStaticsrcqt-everywhere-opensource-src-5.7.0qtbasebinqmake C:Qt
Staticsrcqt-everywhere-opensource-src-5.7.0qtdeclarativeqtdeclarative.pro -o Makefile ) && D:/Programming_Tools/Nuwe
n/MinGW/bin/mingw32-make.exe -f Makefile install
'python' is not recognized as an internal or external command,
operable program or batch file.
Project ERROR: Building QtQml requires Python.
MinGWbinmingw32-make.exe: *** [Makefile:338: module-qtdeclarative-install_subtargets] Error 3
MinGWbinmingw32-make.exe: Target 'install' not remade because of errors.
Press Enter to continue...:

Самая важная часть здесь, конечно, 'python' is not recognized as an internal or external command, Теперь это СТРАННЫЙ, потому что у меня установлен python 3.5.2 в переменные среды PATH.

После этого я попытался вызвать python в PowerShell, и вот результат:

PS C:UsersEbisuDownloads> python
python : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ python
+ ~~~~~~
+ CategoryInfo          : ObjectNotFound: (python:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Теперь я открыл новый сеанс PowerShell и снова вызвал python. Вот результат:

PS C:UsersEbisuDownloads> python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
PS C:UsersEbisuDownloads>

Теперь мой разум был взорван. Какие? Я попытался запустить скрипт в этой новой сессии снова, но он остановился в том же месте, и СНОВА, питон не распознается после него. Как это возможно? Как Python может стать невидимым во время выполнения скрипта?

Также обратите внимание, мне удалось использовать qmake.exe которая вышла из этой приостановленной сборки, и она компилирует и связывает код Qt с MinGW 6.3.0, ожидая, что он не может использовать какие-либо модули, такие как QT += multimedia (не так плохо, как я ожидал, но все же я хотел бы использовать модули).

0

Решение

Просто сталкиваюсь с той же проблемой. Я просто хотел добавить, что в моем случае исправление пути для включения python не помогло, так как $ env: PYTHONPATH все еще указывал на мою установку на python3, а затем скрипт выдавал другую ошибку

((File "Lib/site.py", line 176
file=sys.stderr)
^
SyntaxError: invalid syntax).

Добавление одной из этих строк в сценарий powershell исправляет ошибку:

$env:PYTHONPATH = "$MingwDiroptbin"

или же

$env:PYTHONPATH = ""

0

Другие решения

Других решений пока нет …

izahn

Windows package needs to be rebuilt

There was a problem with the most recent win_64 build as discussed in conda/infrastructure#514 and #214 (comment). I tried rebuilding it, but I only have a Windows VM on a laptop and I’m not that familiar with Windows to begin with. Is someone is willing and able to rebuild it?

gillins

I get the following error when running locally. Does anyone know anything about this? Seems the recipe doesn’t require Python but maybe it should.

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
Project ERROR: Building QtQml requires Python.

izahn

Hmm, I didn’t have that problem when I tried. I installed boa into the base environment and ran with something like

mamba build -m .ci_support/win_64_.yaml recipe > qt_buildlog.txt

How did you run it?

gillins

Using conda-build, but I forgot the -m (D’oh)… Now running:

conda build --croot=c:qt -m .ci_supportwin_64_.yaml recipe > out.log 2>&1

(assume it doesn’t matter I’m using conda-build matter?). Now getting the following message — might try boa next and see if that does anything different.

image

gillins

OK I reinstalled miniforge and now getting the following error. Any ideas about this one? I’ll keep trying…

conda.CondaMultiError: Error with archive C:Usersgilliminiforge3pkgsllvm-tools-13.0.1-ha327e53_0.tar.bz2.  You probably need to delete and re-download or re-create this file.  Message from libarchive was:

contains unsafe path: info/hash_input.json

izahn

Sorry this has been such a pain, thanks for persisting. I’ve also been trying but am stuck on the dynamic link library error.

ryanvolz

I’ve been giving this a try also. My issue is that I keep running out of disk space in my VM during the build. Hopefully I’ve cleared enough this time to see it finish.

OK I reinstalled miniforge and now getting the following error. Any ideas about this one? I’ll keep trying…

conda.CondaMultiError: Error with archive C:Usersgilliminiforge3pkgsllvm-tools-13.0.1-ha327e53_0.tar.bz2.  You probably need to delete and re-download or re-create this file.  Message from libarchive was:

contains unsafe path: info/hash_input.json

I also encountered this. I worked around it by extracting that archive manually in the pkgs directory. Then conda is able to proceed past it because it sees that the package is already extracted.

izahn

@Tobias-Fischer we are really struggling with this rebuild, any chance you can give it another try?

Tobias-Fischer

I triggered another build on the Windows conda-forge server, I’ll let you know how it goes.

Tobias-Fischer

Unfortunately we’re running out of space on the Windows machine (the build takes more than 80gb of space). I’m in touch with @isuruf and @wolfv to see whether we can clean it up more (it only has a 120gb hard drive, so it’s a bit tricky ..). However he build itself (up until the point where it runs out of space) runs without any problems.

gillins

@Tobias-Fischer did you manage to get any further with this? Do you also see the Perl error?

Tobias-Fischer

gillins

That’s great! Thanks everyone 😄

isuruf

Скомпилировать встроенный Qt5.6

Используемая платформа — ubuntu18.04, а среда кросс-компиляции — 4.4.3.
Установка зависимой библиотеки:
sudo apt-get install qt5*-dev
sudo apt-get install qtbase5-dev
sudo apt-get install qtdeclarative5-dev qml-module-qtquick-controls
Заранее установите библиотеку tslib
Примечание об изменении /opt/FriendlyARM/toolschain/4.4.3arm-none-linux-gnueabi/sys-root/usr/include/linux/input.h и изменении EV_VERSION на 0x010001
1. Подготовьте пакет с исходным кодом.
qt-everywhere-opensource-src-5.6.0.tar.gz

2. Разархивируйте исходный код qt5.6 и измените информацию о платформе конфигурации.

tar -zxf qt-everywhere-opensource-src-5.6.0.tar.gz
cd qt-everywhere-opensource-src-5.6.0/
gedit qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf

Скопируйте следующий код в файл qmake.conf

#
# qmake configuration for building with arm-linux-gnueabi-g++
#

MAKEFILE_GENERATOR      = UNIX
CONFIG                 += incremental
QMAKE_INCREMENTAL_STYLE = sublib

QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS 	+= -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t 
QMAKE_CXXFLAGS 	+= -msoft-float -D__GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
include(../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = arm-none-linux-gnueabi-gcc -lts
QMAKE_CXX               = arm-none-linux-gnueabi-g++ -lts
QMAKE_LINK              = arm-none-linux-gnueabi-g++ -lts
QMAKE_LINK_SHLIB        = arm-none-linux-gnueabi-g++ -lts

# modifications to linux.conf
QMAKE_AR                = arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY           = arm-none-linux-gnueabi-objcopy
QMAKE_NM                = arm-none-linux-gnueabi-nm -P
QMAKE_STRIP             = arm-none-linux-gnueabi-strip

3. Настройте информацию о компиляции.

Вставьте их в
-prefix следует за скомпилированным путем установки Qt, который задается заранее
-I следует путь включения в скомпилированном и установленном tslib
-L следует путь к библиотеке в скомпилированном и установленном tslib

./configure  -prefix /home/yy/jz2440/qt/Qt5.6 -v -opensource -release -confirm-license -xplatform linux-arm-gnueabi-g++ -shared -qt-zlib -no-gif -qt-libjpeg -no-nis -no-opengl -no-iconv -no-cups   -no-glib   -no-dbus   -no-rpath   -no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2   -no-avx    -no-openssl   -nomake tools  -qt-libpng   -tslib   -nomake examples -skip qtdeclarative  -I  /home/yy/jz2440/wenjian/tslib/tmp/include -L /home/yy/jz2440/wenjian/tslib/tmp/lib

Обратите внимание, что в скрипте есть очень важная конфигурация: -skip qtdeclarative , если это предложение не добавлено, во время make возникает ошибка:

sh:1:python:not found
Project ERROR:Building QtQml requires Python.
Makefile:44: recipe for target 'module-qtdeclarative-install_subtargets' failed
make: *** [module-qtdeclarative-install_subtargets] Error 3

В фактическом процессе компиляции использование информации о конфигурации из других блогов приведет к ошибкам, и приведенная выше информация о конфигурации не вызывает проблем в фактических измерениях.

4. Перед компиляцией необходимо изменить два файла, иначе компиляция не удастся.
Измените файл qtimageformats / src / 3rdparty / libwebp / src / dsp / dsp.h:
// # define WEBP_USE_NEON // После комментирования 68-й строки ее можно скомпилировать и передать

Измените /home/msi/qt-everywhere-opensource-src-5.6.0/qttools/src/src.pro
удалите qdoc в строке под SUBDIRS + = linguist

В противном случае он появится в следующем процессе установки make && make (причина в том, что qml используется в пакете qdoc, и мы установили параметр -skip qtdeclarative, чтобы не компилировать qml, поэтому, если вы не удалите этот qdoc, будет сообщено об ошибке Project ERROR: Unknown module ( s) в QT: qmldevtools-private:

cd qdoc/ && ( test -e Makefile || /home/msi/qt-everywhere-opensource-src-5.6.0/qtbase/bin/qmake /home/msi/qt-everywhere-opensource-src-5.6.0/qttools/src/qdoc/qdoc.pro -o Makefile ) && make -f Makefile install
Project ERROR: Unknown module(s) in QT: qmldevtools-private
Makefile:188: recipe for target 'sub-qdoc-install_subtargets' failed
make[2]: *** [sub-qdoc-install_subtargets] Error 3
make[2]: Leaving directory '/home/msi/qt-everywhere-opensource-src-5.6.0/qttools/src'
Makefile:56: recipe for target 'sub-src-install_subtargets' failed
make[1]: *** [sub-src-install_subtargets] Error 2
make[1]: Leaving directory '/home/msi/qt-everywhere-opensource-src-5.6.0/qttools'
Makefile:529: recipe for target 'module-qttools-install_subtargets' failed
make: *** [module-qttools-install_subtargets] Error 2

5、make -j4
6、make install

Установить настольную версию Qt

Загрузите qt-opensource-linux-x64-android-5.7.0.run

sudo ./qt-opensource-linux-x64-android-5.7.0.run
Метод установки очень прост. Не забудьте затем выбрать вариант по умолчанию, не забудьте отметить оба флажка при выборе компонентов и установить все инструменты.

Настроить после установки
Откройте параметры программного обеспечения — «Инструменты-«




Запустите qmake перед компиляцией

Затем нажмите маленький молоток, чтобы скомпилировать

Установите libiconv-1.14

После загрузки и распаковки:
— хост компилируется в файл целевого формата
—prefix компилировать и устанавливать целевой каталог
путь arm-none-linux-gnueabi-gcc в компиляторе CC
/ sys-root / lib путь в компиляторе LDFLAGS

cd libiconv-1.14/
./configure —host=arm-none-linux-gnueabi —prefix=/home/china/work/jz2440/qt/libiconv CC=/usr/local/arm/gcc-4.4.3/bin/arm-none-linux-gnueabi-gcc LDFLAGS=»-L/usr/local/arm/gcc-4.4.3/bin/arm-none-linux-gnueabi/sys-root/lib» —enable-static
make
make install

Затем скопируйте файл preloadable_libiconv.so из установочного каталога в / usr / lib / файл файловой системы и добавьте его в / etc / profile.

export LD_PRELOAD=/usr/lib/preloadable_libiconv.so:$TSLIB_ROOT/lib/libts.so

Установить для отображения китайского шрифта

Если вы не можете отображать китайский язык по умолчанию, вам необходимо добавить библиотеку китайских шрифтов DroidSansFallback.ttf
Сначала загрузите файл шрифта DroidSansFallback.ttf.
Поместите файл шрифта в файловую систему / usr / lib / fonts /, если каталога шрифтов нет, вы можете создать его самостоятельно
Затем добавьте следующий код в код Qt, чтобы установить шрифт


Щелкните маленьким молотком, чтобы скомпилировать
Созданный исполняемый файл находится в build-app2-JZ2440-Debug в каталоге проекта.

Скопируйте кросс-скомпилированный исполняемый файл app2 в файловую систему через nfs

cp app2 /home/yy/nfsroot

Запустите ./app2 на плате разработки

Понравилась статья? Поделить с друзьями:
  • Error python is missing or unusable
  • Error python interpreter is not selected please setup python interpreter first что делать
  • Error python interpreter is not selected please setup python interpreter first перевод
  • Error python interpreter is not selected please setup python interpreter first pycharm
  • Error pyspark does not support any application options