marcelotduarte / cx_Freeze

cx_Freeze creates standalone executables from Python scripts, with the same performance, is cross-platform and should work on any platform that Python itself works on.
https://marcelotduarte.github.io/cx_Freeze/
Other
1.33k stars 217 forks source link

[Help] Unable to deploy python program due to cv2 #1534

Closed TENX-S closed 2 years ago

TENX-S commented 2 years ago

Ubuntu 18.04 aarch64 cx-Freeze 6.11.1 python 3.6.9

my setup.py:

import sys
import os
import cv2

from cx_Freeze import Executable, setup

opencv_lib_src = os.path.join(os.path.dirname(cv2.__file__), '..', 'opencv_python.libs')
opencv_lib_dst = os.path.join('lib', 'opencv_python.libs')
build_exe_options = {"packages": ["os"],
                     "excludes": ["tkinter"],
                     "include_files": [(opencv_lib_src , opencv_lib_dst)]}

base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(
    name="frame",
    version="0.1",
    description="frame1",
    options={"build_exe": build_exe_options},
    executables=[Executable("frame1.py", base=base)],
)

execute:

$ ./build/exe.linux-aarch64-3.6/frame1

output:

QFactoryLoader::QFactoryLoader() checking directory path "/opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins" ...
QFactoryLoader::QFactoryLoader() checking directory path "/opt/flocCheck/build/exe.linux-aarch64-3.6" ...
QFactoryLoader::QFactoryLoader() looking at "/opt/flocCheck/build/exe.linux-aarch64-3.6/frame1"
"Failed to extract plugin meta data from '/opt/flocCheck/build/exe.linux-aarch64-3.6/frame1'"
         not a plugin
