Installing cx_freeze via msys2 - python

I am trying to write a small gtk application with Python.
I was told that you should use msys2 for MS-Windows. See related question: Setting up developement environment: PyCharm, python-gtk, windows
Now I need cx_freeze. There are wheel-files for windows, but I guess the msys2 environment is different, and that's why installing "cx_freeze" fails (no gcc around).
See files of cx_freeze: https://pypi.org/project/cx_Freeze/#files
Now I am unsure if I am on the right track.
Is there a way to use the ready build wheels from a python which is started in msys2 (In my case C:\msys32\usr\bin\python3.exe)
Installing cx_freeze worked after installing gcc. But now I get this error:
cx_Freeze.freezer.ConfigError: no base named Console
I guess I should not compile cx_freeze and get my environment use the provided wheels.
Update
I leave this question open, because someone else could find a solution and help someone else again. But I switched from gtk to pyside2 (QT). Everything is much easier now.

Related

Pyinstaller Exception: Cannot find PyQt4 plugin directories

I will spare unnecessary details here and try to keep it short.
My issue: I built my program using the following in command prompt
pyinstaller --onefile --icon=logo.ico H:\<script location>
Originally, this compiled and output perfectly fine. I opened up the exe to test it, and it worked like a charm. However, I noticed a small typo of mine and adjusted my script to fix it. When I went to use the same command prompt line to build the .exe again is when it gave me the PyQt4 error. This actually happened earlier today as well, to which I solved it my uninstalling both PyInstaller and PyQt4, restarted my computer, then re-installed them. Everything else I tried just did not work.
I do not understand how it would work at one moment and then, literally not even 30 seconds later, it gives me this exception. I would prefer not to constantly uninstall and then re-install PyQt4 and PyInstaller in order to build my .exe files.
I am running python 3.5 through idle if that makes any difference here.
I do not have any other form of python installed either.
I have been downloading my packages using pip and from the wheels located at http://www.lfd.uci.edu/~gohlke/pythonlibs/ if that also makes a difference.
I saw the solution here Exception: Cannot find PyQt5 plugin directories when using Pyinstaller despite PyQt5 not even being used . However, I do not have Anaconda installed that could be interfering like this guy found.
Any help is appreciated!

PySide2 on windows

Does anyone know where I can find a pip-install for PySide2?
It's 2017 and I can't seem to find a pip install or site-package containing the binaries for PySide2. I prefer not to deal with downloading the source code and compiling it myself, as that usually ends up being a huge headache as it's never a smooth process. Also considering it's highly likely someone else has already done it. If I were to be honest here, if I attempted to compile it myself and errors popped up, I wouldn't really know where to begin solving them, nor do I want to spend time doing that.
I just find it hard to believe I can't find it anywhere online or even in PIP when a lot of applications in the VFX industry are switching to PySide2.
I hope someone can help me out.
Thanks
Same Problem...
So i tried to build it. But there are Problems building the WebKit.
Hence my windows binaries are actually without a webkit binding.
You can obtain it through PyPI:
pip install PySide2
or if it fails (most likely because your pip executable is bound to python 2) try:
pip3 install PySide2
or even better:
python -m pip install Pyside2
This assumes that python is bound to Python 3, that way you're really sure about the Python version used, see Why you should use python -m pip.
There are wheels available by Fredrik Averpil here built with Qt 5.6.
Claudius Hansch's answer provides a wheel using Qt 5.9.
In any case, don't forget to either
set the QT_QPA_PLATFORM_PLUGIN_PATH environment variable as described here
or
create a qt.conf file in the folder of your python.exe with the content
[Paths]
Prefix = /dir_to_site-packages/PySide2
Binaries = /dir_to_site-packages/PySide2
PySide2 is now available on pypi so a simple
pip install PySide2
should work on Windows, OSX, and linux!
I use Python 3.7 on windows 10 pro, 64bit.
Installing via pip failed for me.
I ended up downloading the wheel from qt directly
QT official download page
and install the downloaded wheel which worked fine.

python app - xcb plugin fail

