I am trying to make Tkinter GUI module with a build option to build Exes after the user puts some inputs & I don't want him to install python and pyinstaller to be able to Compile the code to Exe.
Using Python 3.6.0
I made 2 python scripts first-named compiler.py & other hello.py
hello.pyprint("Hello World")
compiler.py
import PyInstaller.__main__
import ctypes
import win32ctypes
from win32ctypes import pywin32
from win32ctypes.pywin32 import pywintypes
import os
def compiling():
PyInstaller.__main__.run([
# '--name=%s' % package_name,
'--onefile',
'--windowed',
# '--add-binary=%s' % os.path.join('resource', 'path', '*.png'),
# '--add-data=%s' % os.path.join('resource', 'path', '*.txt'),
# '--icon=%s' % os.path.join('resource', 'path', 'icon.ico'),
os.path.join('hello.py'), # my_package is a Directory
# '--version-file=%s' % os.path.join('assembly.txt'),
])
compiling()
when I try to Compile compiler.py with pyinstaller it compiles successfully
with -->pyinstaller --onefile --console compiler.py
but when I try to run the exe it throws
PyInstaller cannot check for assembly dependencies.
Please install pywin32-ctypes.
pip install pywin32-ctypes
What I Have Tried?
1-i installed pywin32-ctypes successfully
2-Tried to compile compiler.py with different alternatives other than pyinstaller
3-cx-freeze & nuitka both of them throw the same error when I Run after compiling.
4- tried using Python 3.7.5 on other machine start new fresh Throw the Same Error
the reason I choose pyinstaller because it can build 1 EXE
https://github.com/pyinstaller/pyinstaller/issues/3892
https://github.com/pyinstaller/pyinstaller/issues/3793
Unable to run PyInstaller - "Please install PyWin32 or pywin32-ctypes"
All those Failed As Well is it something I am Doing Wrong or is Pyinstaller Problem
An old question but maybe someone could face the same issue.
I found a solution and it works for me.
Installing this module solves the problem
pip install cffi
After installing, I tried the build again. Gives error-like warning.
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
You can fix this warning via installing pywin32
pip install pywin32
I hope it helped someone else.
I had the exact same issue.
The fix for me was making an edit to a couple of lines in the Pyinstaller compat.py file.
Navigate to your python directory -> Lib -> site-packages -> Pyinstaller.
Open compat.py and look for the following:
if is_win:
try:
from win32ctypes.pywin32 import pywintypes # noqa: F401
from win32ctypes.pywin32 import win32api
except ImportError:
# This environment variable is set by seutp.py
# - It's not an error for pywin32 to not be installed at that point
if not os.environ.get('PYINSTALLER_NO_PYWIN32_FAILURE'):
raise SystemExit('PyInstaller cannot check for assembly dependencies.\n'
'Please install pywin32-ctypes.\n\n'
'pip install pywin32-ctypes\n')
Change both of those import statements to import the modules themselves instead of trying to grab them from win32ctypes.pywin32.
#from win32ctypes.pywin32 import pywintypes # noqa: F401
#from win32ctypes.pywin32 import win32api
import pywintypes
import win32api
I hope that helps!
I solved this on Windows on command prompt, first navigate using cd, till reach the folder Scripts:
C:\Users\john\Envs\yourEnv\Scripts
You'll see a pyinstaller.exe
Then call it on cmd:
pyinstaller --onefile --clean --name myApp "C:\path\to\your\script\example.py"
The resulting folders will be Dist and Build and they will be on first path you see here "C:\Users\john\Envs\yourEnv\Scripts". The file .exe is on Dist.
I had similar issue.The above methods didnt work.I used env method ,(env) C:\Users\RAMAJAYAM>python -m PyInstaller --name "tkinterapp1.py" "C:\Users\RAMAJAYAM\tkinterapp1.py" and compiled successfully.Exe works fine.
Ok I think I have figure it out the pip3 install pyinstaller was installing it in the ~\AppData\Roaming\Python\Python37\Scripts directory. I had to to uninstall it via pip3 uninstall pyinstaller. Then navigate to the python3 root install directory then run python.exe -m pip install pyinstaller.
Not sure what this means, but I'm no longer getting the following error:
PyInstaller cannot check for assembly dependencies.
Please install pywin32-ctypes.
pip install pywin32-ctypes
Alternatively, it looks like PyInstaller doesn't like running in a virtual environment. deactivateing the venv, then pip install pyinstaller and pyinstaller pyinstaller.spec worked for me.
I had the same issue and had to upgrade pyinstaller using
pip install --upgrade pyinstaller
It must be some kind of problem with the packages pyinstaller uses, It might have updated the packages while upgrading pyinstaller too.
i got this broblem too.
i fixed it...
first -> uninstall pywin32-ctypes -> pip uninstall pywin32-ctypes
second -> install again -> pip install pywin32-ctypes
maybe this working ..!
Related
I trying to getting data from FTP server's txt file by GCP Composer Tasks.
So I imported SFTPOperator package in code.
but error occurred:
ModuleNotFoundError: No module named 'airflow.providers.sftp'
then, I tried few ways:
Getting exception "No module named 'airflow.providers.sftp'"
Install apache-airflow-providers-sftp by composer pypi packages
but didn't work.ðŸ˜
My GCP Composer Environment is as below:
Image Version : composer-1.17.7-airflow-2.1.4
python version : 3
Network VPC-native : Enable
How can I use SFTPOperator ?
For this you will have to install sftp package, pip install 'apache-airflow[sftp]' . You can check the built-in and extras packages that airflow components have when installed (varies from version).
Once you have it installed you should be able to use SFTPOperator by importing the operator inside your DAG.
from airflow.providers.sftp.operators.sftp import SFTPOperation,SFTPOperator
with DAG(...) as dag:
upload_op = SFTPOperator(
task_id="test_sftp",
ssh_conn_id="ssh_default",
local_filepath="/tmp/file.txt",
remote_filepath="/tmp/tmp1/tmp2/file.txt",
operation=SFTPOperation.GET,
dag=dag
)
...
You can also find a mock tests on the airflow git hub project that can provide you some guidance, check this link.
UPDATE 17/08/2022: As commented by Diana, Composer has a documented way to install its components as mention on this link. Be advised to pick up the composer version your project uses as there is version1 and version2 guides.
I have a python script, my.py - developed in anaconda/spyder.
it runs within the spyder IDE;
it runs also as a command line in a dos window:
python my.py
I need to distribute the program to other users, so I use
pyintaller -c -F my.py
I get message right on my face:
PyInstaller cannot check for assembly dependencies. Please install
PyWin32 or pywin32-ctypes.
pip install pypiwin32
Follow the message and run:
pip install pypiwin32
and this returns:
Requirement already satisfied: pypiwin32 in
e:\anaconda3\lib\site-packages (223) Requirement already satisfied:
pywin32>=223 in e:\anaconda3\lib\site-packages (from pypiwin32) (223)
My python path:
C:\python36\my\ALL>python -c "import sys; print('\n'.join(sys.path))"
e:\anaconda3\python37.zip e:\anaconda3\DLLs e:\anaconda3\lib
e:\anaconda3 e:\anaconda3\lib\site-packages
e:\anaconda3\lib\site-packages\jenkinsapi-0.2.28-py2.7.egg
e:\anaconda3\lib\site-packages\win32
e:\anaconda3\lib\site-packages\win32\lib
e:\anaconda3\lib\site-packages\Pythonwin
What I am missing here?
I installed jython 2.5.3 and I am trying to execute my script, which has a dependency with jsch.jar, using the command line. Then I tried something like this:
c:\myScriptLocation\> c:\jython2.5.3\jython.bat script.py
But it returns:
ImportError: No module named jcraft
If I execute the jython script with Eclipse, it works, because I can add the dependency in the System PYTHONPATH of the Jython Interpreter. But I cannot use eclipse to execute the script, I have to do it with the command line.
I tried to copy the jar file to the lib path of the jre jython is using, but doesn't work.
Any idea of the command I have to use?
You can just do ...
c:\myScriptLocation\> c:\jython2.5.3\jython.bat -Dpython.path=\myJarLocation\jsch.jar script.py
After successful compilation of project, I have get an executable file.
When I type ./program in result I see:
QML Error: qrc:///qml/main.qml:25:1:module "QtGraphicalEffects" is not installed
qrc:///qml/main.qml:24:1:module "QtQuick" is not installed
I'm using QtQuick 2.0, Qt5 and Ubuntu, QtQuick and QtGraphicalEffects are in ~/Qt5.0.2/5.0.2/gcc/qml/ I have install fresh Qt SDK from site project.
I have tried run this application also on Windows 7 but with the same result.
Could anyone help?
This is because Windows or whatever OS you use doesn't know the location of Qt install directory and it can't find the QML plugins sub-dir when you run app outside QtCreator.
You have to take the following directories from your SDK install and copy them beside your executable (and DLL) :
<SDK install path>/<Qt version>/<compiler name>/qml/QtQuick.2
<SDK install path>/<Qt version>/<compiler name>/qml/QtGraphicalEffects
And it should work fine.
Just make sure to have the package installed
I see you mentioned about Ubuntu, if using 14.04 , you can install it by typing this command line :
sudo apt-get install libqt5qml-graphicaleffects
And if it's not found it you can still look for package name on debian based distros :
apt-file search 'qml/QtGraphicalEffects/qmldir'
libqt5qml-graphicaleffects: /usr/lib/x86_64-linux-gnu/qt5/qml/QtGraphicalEffects/qmldir
I had the same problem with Qt5.8.0 and QtCreator 4.2.1 the import QtGraphicalEffects 1.0 was underlined because the module not found!
I added in the .pro file my path to the QtGraphicalEffects 1.0
QML_IMPORT_PATH += /opt/Qt5.8.0/5.8/gcc_64/qml/QtGraphicalEffects
After that it started working!
You can also add this to the "Build Environment" at the project page if the previous setting does not solve your problem. And restart QtCreator.
I have installed Python 2.7.1 and python-ldap-2.4.8.win32-py2.7 module. Whenever I type
import ldap
it gives and error.......
ImportError: No module named ldap
Path is set properly, I have only one version of Python i.e. 2.7.1 I have installed python-ldap module properly.
then also I am facing this problem. why so?
Any help is very much appreciated.
Please provide more information to debug this problem.
Are you sure the python-ldap module was installed successfully? (I realize you said it was but if you tried to install it using pip, the install command completes with errors because it is missing some header files for the build)
The easiest way to install python-ldap on Windows is to download the binary from: http://pypi.python.org/pypi/python-ldap
Make sure you download the python-ldap version that corresponds to your installed python version.