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?
Related
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 ..!
I am getting an error when execute robot scripts through CMD (windows)
'robot' is not recognized as an internal or external command, operable
program or batch file"
My team installed Python in C:\Python27 folder and I installed ROBOT framework and all required libraries with the following command
"python -m pip install -U setuptools --user, python -m pip install -U robotframework --user"
We are not authorized to install anything in C drive and all libraries were installed successfully. But when I try to execute the scripts through CMD then getting error.
Note:
All Robot Libaries are installed in "C:\Users\bab\AppData\Roaming\Python\Python27\site-packages"
I did set up the Env variables with above path
Scripts are working through ECLIPSE and using the command below
Command
C:\Python27\python.exe -m robot.run --listener C:\Users\bab\AppData \Local\Temp\RobotTempDir2497069958731862237\TestRunnerAgent.py:61106 --argumentfile C:\Users\bab\AppData\Local\Temp\RobotTempDir2497069958731862237\args_c4fe2372.arg C:\Users\bab\Robot_Sframe\E2Automation
Please help me, as this step is very key to integrate my scripts with Jenkins
Thanks a lot, it works for me. Just write the following in the terminal:
python -m robot "your file name"
In this case the file name is TC1.robot, so the command would be:
python -m robot TC1.robot
I was getting an error when executing robot scripts through linux command of
sudo pip install robotframework
and the below command worked for me:
sudo pip3 install robotframework
I've installed robotframework using this command "sudo pip3 install robotframework" in jenkins server. and now my jenkins pipeline script can now run my robot scripts
I'm not very comfort with Windows environment, so let me give my two cents:
1) Try to set the PATH or PYTHONPATH to the location where your robot file is
2) Try to run robot from python script. I saw that you tried it above, but take a look at the RF User Guide and see if you are doing something wrong:
https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#using-robot-and-rebot-scripts
maybe just
python -m robot ....
is fine
Thanks, It worked , first I cd to the Site packeges where Robot is installed and ran with Python -m command cd Users\babo\AppData\Roaming\Python\Python27\site-packages\robot>C:\Python27\python.exe -m robot.run -d Results C:\Users\bab\Robot_Sframe\E2EAutomation\Test_Suite\Enrollment_834.robo
We can close this
I was able to create the path and install pyinstaller appropriately.
C:\Users\Ankit.Aggarwal>pip install pyinstaller
Requirement already satisfied: pyinstaller in
c:\users\ankit.aggarwal\appdata\roaming\python\python36\site-packages
(3.4)
Requirement already satisfied: setuptools in c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages (from pyinstaller) (39.0.1)
Requirement already satisfied: pefile>=2017.8.1
in c:\users\ankit.aggarwal\appdata\roaming\python\python36\site-packages
(from pyinstaller) (2018.8.8)
Requirement already satisfied: macholib>=1.8 in
c:\users\ankit.aggarwal\appdata\roaming\python\python36\site-packages
(from pyinstaller) (1.11)
Requirement already satisfied: altgraph in
c:\users\ankit.aggarwal\appdata\roaming\python\python36\site-packages
(from pyinstaller) (0.16.1)
Requirement already satisfied: pywin32-ctypes in c:\users\ankit.aggarwal\appdata\roaming\python\python36\site-packages
(from pyinstaller) (0.2.0)
Requirement already satisfied: future in
c:\users\ankit.aggarwal\appdata\roaming\python\python36\site-packages
(from pefile>=2017.8.1->pyinstaller) (0.17.1)
C:\Users\Ankit.Aggarwal>pyinstaller
'pyinstaller' is not recognized as an internal or external command, operable program or batch file.
However , getting above error on executing simple pyinstaller command.
What am I missing?
Figured ; added above path
C:\Users\Ankit.Aggarwal\AppData\Roaming\Python\Python36\Scripts>
Are you sure the path for pyinstaller is correct? When you run the command, pip says pyinstaller is located in
c:\users\ankit.aggarwal\appdata\roaming\python\python36\site-package
I have no idea if this will work, and I have never experienced this problem, but it looks like you may be looking in the wrong directory for pyinstaller.
You should uninstall pyinstaller,If you have already installed & run thr following command :
***python -m PyInstaller --onefile --windowed --name="fileName" Homework.py***
Ensure that you have admin rights before you run the commands. cmd - Run as administrator will ensure that you have logged in as administrator.
I have my python package requirements in setup.py and I simply do pip install . from a directory where setup.py exists. I don't have a requirements file and I don't want to have one. How do I tell salt to use setup.py instead of requirements.txt?
Installing pip package to virtualenv and running setup.py should be different requirement.
I assume setup.py triggering is only mean for self-serving modules, external package should be put under saltstack virtualenv setup, so you can see if the required external package failed to install. But it also depends on your own taste.
To run setup.py inside your virtualenv, you must create a script that call the virutalenv, then run setup.py , e.g. vi run-setup.sh
#!/bin/bash
source $HOME/.virtualenv/xyz/bin/activate
cd $HOME/xyz_app
python setup.py
then use the cmd.run in state file to run it
run setup.py for my xyz app :
cmd_run:
- name: bash <xyz_app folder name>/run-setup.sh
- user: <username>
- group: <groupname>
UPDATE :
Since you want to load particular python package to your virtualenv, you can do it straight away during setup. Then only use cmd.run to load batch that launch setup.py (to make your custom app works)into the virtualenv.
create-my-apps-virtualenv:
virtualenv.managed:
- name: /home/myapphome/.virtualenv/myapp
- user: myappusername
- no_chown: False
# install this pacakge to my virtualenv, package must be case sensitive according.
- pip_pkgs: json, MySQL-python,SQLAlchemy
I'm using google cloud instance for host Odoo, somo reports print to pdf ok, but other with custom paperformat get the following error:
"The switch --header-spacing, is not support using unpatched qt, and will be ignored.The switch --header-html, is not support using unpatched qt, and will be ignored.The switch --footer-html, is not support using unpatched qt, and will be ignored.QXcbConnection: Could not connect to display"
I google it, and to solve I need to compile wkhtmltopdf like this:
http://www.grobak.net/id/blog/how-fix-wkhtmltopdf-failed-error-code-6 but this proccess need 3 hs and I'm building a script to install google instances on the run with odoo dependencies.
the .deb package have a dependency broken
Anyone know other solution?
My system configuration is Ubuntu 14.04 and 64 bit. So, i am downloading according to that.
First you have to check your system OS name by
lsb_release -a
Check to see if your Ubuntu Linux operating system architecture is 32-bit or 64-bit, open up a terminal and run the following command below.
file /sbin/init
Download wkhtmltopdf patched with qt using below command
sudo wget -P Downloads https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
Here, replace "trusty" with your OS name and if 64 bit only then keep "amd64" like that , otherwise change it to "i386" and down load the deb file.
After that execute the following commands,
cd ~/Downloads
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
Now, check wkhtmltopdf version with below command,
wkhtmltopdf -V
Enjoy!!
After trying many ways I finally made it work.
First I removed all my previous installation by
sudo apt-get remove --purge wkhtmltopdf
sudo apt-get autoremove
Then I opened wkhtmltopdf.org and navigated into their Downloads > Archive. In Archive section I downloaded 0.12.1 .deb version by
wget <copy the link from website for the.deb file and paste it in terminal here>.
sudo dpkg -i <package name>
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
This is because odoo looks for wkhtmltopdf in /usr/bin directory otherwise gives IOError. I also set my webkit_path parameter in Odoo System Parameters to /usr/bin.
Thats it. Hope this helps
I was facing same issue with wkhtmltopdf 0.12.4
installed new version of wkhtmltopdf 0.12.6-1
follow below commands to install wkhtmltopdf 0.12.6-1
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm
yum localinstall wkhtmltox-0.12.6-1.centos7.x86_64.rpm #centos specific command