My setting: Python 2.7 with anaconda
Recently I have installed OpenCV 3.0 and when I try to do simple image display or I want to run python samples that come with OpenCV, there is a error message:
This application failed to start because it could not find or load the Qt platform plugin "xcb".
I have read many comments that I need to attach .so files to my project but I don't think it's the optimal solution since for most people it works out of a box.
I have no clue what to do. I'm inexperienced. What comes to my mind is only to reinstall everything.
Qt5 works fine with OpenCV 3.1.0. This is what worked for me for resolving the "xcb" error.
Apparently the Anaconda qt and pyqt packages (v4) were shadowing the system v5 version.
If you want to work with Qt5 try removing these via:
conda remove qt
conda remove pyqt
(Ubuntu 16.04, OpenCV 3.1.0, Anaconda 4.1.1, Qt 5)
Okey, I have figured it out.
During cmake I set flag -D WITH_QT=OFF since I read somewhere that it doesnt work for Qt5.x

Error while installing PyQt

I want to install PyQt to use features of the Qt-library for my Python programms. When I execute 'configure.py' in the command window I get the following error:
Error: Make sure you have a working Qt qmake on your PATH.
About my system and what I've done yet: I use Python 3.2 on Windows 7.
First I compiled sip-4.15.5. After getting the error above, I also installed Qt5.2.1. Both installations worked without a problem, but the error stayed the same.
I have tried a solution for apparently the same problem, found on stackoverflow. But it doesn't work for me (exportisn't a windows command, is it?). And I don't use the PyQt installer, because it's only available for Python 2.7 and 3.3.
Thanks.
You can download a PyQt installer for Python 3.2 here at Christoph Gohlke's Python Extension Packages for Windows repository. Whenever I'm looking to install or update a module on Windows, I look there first.

Cannot Open Python. Error 0xc000007b