QFactoryLoader::QFactoryLoader() checking directory path "/opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so"
Found metadata in lib /opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "xcb"
        ]
    },
    "archreq": 0,
    "className": "QXcbIntegrationPlugin",
    "debug": false,
    "version": 331520
}

Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/opt/flocCheck/build/exe.linux-aarch64-3.6/platforms" ...
Cannot load library /opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so: (libQt5XcbQpa-720a298b.so.5.15.0: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so" : "Cannot load library /opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so: (libQt5XcbQpa-720a298b.so.5.15.0: cannot open shared object file: No such file or directory)"
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted (core dumped)

the libqxcb.so indeed exists, full path is /opt/flocCheck/build/exe.linux-aarch64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so

marcelotduarte commented 2 years ago

This error is related to Qt, indicating that the xcb plugin or even the display is missing. Are you using PyQt5 or PySide2 or something else?

marcelotduarte commented 2 years ago

Oh, opencv has an embebed Qt. I updated the hook in PR #1536 and added a sample in PR #1535 You can test the development release: pip uninstall -y cx_Freeze pip install --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze --pre

TENX-S commented 2 years ago

I have tried the dev release. Seems like still the same reason? Is there something wrong with my setup.py? (Sorry for uploading photos, the test machine cannot take screenshots.)

WeChatafa4798f69a622348c5b377c68818869

WechatIMG12

TENX-S commented 2 years ago

What confused me most is that the error message says "libQt5XcbQpa-720a298b.so.5.15.0: cannot open shared object file: No such file or directory". But this lib indeed exists, which is under build/exe.linux-aarch64-3.6/lib/opencv_contrib_python.libs

marcelotduarte commented 2 years ago

I tested with the sample at PR #1535 and can reproduce the error with 6.11.1 Then I make PR #1536 and it works! Basically the opencv_python.libs has 35 files and only 17 are copied. Now all files are copied. In your setup.py you can remove the include_files option, because cx_Freeze copies it.

marcelotduarte commented 2 years ago

output:

QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6" ...
QFactoryLoader::QFactoryLoader() looking at "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/image.png"
QElfParser: '/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/image.png' is not an ELF object
"'/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/image.png' is not an ELF object" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/opencv-0-test_opencv-linux-x86_64-3.6.log"
QElfParser: '/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/opencv-0-test_opencv-linux-x86_64-3.6.log' is not an ELF object
"'/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/opencv-0-test_opencv-linux-x86_64-3.6.log' is not an ELF object" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/test_opencv"
"Failed to extract plugin meta data from '/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/test_opencv'" 
         not a plugin
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so"
Found metadata in lib /home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "xcb"
        ]
    },
    "archreq": 0,
    "className": "QXcbIntegrationPlugin",
    "debug": false,
    "version": 331520
}

Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/platforms" ...
loaded library "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so"
loaded library "Xcursor"
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6" ...
QFactoryLoader::QFactoryLoader() looking at "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/image.png"
QElfParser: '/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/image.png' is not an ELF object
"'/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/image.png' is not an ELF object" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/opencv-0-test_opencv-linux-x86_64-3.6.log"
QElfParser: '/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/opencv-0-test_opencv-linux-x86_64-3.6.log' is not an ELF object
"'/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/opencv-0-test_opencv-linux-x86_64-3.6.log' is not an ELF object" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/test_opencv"
"Failed to extract plugin meta data from '/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/test_opencv'" 
         not a plugin
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins/platformthemes" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/platformthemes" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins/platforminputcontexts" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/platforminputcontexts" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins/styles" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/styles" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins/imageformats" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/imageformats" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins/iconengines" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/iconengines" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins/xcbglintegrations" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/xcbglintegrations" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins/accessible" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/accessible" ...
OpenCV loader: os.name="posix"  platform.system()="Linux"
OpenCV loader: loading config: /home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/config.py
OpenCV loader: config not found, skip: /home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/config-3.6.py
OpenCV loader: loading config: /home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/config-3.py
OpenCV loader: PYTHON_EXTENSIONS_PATHS=['/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2']
OpenCV loader: BINARIES_PATHS=['/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/../../lib64']
Relink everything from native cv2 module to cv2 package
OpenCV loader: binary extension... OK
Extra Python code for data is loaded
Extra Python code for qt is loaded
    symbol(utils): dumpBool = <built-in function dumpBool>
    symbol(utils): dumpCString = <built-in function dumpCString>
    symbol(utils): dumpDouble = <built-in function dumpDouble>
    symbol(utils): dumpFloat = <built-in function dumpFloat>
    symbol(utils): dumpInputArray = <built-in function dumpInputArray>
    symbol(utils): dumpInputArrayOfArrays = <built-in function dumpInputArrayOfArrays>
    symbol(utils): dumpInputOutputArray = <built-in function dumpInputOutputArray>
    symbol(utils): dumpInputOutputArrayOfArrays = <built-in function dumpInputOutputArrayOfArrays>
    symbol(utils): dumpInt = <built-in function dumpInt>
    symbol(utils): dumpRange = <built-in function dumpRange>
    symbol(utils): dumpRect = <built-in function dumpRect>
    symbol(utils): dumpRotatedRect = <built-in function dumpRotatedRect>
    symbol(utils): dumpSizeT = <built-in function dumpSizeT>
    symbol(utils): dumpString = <built-in function dumpString>
    symbol(utils): dumpTermCriteria = <built-in function dumpTermCriteria>
    symbol(utils): dumpVectorOfDouble = <built-in function dumpVectorOfDouble>
    symbol(utils): dumpVectorOfInt = <built-in function dumpVectorOfInt>
    symbol(utils): dumpVectorOfRect = <built-in function dumpVectorOfRect>
    symbol(utils): generateVectorOfInt = <built-in function generateVectorOfInt>
    symbol(utils): generateVectorOfMat = <built-in function generateVectorOfMat>
    symbol(utils): generateVectorOfRect = <built-in function generateVectorOfRect>
    symbol(utils): testAsyncArray = <built-in function testAsyncArray>
    symbol(utils): testAsyncException = <built-in function testAsyncException>
    symbol(utils): testOverloadResolution = <built-in function testOverloadResolution>
    symbol(utils): testRaiseGeneralException = <built-in function testRaiseGeneralException>
    symbol(utils): testReservedKeywordConversion = <built-in function testReservedKeywordConversion>
    symbol(utils): testRotatedRect = <built-in function testRotatedRect>
    symbol(utils): testRotatedRectVector = <built-in function testRotatedRectVector>
    symbol(utils): fs = <module 'cv2.utils.fs'>
    symbol(utils): nested = <module 'cv2.utils.nested'>
