wxpython and py2exe not working - python-2.7

I am having lots of trouble trying to compile a wxpython application into an exe file. py2exe keeps giving me errors and won't compile my code to an exe. The following is what happens when I run a simple setup.py script. I am on windows 64 bit and python 2.7 and using py2exe 64 bit. (bundling does not work in 64 bit py2exe. not sure if that poses a problem) I believe I have all the right DLLs installed since I have microsoft visual studio installed. Any help would be appreciated.
*** searching for required modules ***
*** parsing results ***
creating python loader for extension 'P4API' (C:\Python27\lib\site-packages\P4AP
I.pyd -> P4API.pyd)
creating python loader for extension 'wx._misc_' (C:\Python27\lib\site-packages\
wx-2.8-msw-unicode\wx\_misc_.pyd -> wx._misc_.pyd)
creating python loader for extension 'select' (C:\Python27\DLLs\select.pyd -> se
lect.pyd)
creating python loader for extension 'unicodedata' (C:\Python27\DLLs\unicodedata
.pyd -> unicodedata.pyd)
creating python loader for extension 'wx._windows_' (C:\Python27\lib\site-packag
es\wx-2.8-msw-unicode\wx\_windows_.pyd -> wx._windows_.pyd)
creating python loader for extension 'wx._core_' (C:\Python27\lib\site-packages\
wx-2.8-msw-unicode\wx\_core_.pyd -> wx._core_.pyd)
creating python loader for extension 'wx._gdi_' (C:\Python27\lib\site-packages\w
x-2.8-msw-unicode\wx\_gdi_.pyd -> wx._gdi_.pyd)
creating python loader for extension 'wx._controls_' (C:\Python27\lib\site-packa
ges\wx-2.8-msw-unicode\wx\_controls_.pyd -> wx._controls_.pyd)
creating python loader for extension 'bz2' (C:\Python27\DLLs\bz2.pyd -> bz2.pyd)
*** finding dlls needed ***
Traceback (most recent call last):
File "setup.py", line 4, in <module>
setup(windows=['PerforceApp.py'])
File "C:\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 243, in run
self._run()
File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 305, in _run
dlls = self.find_dlls(extensions)
File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 389, in find_dl
ls
self.dll_excludes)
File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 1064, in find_d
ependend_dlls
bin_depends(loadpath, images + [sys.executable], excludes_use)
File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 1441, in bin_de
pends
if isSystemDLL(dll):
File "C:\Python27\lib\site-packages\py2exe\build_exe.py", line 1498, in isSyst
emDLL
raise Exception, "Seems not to be an exe-file"
Exception: Seems not to be an exe-file

I had the same problem that was caused by the "MSVCP90.dll" file, so i added this directive to my setup.py and now it works like a charm!
dll_excludes = ['MSVCP90.dll']

Related

pyinstaller importing scipy module

A little python script that uses the scipy module executes perfectly, but when a stand-alone executable is compiled with pyinstaller the executable fails. Details:
Windows 10 python 2.7.10 pyinstaller 3.3.1
The error message is:
C:\Users\barry\Desktop\Testing>TestScipy
Traceback (most recent call last):
File "TestScipy.py", line 15, in <module>
from scipy import stats
File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 396, in load_module
exec(bytecode, module.__dict__)
File "site-packages\scipy\stats\__init__.py", line 343, in <module>
File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 396, in load_module
exec(bytecode, module.__dict__)
File "site-packages\scipy\stats\stats.py", line 169, in <module>
File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 396, in load_module
exec(bytecode, module.__dict__)
File "site-packages\scipy\special\__init__.py", line 640, in <module>
File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 687, in load_module
module = imp.load_module(fullname, fp, filename, ext_tuple)
ImportError: DLL load failed: The specified module could not be found.
[9476] Failed to execute script TestScipy
How can I ensure that pyinstaller loads scipy correctly?
You can add scipy.stats to the hiddenimports list in the .spec file and run PyInstaller again (pyinstaller myfile.spec). Or you could add the following option to your PyInstaller command:
pyinstaller [options] --hiddenimport=scipy.stats myfile.py
The problem with pyinstaller finding scipy.stats turns out to depend on the Python installation used:
Mac OSX: the native python in 10.13 does not exhibit the problem.
Windows 10: Using Anaconda python eliminates the problem.
Ubuntu Linux 16.10: Using Anaconda python eliminates the problem.

IOError: No suitable library found for xls

Working on a project that uses pyexcel to read and write .xls files which is compiled using py2exe.
I get this error after compiling and confirming that pyexcel, pyexcel-io and pyexcel-xls are in the library.zip folder.
Traceback (most recent call last):
File "FundDatabase.pyo", line 391, in get_worksheet
File "pyexcel\core.pyo", line 118, in get_book
File "pyexcel\core.pyo", line 137, in _get_book
File "pyexcel\sources\file_source_input.pyo", line 52, in get_data
File "pyexcel_io\io.pyo", line 31, in get_data
File "pyexcel_io\io.pyo", line 118, in load_data_new
File "pyexcel_io\manager.pyo", line 94, in create_reader
File "pyexcel_io\manager.pyo", line 89, in _get_a_handler
IOError: No suitable library found for xls
here is my project library
Short Answer
You will need to tell pyinstaller about the hidden imports about pyexcel-xls.
In order to package pyexcel-xls, you need to specify:
--hidden-import pyexcel_xls
--hidden-import pyexcel_xls.xlsr
--hidden-import pyexcel_xls.xlsw
Reference: mechanism of dynamic load module, confilict with pyinstaller/cx_freeze's execution
Long Answer
Since version 0.5.0, pyexcel uses lazy loading, which creates a problem for pystaller because not all modules are loaded on program's startup. Hence, you will need to tell pyinstaller about the missing imports(a.k.a hidden imports).
Pyinstaller notes
http://pyexcel.readthedocs.io/en/latest/pyinstaller.html
http://pyexcel-io.readthedocs.io/en/latest/pyinstaller.html