I have recently been learning Python 3. I have had no problems on my netbook (32bit Windows 7) I with creating small simple programs. When I installed it on my netbook I had no problems, but now that I've been getting into it I want to install it on my desktop and I have one.
My desktop is a 64 bit OS running Windows 7. Like I did with my netbook, I went to download Python and install the 64 bit edition.
After installing it, I went to open up Python CLI and GUI and no luck. It gave me this error.
"The application was unable to start correctly (0xc000007b). Click OK to close the application"
I also tried reinstalling, but not luck.
I suspect a missing .dll but I am not completely sure. Does anyone know what is keeping me from opening Python and how do I fix it?. I want to resume my work as soon as possible.
That is the NTSTATUS error code for STATUS_INVALID_IMAGE_FORMAT. Almost invariably that means that the loaded is attempting to link a 32 bit DLL into a 64 bit process, or vice versa.
If you want to attempt to debug this then the tool of choice is Dependency Walker. You open the python.exe executable file in Dependency Walker and use the profile menu to start it up with logging of the load events. Somewhere along the way there will be a failure and you'll be able to see which module is causing that failure. That will hopefully point the way towards a resolution.
However, attempting to debug this may be a waste of time. It will probably better to uninstall the existing installation, and try to re-install. Perhaps picking a different Python distribution.
I note that you have selected a 64 bit version. Now, support for 64 bit extension modules is not as strong on 64 bit Python as on 32 bit Python. It does exist, but they modules can be harder to come by and install. You might consider installing a 32 bit Python next time round.
Please make sure that Python3.dll is the same version and the same architecture (32/64) with python.exe. I fixed this error via replacing it with 32bit version.
you should delete the old path of python in "Environment Variables" and enjoy ;)
As janne-karila mentioned, and for Python 3.5, Microsoft Visual Studio 2015 redistributable (in this case the 64 bit version)
This probably won't answer your question, but my answer is for a very specific case when you "Refresh Windows without affecting Files" to fix your Windows 8.1 PC.
If you do that, You'd get this error when you try to run Python after the windows refresh.
To fix this error, simply re-install PY at the same folder where your python was install before you refreshed windows. If you try to install it any other folder like username/appdata/... folder the PY installer would be stuck in initialization.
You may also get another error saying "api-ms-win-crt-runtime-l1-1-0.dll is missing". To fix, go to the windows.old folder and get the dll file ith the above name and paste it in the PY folder. Also like others have suggested, make sure Microsoft Visual Studio 2015 redistributable is installed.
Encountering this error after a windows refresh is so rare, that no one else seemed to have experienced according to google searches, so I though I share it here for that rare unlucky person.
Apparently the error code stands for STATUS_INVALID_IMAGE_FORMAT (source), and it looks like it's not specific to Python. You can try reinstalling the program, rebooting, running CHKDSK /r (source). It might also have something to do with the Microsoft Visual C++ redistributable package, as Janne Karila and this thread suggest.
This stackoverflow question also looks like it has some useful information.
I too faced this problem. So I uninstalled python3 64-bit version and installed 32-bit version, after that i am able to launch python3 in windows 8 successfully. (i have a 64-bit laptop).
Simply, download the last version of Microsoft Visual C++ redistributable package ..
I had the same problem ..
I have the same error found. Using dependency walker, I found tons of DLLs missing. Rather going for copying all the DLLs I went with virtual environment. It will create another environment for Python.
First, install python normally. Copy, the Python.exe path. In my case, it is
C:\Python\python
It will be used to install Python libraries. Then, using command prompt, I used pip to download and install virtualenv (Virtual environment). To do that, change the directory to where pip.exe is, which is in Scripts folder. Now, run the following to install virtualenv:
C:\Python\python pip install virtualenv
It will install Virtual environment.
Now, create a folder to hold virtual environment and change directory to that folder and run to create the following to create an environment:
virtualenv --no-site-packages [environment name]
It will create the Environment.
Now, change subdirectory to Scripts in the [environment name] folder. There is a activate file run it, in my case it is like:
C:\Python\virtualenv\env\Scripts activate
env is the [environment name] here.
If you activate it, every command will look like:
(env) C:\Python\python
This ends here. Now, you can install any python library using this. Do whatever, you want using Python.
Also, to deactivate the environment same deactivate.bat is in the scripts folder.
For me the issue was, I had installed 32 bit version on a 64 bit machine. Hope it helps someone out there.
Like many have said, Windows cannot load python.exe itself or one of its dependent DLLs because of INVALID_IMAGE_FORMAT:
python.exe is of unsupported bitness. 32bit on 64bit Windows is supported. 64bit on 32bit system is not (solution: install 32bit python, bye).
python.exe or one of its DLLs is corrupted (probably not)
one of the dependent DLLs is not of the same bitness as the EXE:
python.exe (say, 32bit) requires python*.dll (python3.dll or python27.dll). It installs that into Windows System32/SysWOW64 folder. The DLL is of correct bitness (32bit).
Something else overwrites that with 64-bit version, or places a 64-bit version somewhere in the search PATH.
When you run python.exe (32bit), Windows searches for python*.dll, and the first one it founds is the 64bit one. 32bit EXEs cannot normally load 64bit DLLs.
Typical examples:
TortoiseHg installs its own copy of python (both .exe and .dll) into its own folder and adds itself to PATH. The bitness can be different (say, 64bit) and usually matches platform bitness.
Another installation of Python with a different bitness somewhere else overwrites the DLL (it shouldn't, they have different System32s, but who knows)
Diagnostics:
Dependency Walker marks 64bit DLLs with 64bit icons. Verify that icons for python.exe and python*.dll match. Right click -> "Show full paths" to see where the DLL is taken from.
Simple solutions:
Maybe you have another, functioning copy of Python somewhere else? Check it.
Reinstall Python, preferably in the platform version (64bit for 64bit OS, 32bit for 32bit) Yeah, that's what many are saying, but now you know why this is needed.
Remove offenders from PATH. While this maaaay fix your Python, this will break the offenders and some (TortoiseHg explorer plugins) need the PATH. So maybe compromise with them and choose #2.
In my case I was installing both the 32 and 64 bit versions of the python msi. They both install to the same folder, c:\python32. I thought msi's would prevent those kinds of conflicts, but no.

Categories