Extra Python code for utils is loaded
Extra Python code for mat_wrapper is loaded
Extra Python code for misc is loaded
    symbol(gapi): BGR2RGB = <built-in function BGR2RGB>
    symbol(gapi): RGB2Gray = <built-in function RGB2Gray>
    symbol(gapi): add = <built-in function add>
    symbol(gapi): addC = <built-in function addC>
    symbol(gapi): boundingRect = <built-in function boundingRect>
    symbol(gapi): copy = <built-in function copy>
    symbol(gapi): goodFeaturesToTrack = <built-in function goodFeaturesToTrack>
    symbol(gapi): infer = <built-in function infer>
    symbol(gapi): infer2 = <built-in function infer2>
    symbol(gapi): kmeans = <built-in function kmeans>
    symbol(gapi): mean = <built-in function mean>
    symbol(gapi): medianBlur = <built-in function medianBlur>
    symbol(gapi): parseSSD = <built-in function parseSSD>
    symbol(gapi): parseYolo = <built-in function parseYolo>
    symbol(gapi): resize = <built-in function resize>
    symbol(gapi): split3 = <built-in function split3>
    symbol(gapi): threshold = <built-in function threshold>
    symbol(gapi): kernels = <built-in function kernels>
    symbol(gapi): __op = <built-in function __op>
    symbol(gapi): CV_ANY = 14
    symbol(gapi): CV_BOOL = 0
    symbol(gapi): CV_DOUBLE = 3
    symbol(gapi): CV_DRAW_PRIM = 13
    symbol(gapi): CV_FLOAT = 4
    symbol(gapi): CV_GMAT = 12
    symbol(gapi): CV_INT = 1
    symbol(gapi): CV_INT64 = 2
    symbol(gapi): CV_MAT = 11
    symbol(gapi): CV_POINT = 6
    symbol(gapi): CV_POINT2F = 7
    symbol(gapi): CV_RECT = 9
    symbol(gapi): CV_SCALAR = 10
    symbol(gapi): CV_SIZE = 8
    symbol(gapi): CV_STRING = 5
    symbol(gapi): StereoOutputFormat_DEPTH_16F = 0
    symbol(gapi): STEREO_OUTPUT_FORMAT_DEPTH_16F = 0
    symbol(gapi): StereoOutputFormat_DEPTH_32F = 1
    symbol(gapi): STEREO_OUTPUT_FORMAT_DEPTH_32F = 1
    symbol(gapi): StereoOutputFormat_DEPTH_FLOAT16 = 0
    symbol(gapi): STEREO_OUTPUT_FORMAT_DEPTH_FLOAT16 = 0
    symbol(gapi): StereoOutputFormat_DEPTH_FLOAT32 = 1
    symbol(gapi): STEREO_OUTPUT_FORMAT_DEPTH_FLOAT32 = 1
    symbol(gapi): StereoOutputFormat_DISPARITY_16Q_10_5 = 2
    symbol(gapi): STEREO_OUTPUT_FORMAT_DISPARITY_16Q_10_5 = 2
    symbol(gapi): StereoOutputFormat_DISPARITY_16Q_11_4 = 3
    symbol(gapi): STEREO_OUTPUT_FORMAT_DISPARITY_16Q_11_4 = 3
    symbol(gapi): StereoOutputFormat_DISPARITY_FIXED16_11_5 = 2
    symbol(gapi): STEREO_OUTPUT_FORMAT_DISPARITY_FIXED16_11_5 = 2
    symbol(gapi): StereoOutputFormat_DISPARITY_FIXED16_12_4 = 3
    symbol(gapi): STEREO_OUTPUT_FORMAT_DISPARITY_FIXED16_12_4 = 3
    symbol(gapi): core = <module 'cv2.gapi.core'>
    symbol(gapi): ie = <module 'cv2.gapi.ie'>
    symbol(gapi): oak = <module 'cv2.gapi.oak'>
    symbol(gapi): onnx = <module 'cv2.gapi.onnx'>
    symbol(gapi): own = <module 'cv2.gapi.own'>
    symbol(gapi): render = <module 'cv2.gapi.render'>
    symbol(gapi): streaming = <module 'cv2.gapi.streaming'>
    symbol(gapi): video = <module 'cv2.gapi.video'>
    symbol(gapi): wip = <module 'cv2.gapi.wip'>
    symbol(gapi): GNetParam = <class 'cv2.gapi.GNetParam'>
    symbol(gapi): GNetPackage = <class 'cv2.gapi.GNetPackage'>
