How to use pyinstaller generate a pyqt5 sotfware? - pyqt5

I'm using pyinstaller to generate a executable pyqt5 software in ubuntu 16.04,but i got some trouble,how do i fix it?
My os is Ubuntu16.04LTS,and python version is anconda3 python3.6.5,
my pyqt5 is using pip to install,which show in pip list is 5.11.3,and qmake version is 3.1.
I add the anconda's lib dir into my LD_LIBRARY_PATH(if not,when i run pyinstaller myfile.py it shows "TypeError: expected str, bytes or os.PathLike object, not NoneType"),and i can successfully get my executable pyqt5 software.
BUT,when i run my executable app,something goes wrong,which is
what should i do?Thanks a lot for your help!
ImportError: /home/kanghao/dabao/dist/train_tool/libQt5Core.so.5:
version `Qt_5.11' not found (required by
/home/kanghao/dabao/dist/train_tool/PyQt5/QtCore.so) [11591] Failed to
execute script train_tool
my code is in webpage:https://blog.csdn.net/yourgreatfather/article/details/85063787
I expect my code can become a executable sotfware.

Related

Error in Power BI while importing pandas library in python scrip

Below are the mentioned error while importing pandas library in Power BI in python script.
Details: "ADO.NET: Python script error.
C:\USERS\YADAVP\ANACONDA3\lib\site-packages\numpy\__init__.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib
File "C:\USERS\YADAVP\ANACONDA3\lib\site-packages\pandas\__init__.py", line 17, in <module>
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "C:\USERS\YADAVP\ANACONDA3\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.
What is the resolution to sort this kind of error in Power BI?
Forget Anaconda and use WinPython.
I tried Anaconda for days with all the workarounds available in StackOverflow and other forums, and they took me nowhere.
Then I tried WinPython, and it worked immediately. Of course, you will need to change the PowerBI options accordingly.
To install WinPython: https://github.com/winpython/winpython
To change the detected Python home directory: https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts#enable-python-scripting
If you consider my answer, you won't need to downgrade Python, PBI, or anything else.
I had the same error. Unfortunately, PowerBI wont work with Jupyter Notebook Python.
So you have to install a "normal" Python: https://www.python.org/downloads/
And configure the Python you want to use in PowerBI and install your needed Python libraries via pip
Edit: Please use Python 3.8 because 3.9 doesnt support NumPy for now

Cannot find module PIL in Python

I am using:
Thonny Version 3.2.1
Python Version 3.7.0
PIP Version 19.2.3
Pillow Version 6.1.0
I am trying to import an image into my program and show it on the screen with the below code:
I get the error:
ModuleNotFoundError: No module named 'PIL'
backend.py, line 276
I believe the problem isn't my code, but instead an issue with the module Pillow not being found by Python?
Can anyone please help with a fix? I can clarify any info needed.
Additionally, I am new to Python and so go easy on me :-) Apologies if any of my terminology is incorrect.
I have tried:
1\ Removing PIL as per the install warning from Pillow (PIL Fork) install info. It was not present on my system. I did this through CMD.
2\ I always access CMD as the administrator.
3\ Updating all program versions above through CMD.
4\ Info I’ve found shows the above versions are compatible.
5\ Using the code help('modules') to show available modules, it does not show 'PIL' or 'Image', but does show 'pip'.
6\ Checked many forums for other fixes.
from PIL import Image
im = Image.open("JC.png")
im.show()

Python 3.7 + Visual Studio 2107 + boost 1.69

I am trying to get boost 1.69 working with visual studio 2107. My goal is to use Numpy in C++
When I include #include boost/python/numpy.hpp
The error I am getting is:
Searching C:\boost_1_69_0\stage\lib\boost_python37-vc141-mt-gd-x32-1_69.lib:
1>LINK : fatal error LNK1104: cannot open file 'boost_numpy37-vc141-mt-gd-x32-1_69.lib'
I am pretty sure that I have this file in this directory.
My architucture in the project is x86, 32-bit addrressing
I built boost as follows:
.\bbotstarp.bat
.\b2 -j8 --toolset=msvc-14.1 --build-type=complete link=static runtime-link=static architecture=x86 address-model=32 stage --with-python
I added the include and link folders to the project.
I do not use precompiled headers
Is there anything that I am missing?
Thanks
I had the same problem. It seems like Boost python is not supported by python 3.7 vert well.
Using python 3.6 will solve this problem.
I have been looking at this issue for months and finally figure out the root cause and solutions. The root cause that boost numpy is not built is because numpy is unable to be imported when ./b2 checks for numpy. As a clue from this post Using boost numpy with visual studio 2019 and python 3.8, you can append --debug-configuration to see the debugging information of boost python building process like this in my PC
notice: [python-cfg] Checking for NumPy...
notice: [python-cfg] running command 'C:/Anaconda3_Install_Root/envs/my_envs/python -c "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())"'
And, the error comes from ImportError for some reason:
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
After looking at this post numpy is already installed with Anaconda but I get an ImportError (DLL load failed: The specified module could not be found), I found this import process has to be under python environment such as under conda environment or PyCharm terminal (They both work in my PC) with all the required PATH to be imported. Now I can generate numpy static library with Python 3.8, VS 2019, boost v1.74, Windows 10. The command I use to build boost python is .\b2 --with-python python-debugging=off threading=multi variant=release li
nk=static address-model=64 stage --debug-configuration. Hopefully, that will work in yours.

Windows 10 pyinstaller tensorflow missing modules

I try to deploy a model with pyinstaller and when i run it i get the following error.
ModuleNotFoundError: No module named
'tensorflow.python._pywrap_tensorflow_internal'
Tensorflow 1.7.0
cudnn64_7
CUDA 9.0
Python 3.6
You can resolve this issue by simply renaming the file _pywrap_tensorflow_internal.pyd contained in the dist folder to tensorflow.python._pywrap_tensorflow_internal.pyd.
I still have to figure out how to tell pyinstaller the "correct" module name.
( Workaround for Python 3.5 only )
Building off of Jascha's solution, a work around is to manually fetch the file __python._pywrap_tensorflow_internal.pyd from
PathToAnaconda3/env//Lib/site-packages/tensorflow/python/__python._pywrap_tensorflow_internal.pyd
and rename it into tensorflow.python.__python._pywrap_tensorflow_internal.pyd
Then this renamed file can be moved into the exe file by :
pyinstaller -F <name of python file> --add-data "pathToFile/tensorflow.python.__python._pywrap_tensorflow_internal.pyd";.
The flag --add-data takes two arguments separated by semi colon
--add-data source_path;destination_path_inside_exe

f2py: limit.h file missing in numpy in Windows

I’m having trouble compiling some FortranIV code using f2py and the g77 compiler. I need to do this to call some very old code written in Fortran to an already existing Python module. I have gcc installed through MinGW but I’m not sure if that makes any difference. I am also running Python 2.7 with Numpy 1.7 and SciPy 0.12. My OS is Windows7 x64 but I have made sure that all my installs are 32bit versions. I am new to Python, Fortran and this forum so please bear with me.
The error I am getting when I compile the code with f2py is as follows:
C:\Python27\lib\site-packages\numpy\core\include\numpy\npy_common.h:291: limits.h: No such file or directory
error: Command "gcc -mno-cygwin -mdll -O2 -w -Wstrict-prototypes - DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 - Ic:\users\ncd69~1.boh\appdata\local\temp\tmpxbl4sc\src.win32-2.7 -IC:\Python27\lib\site- packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC - c:\users\ncd69~1.boh\appdata\local\temp\tmpxbl4sc\src.win32-2.7\hellomodule.c -o c:\users\ncd69~1.boh\appdata\local\temp\tmpxbl4sc\Release\users\ncd69~1.boh\appdata\local\temp\tmpxbl4sc\src.win32-2.7\hellomodule.o" failed with exit status 1
In order to isolate the problem I have used a test code that is compatible with the gfortran compiler. I make a call to the required compilers using ‘-c –compiler. The test is on the same lines as your basic ‘Hello World’. The error thrown up is identical for the real and test code. I looked up the erroneous file ‘npy_common.h’ and found that line 291 calls to include a header: limits.h.
Since the error occurs in the Numpy libraries I am assuming that the error is with Numpy? I can’t seem to figure out why this error would occur.