Failure loading py2exe'd program when including pysvn - python

I am attempting to run a py2exe'd program (package.py) that includes pysvn. It is failing to run with the following error:
Traceback (most recent call last):
File "package.py", line 27, in <module>
File "zipextimporter.pyc", line 82, in load_module
File "pysvn\__init__.pyc", line 99, in <module>
File "zipextimporter.pyc", line 98, in load_module
ImportError: MemoryLoadLibrary failed loading pysvn\_pysvn_2_6.pyd
The script runs fine for others in the office, the difference being I'm on Windows 7 x64 with them on WinXP x86. I do have _pysvn_2_6.pyd in my pysvn directory.
Py2exe's "Problems to be Fixed" page has a similar error message with WxPython where it cannot find a needed system module, but I am not using WxPython and I have the dll they refer to anyway.
The py2exe page for "Working with Various Packages and Modules" doesn't refer to pysvn, and I can't find anyone else with similar problems.
I've checked the output of py2exe as outlined by this answer, but my computer seems to have all the binary files required in the correct locations.
EDIT:
I just tried to run other py2exe created programs on this same machine and they failed as well. It seems that the problem is with my machine (ie x64) rather than the specific program I was converting; I get a similar error with another program:
Traceback (most recent call last):
File "rundemo.py", line 13, in <module>
import win32api as w32
File "zipextimporter.pyc", line 98, in load_module
ImportError: MemoryLoadLibrary failed loading win32api.pyd
EDIT2:
I tried the py2exe programs generated from my 64 bit compy on a 32 bit machine, and they failed with the same error. I think I'm generating 32 bit exe's (py2exe docs say 64-bit support is experimental, and I haven't explicitly turned it on), but I'm not sure how to check to be sure.

Install PyWin32.

The py2exe project seems dead, so we rewrote our exes in C++. We can still build for Win7 x64 on our machines, but we couldn't get exe's wrote on Win7 to run on anything older.

Related

Why python software package does not run under WSL2?

I wanted to use WSL2 Ubuntu to run some scientific programs on my PC (Phenix package). It used to work previously on wsl but after recent update to wsl2 one of the programs written in Python has some problems:
Traceback (most recent call last):
File "/mnt/f/cryoEM/phenix-1.18rc4-3812/build/../modules/phenix/wxGUI2/command_line/main.py", line 23, in <module>
run(sys.argv[1:])
File "/mnt/f/cryoEM/phenix-1.18rc4-3812/build/../modules/phenix/wxGUI2/command_line/main.py", line 16, in run
from wxGUI2 import App
File "/mnt/f/cryoEM/phenix-1.18rc4-3812/modules/phenix/wxGUI2/App.py", line 7, in <module>
from SimpleXMLRPCServer import SimpleXMLRPCServer
File "/mnt/f/cryoEM/phenix-1.18rc4-3812/conda_base/lib/python2.7/SimpleXMLRPCServer.py", line 105, in <module>
import BaseHTTPServer
File "/mnt/f/cryoEM/phenix-1.18rc4-3812/conda_base/lib/python2.7/BaseHTTPServer.py", line 102, in <module>
class HTTPServer(SocketServer.TCPServer):
AttributeError: 'module' object has no attribute 'TCPServer'
I have checked all the packages (BaseHTTPServer, SocketServer) and everything seems to be fine. Using python provided with the package and importing modules separately also works without errors. My previous computer also with WSL2 was running this software package without any issues. I believe that there is something missing on the wsl2 Ubuntu level but cannot guess what it is. Do you have any suggestions what I could try to do? Thanks!

MakeHuman no running OpenGL error

I've read all of the same error post on google, checked my python and opengl files then installed more python stuff (showing pertinent to this problem)
python-2.7.12_1
python3.4-3.4.5_1
python3.5-3.5.2_1
python-enum34-1.1.6_1
python3.4-PyQt5-5.6_1
python3.4-PyQt5-opengl-5.6_1
python-PyQt5-opengl-5.6_1
python-numpy-1.11.1_1
and from source
PyOpenGL-3.1.1a1
and I am still getting this error when trying to start mankhuman.py
NUMPY.VERSION: 1.11.1
Traceback (most recent call last):
File "./makehuman.py", line 827, in <module>
main()
File "./makehuman.py", line 817, in main
from mhmain import MHApplication
File "./core/mhmain.py", line 45, in <module>
import mh
File "./lib/mh.py", line 43, in <module>
from glmodule import grabScreen, hasRenderSkin, renderSkin, getPickedColor, hasRenderToRenderbuffer, renderToBuffer, renderAlphaMask
File "./lib/glmodule.py", line 42, in <module>
import OpenGL
ImportError: No module named OpenGL
I am now at a loss as I cannot figure it out.. anyone got an idea that may (will) work?
You need to install the packages that provide the OpenGL libraries. Usually these are included in the development or library packages for your graphics card. It doesn't seem like Void Linux installs dependencies for you, so you'll need to install them yourself, and this will depend on the graphics driver you're using. If you use mesa, install MesaLib-devel. If you use Nvidia, install nvidia-libs. If you use AMD, I don't know what you should install. I'm not familiar with Void Linux so you might need to experiment with variations of the above. Good luck!

Corrupted version of Matlab Engine for python on MacOSX 10.11

I used the Matlab Engine for Python a lot last fall, without any trouble. I just tried to reuse my old code today and I get the following error:
>>> import matlab.engine
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/matlab/engine/__init__.py", line 59, in <module>
raise EnvironmentError('The installation of MATLAB Engine for Python is '
EnvironmentError: The installation of MATLAB Engine for Python is corrupted. Please reinstall it or contact MathWorks Technical Support for assistance.
I am on MacOSX 10.11 (El Capitan), using Python 2.7 and Matlab 2015a. I reinstalled the Matlab Engine twice already, but no difference, I still get the same error.
Looking at the ini.py file, it seems that the line that fails is the following, yielding the error copied here:
>>> pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: dlopen(/Applications/MATLAB_R2015a.app/extern/engines/python/dist/matlab/engine/maci64/matlabengineforpython2_7.so, 2): Library not loaded: #rpath/libpython2.7.dylib
Referenced from: /Applications/MATLAB_R2015a.app/extern/engines/python/dist/matlab/engine/maci64/matlabengineforpython2_7.so
Reason: image not found
I have read a similar question where the answers pointed towards an issue with the libpython2.7.dylib HERE but I'm not sure I understand the solution. I can see the libpython2.7.dylib file in my /usr/lib/ folder.
Based on THIS LINK, it seems like a possible issue is that MacOSX 10.11 requires Matlab 2015b or higher. However, Matlab 2015a works fine on my computer right now, so I'm not sure why the Engine wouldn't.

GDB pretty printing ImportError: No module named 'printers'

I'm trying to add pretty printing for STL in my GDB on Ubuntu 14.04. Some details on the tools:
OS: Ubuntu 14.04
gdb version: 7.7
python version: 2.7.6
python3 version: 3.4.0
But after I setup exactly as what the instruction said. I still get the following errors:
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "/home/jerry/myLib/gdb_stl_support/python/libstdcxx/v6/__init__.py", line 19, in <module>
from printers import register_libstdcxx_printers
ImportError: No module named 'printers'
/home/jerry/.gdbinit:6: Error in sourced command file:
Error while executing Python code.
Reading symbols from main...done.
Then I haved double checked my pretty printing installation directory. Under the directory /home/jerry/myLib/gdb_stl_support/python/libstdcxx/v6/, I can clearly see I have the printers.py file. And I also view the content of printers.py, I'm sure it also has the register_libstdcxx_printers class. Why the python interpreter is still complaining the printers module is missing? This seems really strange to me.
I just tried something myself, and luckily, now it's working. At least it can print out the map and vector content as expected. Here is what I did:
Since it's complaining that it can't find the printer.py module, then I think should probably I tell python interpreter where this file is located. So I first added this extra line to my ~/.gdbinit:
sys.path.append("/home/jerry/myLib/gdb_stl_support/python/libstdcxx/v6")
(After the line sys.path.insert(0, '/home/jerry/myLib/gdb_stl_support/python') )
Then running gdb again, I got the following error:
Traceback (most recent call last):
File "<string>", line 5, in <module>
File "/home/jerry/myLib/gdb_stl_support/python/libstdcxx/v6/printers.py", line 1247, in register_libstdcxx_printers
gdb.printing.register_pretty_printer(obj, libstdcxx_printer)
File "/usr/share/gdb/python/gdb/printing.py", line 146, in register_pretty_printer
printer.name)
RuntimeError: pretty-printer already registered: libstdc++-v6
/home/jerry/.gdbinit:7: Error in sourced command file:
Error while executing Python code.
Given the error information, I edited the ~/.gdbinit file and commented the line register_libstdcxx_printers (None).
And then after running gdb, it works.
But I'm still wondering if directory in sys.path is searched recursively? I mean in my mind, the python interpreter should work like this: once you have added one directory to sys.path, then the subdirectory under that directory will also get searched for a module file.

How to package psutil with py2exe?

The app is working fine on my development win8 environment, but when it is packaged with py2exe and run on the production machine it throw the exception:
"The procedure entry point RtlIdnToAscii could not be located in the dynamic link library ntdll.dll"
The detail content of the log file is
Traceback (most recent call last):
File "DataviewerBackupRestorer.py", line 6, in <module>
File "RestorController.pyc", line 7, in <module>
File "psutil\__init__.pyc", line 136, in <module>
File "psutil\_psmswindows.pyc", line 14, in <module>
File "_psutil_mswindows.pyc", line 12, in <module>
File "_psutil_mswindows.pyc", line 10, in __load
ImportError: DLL load failed: The specified procedure could not be found.
It seems that a dll required by psutil is missing during the package process. I have tried to add the py2exe options with
py2exe_options = {"py2exe":{"includes":['decimal', '_mssql', 'uuid', 'psutil', '_psutil_mswindows']}}
But it is not working. Any ideas? Thanks in advance!
The solution is to remove System DLLs from the project directory. When I added psutil to my application py2exe added a lot of system DLLs to my project. It worked correctly on my and some other computers, but failed on another one. Removing from the project the .dll files that were available in C:\Windows\System32 solved the issue.
Finally in my case the solution was to add:
'dll_excludes': [ "IPHLPAPI.DLL", "NSI.dll", "WINNSI.DLL", "WTSAPI32.dll"]
into the py2exe options in setup.py file.

Categories

Resources