Extra Python code for gapi is loaded
OpenCV loader: DONE
QLibraryPrivate::unload succeeded on "/home/runner/work/freeze-test/freeze-test/cx_Freeze/samples/opencv/build/exe.linux-x86_64-3.6/lib/cv2/qt/plugins/platforms/libqxcb.so" 
QLibraryPrivate::unload succeeded on "Xcursor" (faked)
TENX-S commented 2 years ago

Reinstalled "opencv-python" works. Thanks for your help!

TENX-S commented 2 years ago

Hi, @marcelotduarte. I moved the build/ directory to another machine with the same environment. But it complains:

Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x0000007f9d9c9010 (most recent call first):
Aborted (core dumped)
marcelotduarte commented 2 years ago

In Linux moving to a new machine can fail if some systems libraries are not installed. The problem in cx_Freeze is similar to distribute wheels, so manylinux as created, and the problems is described here

Recently manylinux had some changes and I get cx_Freeze to distribute binaries for amd/intel, but for arm it is compiled from the sources when you install it, so this issue arises.

You can try to detect the libraries that are needed, using a trick, trying to make a rpm: python setup.py bdist_rpm

I'll try to make cx_Freeze with binary for arm in the next release. Are you using raspberry pi or a similar machine?

TENX-S commented 2 years ago

Yes. It's running on a raspberry pi.

python setup.py bdish_rpm:

running bdist_rpm
creating build
creating build/bdist.linux-aarch64
creating build/bdist.linux-aarch64/rpm
creating build/bdist.linux-aarch64/rpm/SOURCES
creating build/bdist.linux-aarch64/rpm/SPECS
creating build/bdist.linux-aarch64/rpm/BUILD
creating build/bdist.linux-aarch64/rpm/RPMS
creating build/bdist.linux-aarch64/rpm/SRPMS
writing 'build/bdist.linux-aarch64/rpm/SPECS/flowCheck.spec'
running sdist
running egg_info
creating flowCheck.egg-info
writing flowCheck.egg-info/PKG-INFO
writing dependency_links to flowCheck.egg-info/dependency_links.txt
writing top-level names to flowCheck.egg-info/top_level.txt
writing manifest file 'flowCheck.egg-info/SOURCES.txt'
reading manifest file 'flowCheck.egg-info/SOURCES.txt'
writing manifest file 'flowCheck.egg-info/SOURCES.txt'
warning: sdist: standard file not found: should have one of README, README.rst, README.txt, README.md

running check
warning: check: missing required meta-data: url

warning: check: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied

creating flowCheck-0.1
creating flowCheck-0.1/flowCheck.egg-info
copying files to flowCheck-0.1...
copying setup.py -> flowCheck-0.1
copying flowCheck.egg-info/PKG-INFO -> flowCheck-0.1/flowCheck.egg-info
copying flowCheck.egg-info/SOURCES.txt -> flowCheck-0.1/flowCheck.egg-info
copying flowCheck.egg-info/dependency_links.txt -> flowCheck-0.1/flowCheck.egg-info
copying flowCheck.egg-info/top_level.txt -> flowCheck-0.1/flowCheck.egg-info
Writing flowCheck-0.1/setup.cfg
creating dist
Creating tar archive
removing 'flowCheck-0.1' (and everything under it)
copying dist/flowCheck-0.1.tar.gz -> build/bdist.linux-aarch64/rpm/SOURCES
/bin/sh: 1: rpm: not found
error: Failed to execute: "rpm -q --qf '%{name}-%{version}-%{release}.src.rpm %{arch}/%{name}-%{version}-%{release}.%{arch}.rpm\\n' --specfile 'build/bdist.linux-aarch64/rpm/SPECS/flowCheck.spec'"
marcelotduarte commented 2 years ago

