Py2exe 64-bit fails to install - python

I am wanting to compile all of my python scripts into one exe. I use the Vizard shell to find errors in my scripts. When I download the 64-bit install for py2exe (Python 2.7), and try to install it, the exe ignores my Python 2.7 directory, and chooses Vizard as the main directory. I uninstalled Vizard, rebooted my computer and tried the installation again, but to my surprise, it still had the Vizard directory as my main directory.
When I tried to install a 32-bit version, it located my Python directory just fine. However, the 32-bit version will not work and gives me ridiculous amounts of errors trying to run it.
Vizard is rather important to me, so I'd love to keep the program. Is there a way to install the 64-bit version outside of an exe? Thanks for the help.

Related

Convertin .py files to .exe and run it in windows 10 without any installation

I have already converted my python script .py to .exe using pyinstaller. When I try to run this exe in Windows 10. It states this app can not be run on your PC.
As far as I see, I need to install Python in Windows as well, but in my situation this is not an option. In my company, every computer uses Windows 10 and there is no way for me to install Python all of them.
What I wonder is that whether there is any way to run my .py script in Windows 10 without installing anything into Windows 10. I should give a working directory to people in my company and they should run my script with just one click.
EDIT:
With the help of #Amey and #L00n3y, I managed to solve my problem. In case anyone has same problem, I explained the procedure clearly, in this link.
have you tried py2exe?
py2exe is a distutils extension which allows to build standalone Windows executable programs from Python scripts.
You can download it here:
https://pypi.org/project/py2exe/
You can also use 'Pyinstaller' which is widely used.
Install it using,
pip install pyinstaller
And create an executable using the following command,
Python pyinstaller.py --onefile pythonfile.py
With the help of #Amey and #L00n3y, I managed to solve my problem. In case anyone has same problem, I explained the procedure clearly, in this link.

Python: ModuleNotFound error when starting script manually

When I double-click the script to run it raises ModuleNotFound error. However, when I execute python main.py, the script works just fine. What can be causing it? I have a fresh 3.6.1 installation.
The telebot module is successfully installed and working.
Here's to clarify:
When I double-click or run main.py from console, the script throws an error because it cannot find a module. (probably because it runs from a distant folder)
When I run python main.py from the same folder the script works well. All modules are recognized and loaded. (my guess is that python command runs python.exe which is located where all of the modules are)
My Path environment variable is pointing to the correct folder.
I only have one python installation and one version.
It seems that you have installed both 32 bit and 64bit Pythons but have installed a package in only one of them. You can one of the following:
uninstall the one that doesn't have the package installed and add the remaining one to the path variable, or
you can install package in both 32bit and 64bit python.

How to make a python executable when nothing is working?

I am using python 3.6 and nothing is working for me. I just can't install any of the tools for creating an executable. I tried cx_freeze, using pip had Visual C++ errors which I fixed and then it had more errors so I downloaded a wheel and that installed and in my Scripts folder there are three cxfreeze related files, none of which are batch files and when I run 'cxfreeze' in cmd it just says it is not recognised. For some reason python is installed in appdata/local/programs... but that is set in my path so I cannot see how that doesn't work. I tried pyinstaller with both pip and the download and nothing but errors about pypiwin32 which I can't get because of some other errors.
I do not know what is happening and I do not know what to do about all of this. Can someone just help me get a tool working to create an executable please. Is this because I am using python 3.6?
Try py2app (if you are on a mac) or py2exe (if you are on a windows). The setup is relatively easy.
https://pythonhosted.org/py2app/
http://www.py2exe.org/

python 3.4.3 64bit a program required for this install could not be run

