pySide: ExtensionLoader_Pyside_QtGUI.py specified module could not be found - python

I'm using CXFreeze with PySide (QT). I get an error:
cx_Freeze: Python error in main script.
myscript.py line 33, in
File ExtensionLoader_Pyside_QtGUI.py, line 11, in
Import Error: DLL load failed: The specified module could not be found
When running a fresh install of Windows server 2008.
I'm running the frozen EXE package (with the folder). It seems to work on my own system and other systems. What might be the issue?
After reading, online, I tried to replace the Qt4Gui file, but this didn't solve the issue.
Python version is 2.7

Based on your Import Error: DLL load failed it is most likely an installation issue causing the missing DLL. To figure our exactly which DLL you are missing, use http://www.dependencywalker.com/ Run the .exe and open the .pyd file for File ExtensionLoader_Pyside_QtGUI.py and it will show you exactly which DLL's are missing and more importantly the locations where they should be. You can probably then track down the missing DLL online.

there are known issues with pyside 1.2.0 and cxFreeze. All should be fixed in development version (available on git repo). Please build the PySide from latest sources yourself or wait for PySide version 1.2.1. Build instructions are here [1].
[1] https://github.com/PySide/pyside-setup#building-pyside-on-a-windows-system

I used Py2exe instead of CXFreeze and it worked perfectly.
Also, apparently Python requires the MS Visual C++ Dependency Files:
http://www.microsoft.com/en-us/download/details.aspx?id=29
So any bundling needs that as well, if it's a fresh install. (Although I think they are now bundled with newer Windows versions.)
Other Notes:
In my experience, sometimes you should try CXFreeze, Py2EXE and PyInstaller quickly and see if one works best. As ideal as CXFreeze is re: cross platform, it just isn't going to happen perfectly.
Also, while I don't know if this was a factor, I set up a Windows 2000 Pro virtual machine and ran Py2exe on that. That was to ensure compatibility for all older Windows versions, and seemed to work well. (NOTE: Many things won't even run on Win2000 anymore so be careful that your other tools and libraries will run on it.)
Finally, be extra careful to match the bit level (32 vs 64) of all your libraries, and your Python install itself. If you have 32-bit python, ensure that your PySide, CXFreeze and any other libraries you use are 32-bit. (Or 64-bit if you're using 64-bit python.)

Related

pyinstaller GLIBC_2.25 not found, however another script works

I created an executable out of a simple Python script, using pyinstaller on Ubuntu 18.04, and tested it in a different computer (also with Ubutnu 18) and worked perfectly.
However when trying the same with a more complex script (more library imports) the executable fails in the other computer with the error
ImportError: /lob/x86_64-linux-gnu/libc.so.6: version 'GLIBC_2.25' not found
This can't be a Python incompatibility (see https://github.com/pyinstaller/pyinstaller/issues/4758), as the other script did work fine. So it most probably is based on some of the libraries the second script imports.
How can I include the libraries imported in the executable made by Pyinstaller (if that is even the origin of this error)?
Solution A
I have not confirmed this solution, but it sometimes helps. Delete directories ./build and ./dist, then try creating the executable again with pyinstaller.
Solution B
The solution, for me at least, is to build your executable on an older version of your OS.
I was seeing the same error.
ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /tmp/_MEIjdcWu4/./libX11.so.6)
[32614] Failed to execute script 'test_executable' due to unhandled exception!
I built my exectuable with Pyinstaller on Ubuntu 22.04. Then I copied and ran the executable on the older Ubuntu 20.04 and the error was encountered.
Per the comment below, this might be a compatibility issue where the executable built on a newer OS is not compatible with older OSs.
"For what is worth, the issue could be that the libraries bundled with
the built program conflict with the system libraries, preventing the
DRI driver from properly loading.
The culprit could be either standard c/c++ libraries (libgcc_s.so.1,
libstdc++.so.6) or maybe the X11 libraries (libX11.so.6, libXau.so.6,
libXdmcp.so.6, libXext.so.6, `libXrender.so.1˙). Perhaps more likely
former than the latter.
For example, if libstdc++.so.6 on the build system is older than the
one used by the target system, then the non-bundled libraries will
fail to load due to missing symbols (which are present in the newer,
system version of the library, but not in the bundled one). This is
actually quite a common issue with binary-only software on linux,
especially on more bleeding edge distributions. In those cases,
removing the bundled version of the offending library may help.
(You have a similar issue with system libgvfsdbus.so, which is missing
a symbol that is not available in the bundled libglib-2.0.so.0, which
is probably older than the glib library available on the system)."
Source:
https://github.com/cryptoadvance/specter-desktop/issues/373#issuecomment-694476451

How to compile and package a python file into an execution file under windows 64bit

Recently, I started to use theano to do some basic BP network. The theano was installed and my network based on theano works well in my PC.
In order to share my code among my colleagues, I am looking for a method to package the theano python file to one execution file which can be run under windows without python environment.
I am trying py2exe to finish the packaging work and I found that, the packaged exe can only work in my PC. When I copy the exe to other PCs without python, it does not work. Only warning message is giving as:
“WARNING (theano.configdefaults): g++ not detected !
Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.”
My working environment is:
Win10 64bit + Anaconda2
Could anyone give me some advice to generate the exe file based on theano python file?
Thank you a lot.
Try PyInstaller
PyInstaller is a program that freezes (packages) Python programs into stand-alone executables, under Windows, Linux, Mac OS X, FreeBSD, Solaris and AIX.
I use cxFreeze to convert my Python scripts to .exe Its a really good module. You can see its working here.

Python, cairo and distutils

I just fixed a bug in a two year old python program and now I'm having big trouble getting it to compile again. I simply cannot get Python, Cairo, wx and distutils to work together.
On OSX I managed to get Python 2.7 to import Cairo and WX but py2app does not work. The error is something about unknown architecture.
On Windows 7 I have not been able to successfully import cairo. I installed py2cairo and put the libcairo-2.dll in Windows/System32 but still get an import error. I even copied msvcr90.dll to System32 but still no luck.
Does anyone have a combination of Python, wx, Py2cairo, Cairo and distutils that just works? I need Python 2.6 or 2.7 32 bit on OSX and Windows.
I got it to work on OSX by installing an older version of XCode form the SnowLeopard DVD.
You also have to be very careful with paths to data files because py2app puts everything into a zip file.
py2exe was worse because it did not copy dynamically loaded modules and one dependency from pytz into the repo and needed some ugly hacks in setup.py.
I ended up using cairo-1.10.2, libpng-1.2.49 and pixman-0.20.2

Can't install pywin32..?

I tried to install pywin32 via the 32 bit python 2.6 msi installer and got this error:
I have no idea why, so I went and installed python 2.7 and tried again with the pywin32 2.7 installer and got an error that amounted to another error (Sorry for not being more specific, but python 2.7 is now gone from my computer. The error was incredibly vague and had "Error:" and then no more text after it if I recall correctly).
I can't figure out what this error means, however. I wanted to use pyinstaller but it requires pywin32, so after I couldn't install pywin32 I tried py2exe and got this error:
*** finding dlls needed ***
error: pywintypes26.dll: No such file or directory
So I'm pretty sure I need pywin32. Anyone have any ideas?
I don't know the cause, but I got the same error (only with different line numbers, maybe from a different version of pywin32), and this fix worked for me, installing on windows 7:
Extract the installer file to a directory using the free 7zip (or similar) program
Copy everything in the PLATLIB directory to C:\Python26\Lib\site-packages
Open a command prompt to the SCRIPT directory and type:
python pywin32_postinstall.py -install
You must have Python already installed (perhaps obviously) and in your windows PATH environment variable for this to work. You can also try the testall script in that PLATLIB directory (though for me, that hung). After doing this, I was able to import pywin32 modules from the Python IDLE just fine.
(Trying to run the installer in compatibility mode didn't solve this for me.)
I did the following and worked for version 2.7 (I did not try 3.0 and up, but it should work too):
Move the .exe file into the platlib (C:\Python27\Lib\site-packages)
Run as admin the .exe file and you should be Good :)
If you want to check if it worked just do: import win32api and run it.
As of when I wrote this (Feb'12), IMO Python 2.5 is the most stable version of Python on Windows. I suggest you try re-installing everything on Python 2.5. I use it on Windows 7 and I don't have any issues whatsoever

PyQt 4.7 - ImportError after installing on Windows

I've been trying to install PyQt 4.7 on Vista, but I am getting an ImportError when I try to do: from PyQt4 import QtCore, QtGui.
ImportError: DLL load failed: The specified module could not be found.
I've checked my System Path, and C:\Python31\Lib\site-packages\PyQt4\bin is on there.
I can't run any of the examples, but the Designer, Assistant and Linguist run fine.
I am using ActivePython 3.1, if that makes any difference. And I haven't had any previous version of PyQt installed.
Edit:
I've copied the QtCore4 and GtGui4 dlls to C:\Python31\Lib\site-packages\PyQt4. That fixes some of the examples, but I still can't use the example browser.
Are you sure there is a \bin directory for your version of PyQt?
I am running PyQt 4.4, and all my binaries are right in:
C:\Python31\Lib\site-packages\PyQt4
Which is what I have my path pointing too.
It sounds like PyQt4 was installed improperly... did you run this?
python setup.py install
There shouldn't be a bin there...
Just wanted to chime in that I had the same problem on a WinXP install of:
python 2.7
Qt 4.7.1 (10.05)
PyQt 4.8.1
I used the windows installer version of all 3 of those items.
Copying the contents of the C:\Python27\Lib\site-packages\PyQt4\bin folder up to the main PyQt folder (C:\Python27\Lib\site-packages\PyQt4) stopped the 'dll not found' errors that python was throwing.
Also chiming in. I installed both python 2.6 and PyQt 4.8.3 on a Windows 7 machine using the windows installers (I did NOT run 'python setup.py install').
I tried to run spyder (which requires PyQt 4.4 or greater) and failed because it couldn't find the PyQt .dlls. I copied all the .dlls from the \Lib\site-packages\PyQt4\bin folder to the \Lib\site-packages\PyQt4 folder, and spyder launches just fine.
PyQt installation also depends on the version of python installed on your platform.Python3.+ is incompatible with Python version < 3.x.
I was facing the same problem as I have Python 2.7 installed on my machine but I downloaded the latest binary which was PyQt-Py3.2-x86-gpl-4.9.exe. If you see here the binary has python version also mentioned in name after PyQt which is Py3.2. I uninstalled PyQt and installed PyQt-Py2.7-x86-gpl-4.9.exe which points to Python 2.7 and it fixed the problem.
Probably they could have mentioned the naming convention online or in some documentation to be more simpler.
I had the same problem. I got my program running from within Eclipse but when I tried running it directly from the command line I still got the same error.
I solved it by renaming the C:\Users\Me\AppData\Roaming\Python\Python27\site-packages\PyQt4 directory. (I'm guessing leftovers from a previous PyQt install)
I am using ActivePython.
I think there are at least two possible error conditions
1. ImportError: DLL load failed: The specified module could not be found.
then you have to check your PyQT version is comptible with your python. In other words, if you use python 3.3, then you can only use PyQT for python3.3 and python 3.3 will not work with PyQT for python3.4
This was the problem I met. I solved it with re-install it
2. Import Error: DLL load failed: %1 then something strange on a different encoding Win32.
then it would be a OS problem. If you use 32bit Python then you have to use 32bit PyQt, so do 64bit
Here's how I could fix those errors on Windows 7:
Get the PyQt4 wheel from
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt4.
Make sure that the version is exactly the same as your Python version (i.e. Python 3.3 doesn't work with PyQT for Python 3.4). Also make sure to download the 64bit version if you are on a 64bit machine and vice versa.
Extract the wheel with 7zip
Rename the PyQt4-4.11.4.data (or similar) directory to PyQt4
Go to PyQt4\purelib\PyQt4\ and move everything to the root PyQt4 folder. You can delete the purelib folder now
Copy the whole PyQt4 folder to your Python interpreters 'site-packages' folder (e.g. C:\Python34\Lib\site-packages)
Go to PyQt4\data\Lib\site-packages and move all the files to C:\Python34\Lib\site-packages\
In my case I needed MSVCP140.dll. I have solved this problem by dowloading Visual C++ Redistributable for Visual Studio 2015:
https://www.microsoft.com/en-us/download/details.aspx?id=48145
Got this solution from MSVCP140.dll missing
I am using Pyqt4 and Python 3.6 in Windows7.

Categories

Resources