sudo apt install rpm

TENX-S commented 2 years ago
running bdist_rpm
creating build
creating build/bdist.linux-aarch64
creating build/bdist.linux-aarch64/rpm
creating build/bdist.linux-aarch64/rpm/SOURCES
creating build/bdist.linux-aarch64/rpm/SPECS
creating build/bdist.linux-aarch64/rpm/BUILD
creating build/bdist.linux-aarch64/rpm/RPMS
creating build/bdist.linux-aarch64/rpm/SRPMS
writing 'build/bdist.linux-aarch64/rpm/SPECS/flowCheck.spec'
running sdist
running egg_info
writing flowCheck.egg-info/PKG-INFO
writing dependency_links to flowCheck.egg-info/dependency_links.txt
writing top-level names to flowCheck.egg-info/top_level.txt
reading manifest file 'flowCheck.egg-info/SOURCES.txt'
writing manifest file 'flowCheck.egg-info/SOURCES.txt'
warning: sdist: standard file not found: should have one of README, README.rst, README.txt, README.md

running check
warning: check: missing required meta-data: url

warning: check: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied

creating flowCheck-0.1
creating flowCheck-0.1/flowCheck.egg-info
copying files to flowCheck-0.1...
copying setup.py -> flowCheck-0.1
copying flowCheck.egg-info/PKG-INFO -> flowCheck-0.1/flowCheck.egg-info
copying flowCheck.egg-info/SOURCES.txt -> flowCheck-0.1/flowCheck.egg-info
copying flowCheck.egg-info/dependency_links.txt -> flowCheck-0.1/flowCheck.egg-info
copying flowCheck.egg-info/top_level.txt -> flowCheck-0.1/flowCheck.egg-info
Writing flowCheck-0.1/setup.cfg
creating dist
Creating tar archive
removing 'flowCheck-0.1' (and everything under it)
copying dist/flowCheck-0.1.tar.gz -> build/bdist.linux-aarch64/rpm/SOURCES
rpmbuild -ba --define __python python3 --define _topdir /opt/dasserver/server/demo/flocCheck2/build/bdist.linux-aarch64/rpm --clean build/bdist.linux-a
arch64/rpm/SPECS/flowCheck.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.JQFjSZ
+ umask 022
+ cd /opt/dasserver/server/demo/flocCheck2/build/bdist.linux-aarch64/rpm/BUILD
+ cd /opt/dasserver/server/demo/flocCheck2/build/bdist.linux-aarch64/rpm/BUILD
+ rm -rf flowCheck-0.1
+ /bin/gzip -dc /opt/dasserver/server/demo/flocCheck2/build/bdist.linux-aarch64/rpm/SOURCES/flowCheck-0.1.tar.gz
+ /bin/tar -xvvof -
drwxrwxr-x nvidia/nvidia     0 2022-06-30 09:59 flowCheck-0.1/
-rw-rw-r-- nvidia/nvidia   131 2022-06-30 09:59 flowCheck-0.1/PKG-INFO
-rw-rw-r-- nvidia/nvidia    38 2022-06-30 09:59 flowCheck-0.1/setup.cfg
drwxrwxr-x nvidia/nvidia     0 2022-06-30 09:59 flowCheck-0.1/flowCheck.egg-info/
-rw-rw-r-- nvidia/nvidia   131 2022-06-30 09:59 flowCheck-0.1/flowCheck.egg-info/PKG-INFO
-rw-rw-r-- nvidia/nvidia     1 2022-06-30 09:59 flowCheck-0.1/flowCheck.egg-info/top_level.txt
-rw-rw-r-- nvidia/nvidia   140 2022-06-30 09:59 flowCheck-0.1/flowCheck.egg-info/SOURCES.txt
-rw-rw-r-- nvidia/nvidia     1 2022-06-30 09:59 flowCheck-0.1/flowCheck.egg-info/dependency_links.txt
-rw-r--r-- nvidia/nvidia   394 2022-06-29 09:30 flowCheck-0.1/setup.py
+ STATUS=0
+ [ 0 -ne 0 ]
+ cd flowCheck-0.1
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.mPdyoT
+ umask 022
+ cd /opt/dasserver/server/demo/flocCheck2/build/bdist.linux-aarch64/rpm/BUILD
+ cd flowCheck-0.1
+ env CFLAGS=-O2 -g python3 setup.py build
running build
running build_exe
error: [Errno 2] No such file or directory: 'frame1.py'
error: Bad exit status from /var/tmp/rpm-tmp.mPdyoT (%build)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.mPdyoT (%build)
error: command 'rpmbuild' failed with exit status 1
nvidia@tx2-nx:/opt/dasserver/server/demo/flocCheck2$ ls
OPAPI_36.py  build       dist                frame1.py   opiotest_36.py  setup.py        矾花检测使用说明书.docx
__pycache__  connect.py  flowCheck.egg-info  opapi4.dll  point.xml       使用说明2.docx