Trying to install Python 3.4.3 64-Bit and it gives me the following error:
'There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support or package vendor'
I have no bloody idea what this means so please help. Thanks in advance
I'm the admin on my computer and have all permissions
My windows is 64bit and is Windows 8.1
I had the same phenomenon occur when trying to clean up (uninstall various versions of Python and perform a clean install of 3.4.3) on my Windows 7 64-bit laptop. Unfortunately, I cannot tell you what "program required for this install to complete could not be run". Repeated attempts to "install for all users" produced the same "could not be run" (followed by a roll back of the install). Just before getting out Orca and diving into the innards of the MSI file, I attempted an "install just for me", and the install completed. I am, in fact, the only (human) user of this computer. There is another user account that was created during a cygwin setup, and access to some aspect of that user's profile/resources may have been the issue. If you are installing Python for your own use - and not as a "platform-wide" resource for other users as well - you might try installing "just for me".
For me the problem was that I had an older version of Python installed, that the MSI could not un-install. I had to manually remove it first.
This is how I resolved the problem on my Windows7 machine...
Open a command prompt and navigate to the location of the python.exe. (For me this was C:\Python34.)
Execute this command
python3 -B -m ensurepip._uninstall
Close the command prompt.
Using the python MSI file for the version of Python I had previously installed (yes, I went to the Python archive and downloaded the MSI for the old version), install Python again, but without the "pip" package. (Not sure if this is necessary, but it worked for me.)
Using the same Python MSI file, uninstall Python completely.
Using another MSI, for the version of Python you wish to install, you should now be able to perform a "clean" install.
I got the same error while uninstalling the python file from the control panel. It prompts
There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support or package vendor
I have solved this problem by installing the specific python-<version>.amd64.msi.
I then executed the MSI file. It asks for Change, repair, remove. First, click on Change radio button and complete execution. Later you can come to control panel and repair or uninstall the python file.
I had the same symptoms as OP. In my case, i had two separate installs, one of 2.7 and one of 3.4.3 and when i checked the PATH variable, there were 2 lines about PYTHONPATH pointing to the 2.7 version.
I removed the lines and then the repair funciton of the MSI did work. I uninstalled both versions and proceeded to reinstall.
Done :)
On a Win7 box:
Startup/ right click on Computer / Properties / Advanced system settings / Environment variables then check both sub-windows for paths related to python.
I had just the exact problem. But in mine case i've additionally removed the c:\python27 and c:\python36 directories and associated installers got stuck around Install/Uninstall and could not completely repair the installation (the /Scripts subdirectory has been missed and the python.exe reported an error about missed encodings module).
But i've found a solution for myself. Seems somehow the PYTHONHOME and PYTHONPATH environment variables (and may be PATH too) has been interfering with the Python installation process. But because i could not run Uninstall from the Windows Uninstall list in the Control Panel, then i did this:
Cleanup the PATH environment variable from all python path occurrences.
Remove PYTHONHOME and PYTHONPATH environment variables.
Restart Windows Explorer if environment variables (console command set PY must return the empty list) is not updated.
Run repair from (!) the python-3.4.4*.exe/python-2.7.11*.exe executables (download it if not done yet). Icons in the Windows Uninstall list in the Control Panel will reset into the original state for a repaired python installation.
Run the Uninstall from the same executables or from Windows Uninstall list in the Control Panel.
And it did the trick!
If you still needs the both versions of the python installation, then try install the older versions before the new versions. Seems it's important too.
Poking around, there is a temp file saying:
Error 1721. There is a problem with this Windows Installer package. A
program required for this install to complete could not be run.
Contact your support personnel or package vendor. Action: UpdatePip,
location: C:\Programs\PY272\python.exe, command: -m ensurepip -U
--default-pip
=== Logging stopped: 6/12/2015 13:26:17 ===
OK, so the missing "Voldemort" file (that which shall not be mentioned) is the ensurepip package. There is documentation for ensurepip at https://docs.python.org/2/library/ensurepip.html. I am still on 2.7, but it looks like this is a shared problem with Py 3.
The documentation says the ensurepip package is new in 2.7.9. My solution: install a version prior to 2.7.9 and then upgrade the files myself from an existing install. Done.

Using py2exe in a virtualenv

I have a Python script I developed within a virtualenv on Windows (Python 2.7).
I would now like to compile it into a single EXE using Py2exe.
I've read and read the docs and stackoverflow, and yet I can't find a simple answer: How do I do this? I tried just installing py2exe (via the downloadable installer), but of course that doesn't work because it uses the system-level python, which doesn't have the dependencies for my script installed. It needs to use the virtualenv - but there doesn't seem to be such an option.
I did manage to get bbfreeze to work, but it outputs a dist folder crammed with files, and I just want a simple EXE file (one file) for my simple script, and I understand Py2Exe can do this.
tl;dr: How do I run Py2Exe within the context of a virtualenv so it correctly imports dependencies?
You can do that this way:
Activate your virtualenv and then ...
easy_install py2exe-0.6.9.win32-py2.7.exe
Installing py2exe into your virtual env should be straightforward. You'll need Visual Studio 2008, the express version should work. Launch a 2008 Command Prompt and Activate your virtual env. Change into the directory that contains the py2exe source and run python setup.py install. You can verify that py2exe is in the correct environment by attempting to import it from an interactive shell. I tested myself earlier today (had to install virtualenv). It works exactly as expected.

Categories