Running Tensorflow example for RNNs

I'm trying to run a code as described here.
I have a anaconda enviroment with tensorflow installed via pip installation.
When trying to run the example on the link provided I have a issue. The first one was that the file:ptb_word_lm.py wasn't present on my installation. I just copied the file from github and tried to run anyway. I got the following error when running python ptb_word_lm.py --data_path=/tmp/simple-examples/data/ --model small
error message:
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:105] Couldn't open CUDA library libcudnn.so. LD_LIBRARY_PATH: /lib/x86_64-linux-gnu:/home/danielmoreira/anaconda2:/home/danielmoreira/anaconda2/lib:/usr/local/cuda-7.5/lib64:
I tensorflow/stream_executor/cuda/cuda_dnn.cc:3448] Unable to load cuDNN DSO
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally
Traceback (most recent call last):
File "ptb_word_lm.py", line 361, in <module>
tf.app.run()
File "/home/danielmoreira/anaconda2/envs/tensorenv/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 30, in run
sys.exit(main(sys.argv[:1] + flags_passthrough))
File "ptb_word_lm.py", line 321, in main
train_input = PTBInput(config=config, data=train_data, name="TrainInput")
File "ptb_word_lm.py", line 85, in __init__
self.input_data, self.targets = reader.ptb_producer(
AttributeError: 'module' object has no attribute 'ptb_producer'
I have found people on google suggesting to change the line from tensorflow.models.rnn.ptb import reader to just import reader, but it doesn't seem to work for me.
Does anyone know the possible solution?
I'm using Python 2.7.12 and Tensorflow version seems to be 0.11.0rc2

virtualenv is not compatible with this system or executable

I am rather new to Linux (Ubuntu) and installing (Python) packages. I'm having trouble with mkvirtualenv and can not solve it:
~$ mkvirtualenv mysite70
New python executable in mysite70/bin/python
Traceback (most recent call last):
File "/usr/lib/python2.7/site.py", line 562, in <module>
main()
File "/usr/lib/python2.7/site.py", line 544, in main
known_paths = addusersitepackages(known_paths)
File "/usr/lib/python2.7/site.py", line 271, in addusersitepackages
user_site = getusersitepackages()
File "/usr/lib/python2.7/site.py", line 246, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/usr/lib/python2.7/site.py", line 236, in getuserbase
USER_BASE = get_config_var('userbase')
File "/usr/lib/python2.7/sysconfig.py", line 577, in get_config_var
return get_config_vars().get(name)
File "/usr/lib/python2.7/sysconfig.py", line 476, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/usr/lib/python2.7/sysconfig.py", line 355, in _init_posix
raise IOError(msg)
IOError: invalid Python installation: unable to open /home/sietse/.virtualenvs/mysite70/local/include/python2.7/pyconfig.h (No such file or directory)
ERROR: The executable mysite70/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/home/usr/.virtualenvs' (should be u'/home/usr/.virtualenvs/mysite70')
ERROR: virtualenv is not compatible with this system or executable
Did I install something wrong?
This is likely a permissions error with your current logged in user on the Linux machine.
Try
sudo mkvirtualenv mysite70
This will often prompt for the password of the root user.
If that does not work, you may want to look at the article below:
http://noelusion.com/2013/Fixing-the-mysterious-virtualenv-error-IOError-invalid-Python-installation/
But note, that the article is a hack on a fairly specific instance.
I think I messed up the installation. I reinstalled Ubuntu, virtualenv etc. It works fine now.
Make sure your username has accents or special characters. If yes, change directory creating environments creating an environment variable WORKON_HOME with value equal to the new path. Ex .: C:\Envs

Appcelerator Titanium wont build projects (after time machine restore)

Ti.SDK 1.6.2
iOS 4.3
I recently got a new system and built it off of a time machine backup of my old system.
When I try to compile and run any app in the simulator I'm getting the following error returned to the console.
[INFO] One moment, building ...
Traceback (most recent call last):
File "/Library/Application Support/Titanium/mobilesdk/osx/1.6.2/iphone/builder.py", line 1342, in <module>
main(sys.argv)
File "/Library/Application Support/Titanium/mobilesdk/osx/1.6.2/iphone/builder.py", line 505, in main
link_version = check_iphone_sdk(iphone_version)
File "/Library/Application Support/Titanium/mobilesdk/osx/1.6.2/iphone/builder.py", line 48, in check_iphone_sdk
output = run.run(["xcodebuild","-showsdks"],True,False)
File "/Library/Application Support/Titanium/mobilesdk/osx/1.6.2/iphone/run.py", line 7, in run
proc = subprocess.Popen(args, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 595, in __init__
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1106, in _execute_child
OSError: [Errno 2] No such file or directory
It worked fine yesterday on the old system. I ran a backup before transferring and then installed the new system off of the most recent backup. Not sure why it would work on the old system and not the new.
I ended up reinstalling xcode as the error referenced python. This solved the problem.
try deleting everything in build/iphone. Do NOT delete the build/iphone directory, just everything IN it. Restart Ti Studio and rebuild.