It complains about :error: [Errno 2] No such file or directory: 'frame1.py' But I do have frame1.py

my setup.py:

import sys
import os

from cx_Freeze import Executable, setup

build_exe_options = {"packages": ["os"], "excludes": ["tkinter"],}

base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(
    name="flowCheck",
    version="0.1",
    description="frame1",
    options={"build_exe": build_exe_options},
    executables=[Executable("frame1.py", base=base,target_name="flowCheck")],
)
TENX-S commented 2 years ago

I'm confused. python3 setup.py build is ok to run. So I guess the path of frame1.py is right?

marcelotduarte commented 2 years ago

bdist_rpm does not work with modules. If you convert this frame1.py to frame1/__init__.py it works.

TENX-S commented 2 years ago

I changed. Still the same error.

marcelotduarte commented 2 years ago

See #1488 how I made to use bcrypt as test.

TENX-S commented 2 years ago

Yes. I do exactly the same thing. First rename frame1.py to frame1/__init__.py in setup.py, then do it in bash. Still the same error.

marcelotduarte commented 2 years ago

Change executables and add packages in setup...

marcelotduarte commented 2 years ago
setup(
    name="flowCheck",
    version="0.1",
    description="frame1",
    options={"build_exe": build_exe_options},
    executables=[Executable("frame1/__init__.py", base=base,target_name="flowCheck")],
    packages=["frame1"],
)
TENX-S commented 2 years ago

My bad 😅

TENX-S commented 2 years ago

Waiting at running build_exe. Edit: The machine is down 😅

TENX-S commented 2 years ago

And... we got a new error:

Processing files: flowCheck-0.1-1.aarch64
error: File must begin with "/": (dev).tmpl
error: File must begin with "/": manifest.xml

RPM build errors:
    File must begin with "/": (dev).tmpl
    File must begin with "/": manifest.xml
error: command 'rpmbuild' failed with exit status 1
marcelotduarte commented 2 years ago

I compiled cx_Freeze for arm64. You can go back to your original example (without using rpm) and then it should detect the libraries you will need. You can test the development release: pip uninstall -y cx_Freeze pip install --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze --pre

TENX-S commented 2 years ago

Thanks for your pantient help!❤️

marcelotduarte commented 1 year ago

cx_Freeze 6.12.0 has just been released.

TENX-S commented 1 year ago

@marcelotduarte Sorry to bother you again. I run the executable file, and the error is come back, is there something wrong? cx_Freeze: 6.12.0 image

marcelotduarte commented 1 year ago

This error is related to Qt. Are you running remotely? Try to run: QT_QPA_PLATFORM=xcb ./flowCheck

TENX-S commented 1 year ago

This error is related to Qt. Are you running remotely?

Yes. I'm running the program remotely, and I find it will be killed at cv2.imshow()

Try to run: QT_QPA_PLATFORM=xcb ./flowCheck

Still the same error image