PyInstaller / QtQuick: Could not find qmake version 5.x - python

Windows 10, Python 3.5, PyQt5 is installed via Pip, pyinstaller 3.2.1 also installed via Pip. I can make a little PyQt5 qml app that works fine when run normally under Python.
If I have a Python module called test.py that contains:
from PyQt5.QtWidgets import QApplication
from PyQt5.QtQuick import QQuickView
and do:
pyinstaller main.py
I get:
3452 ERROR: Could not find qmake version 5.x, make sure PATH is set correctly or try setting QT5DIR.
3452 ERROR: Cannot find QT_INSTALL_QML directory, "qmake -query QT_INSTALL_QML" returned nothing
followed by:
Traceback (most recent call last):
File "C:\Python35\Scripts\pyinstaller-script.py", line 11, in <module>
load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')()
File "c:\python35\lib\site-packages\PyInstaller\__main__.py", line 90, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\python35\lib\site-packages\PyInstaller\__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\python35\lib\site-packages\PyInstaller\building\build_main.py", line 788, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\python35\lib\site-packages\PyInstaller\building\build_main.py", line 734, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "c:\python35\lib\site-packages\PyInstaller\building\build_main.py", line 212, in __init__
self.__postinit__()
File "c:\python35\lib\site-packages\PyInstaller\building\datastruct.py", line 161, in __postinit__
self.assemble()
File "c:\python35\lib\site-packages\PyInstaller\building\build_main.py", line 470, in assemble
module_hook.post_graph()
File "c:\python35\lib\site-packages\PyInstaller\building\imphook.py", line 409, in post_graph
self._load_hook_module()
File "c:\python35\lib\site-packages\PyInstaller\building\imphook.py", line 390, in _load_hook_module
attr_value = sanitizer_func(attr_value)
File "c:\python35\lib\site-packages\PyInstaller\building\utils.py", line 466, in format_binaries_and_datas
src_root_path_or_glob))
FileNotFoundError: Path or glob "Qt" not found or matches no files.
If I comment out the second line from test.py (the one about QtQuick) PyInstaller succeeds.
I can't make the path point to qmake because I don't have qmake on my machine. I don't really understand why I need qmake?

With Python 3.4.4 and PyQt5 5.5.1 (from https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.5.1/ - I think this is the last PyQt5 for 3.4) and PyInstaller 3.2.1 this all works fine out of the box.
The difference I think is that the PyQt5 directory structure under Lib\site-packages\PyQt5 is very different between 3.4 and 3.5 and I guess PyInstaller isn't coping with that yet. In particular, Python34 has the Qt5 binaries (Qt5Core.dll etc) in the root of Lib\site-packages\PyQt5 whereas in Python35 they end up tucked away under Lib\site-packages\PyQt5\Qt\bin. There are a lot of other differences too.
Anyway, the easy answer is therefore use Python34 / PyQt5.5.1. FWIW I have sort of got it working with Python35 and latest PyQt5 (5.8.1), but it's a bodge. I have both Python34 and Python35 installed, and the following (in this order) in my Windows path:
C:\Python35\
C:\Python35\Scripts\
C:\Python35\Lib\site-packages\PyQt5\Qt\bin
C:\Python34\Lib\site-packages\PyQt5
The Python34 line has to be there otherwise we get the Could not find qmake version 5.x stuff, and the Python35\Lib\site-packages\PyQt5\Qt\bin path being above that seems to make it pick up the correct binaries.
Doing this, pyinstaller reports success, but when I run I get a failure about Cannot load library ... dist\main\qml\QtQuick\Controls\qtquickcontrolsplugin.dll: The specified procedure could not be found. This can be solved by manually copying over Python35\Lib\site-packages\PyQt5\Qt\qml\QtQuick\Controls\qtquickcontrolsplugin.dll to dist\main\qml\QtQuick\Controls. After that my app runs as expected.
I haven't found a way to make pyinstaller pick up the correct qtquickcontrolsplugin.dll automatically.
I guess leaving C:\Python34\Lib\site-packages\PyQt5 in the path it's probably picking up some other wrong files from Python34, and if that's the case you can copy them over manually or try to fiddle with paths etc. to try to make the right thing happen, but I'm just going to use Python34 until PyInstaller gets fixed.

I had the same issue as you.
But, today it's work with this patch: https://github.com/pyinstaller/pyinstaller/pull/3233#issuecomment-362094587

Related

Pyftdi - ValueError: No Backend Available. Is there any troubleshooting for fixed this error abour windows 10?

I'm creating .exe file with pyinstaller, when I run the created .exe file , the error is shown in the console:
ValueError: No backend available.
In develop I don't have this problem.
I found that copying the libusb-1.0.dll file to C:\Windows\System32 or C:\Windows\SysWOW64 should work, but this does not work for me.
another solution is download and install libusb-win32-devel-filter-1.2.6.0.exe. It does not work for me either.
I'm using Python 3.7 and import library pyftdi
from pyftdi.spi import SpiController, SpiIOError
Any idea what else can I do?
Actual results in my console is:
File "site-packages\pyftdi\spi.py", line 319, in configure
File "site-packages\pyftdi\ftdi.py", line 471, in open_mpsse_from_url
File "site-packages\pyftdi\ftdi.py", line 309, in get_identifiers
File "site-packages\pyftdi\usbtools.py", line 342, in parse_url
File "site-packages\pyftdi\ftdi.py", line 390, in find_all
File "site-packages\pyftdi\usbtools.py", line 58, in find_all
File "site-packages\pyftdi\usbtools.py", line 231, in _find_devices
ValueError: No backend available
Failed to execute script view
The same problem had also baffled me for quite a while until I found by searching the talks happened there. It might help you.
Essentially, a walkaround is to use --add-binary command option to add libusb0.dll from system32 directory to dist directory of the pyinstaller output.
Use --add-binary command to make libusb0.dll in the .exe file. My cmd is like this:
pyinstaller -F -w main.py --add-data "libusb0.dll;."

Pyinstaller - ImportError: No system module 'pywintypes' (pywintypes27.dll)

I am trying to package my python script into an executable. I thought I would be pretty straight forward as I don't have very many imports. First off here are my imports:
from __future__ import print_function
from netCDF4 import Dataset
import numpy as np
import os
from progressbar import Percentage,Bar,ETA,ProgressBar,RotatingMarker
I know for a fact that numpy is supported I'm not sure about __future__ or os and I know for sure that netCDF4 and progressbar are not supported. I am using pyinstaller version 2.1 on Python 2.7.7 for Windows 7, and here is the command I use to start creating .exe:
C:\Users\Patrick\Desktop\netcdf_grid_extraction>pyinstaller --onefile --hidden-i
mport=netCDF4 --hidden-import=progressbar netcdf_grid_extraction.py
Here is a list of errors. There seems to be one major problem with not being able to find the module pywintypes.dll, as well as two assemblies related to amd64_Microsoft. Here is a list of the 4 errors I get. How can I go about solving these?
1
1130 INFO: Searching for assembly amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.
21022.8_none ...
1134 WARNING: Assembly not found
1134 ERROR: Assembly amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none
not found
1210 INFO: Searching for assembly amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.
21022.8_none ...
1210 WARNING: Assembly not found
1210 ERROR: Assembly amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none
not found
2
Traceback (most recent call last):
File "<string>", line 11, in <module>
File "C:\Users\Patrick\Anaconda\lib\site-packages\pythoncom.py", line 2, in <m
odule>
import pywintypes
File "C:\Users\Patrick\Anaconda\lib\site-packages\win32\lib\pywintypes.py", li
ne 124, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Users\Patrick\Anaconda\lib\site-packages\win32\lib\pywintypes.py", li
ne 98, in __import_pywin32_system_module__
raise ImportError("No system module '%s' (%s)" % (modname, filename))
ImportError: No system module 'pywintypes' (pywintypes27.dll)
4155 INFO: Processing hook hook-pywintypes
Traceback (most recent call last):
File "<string>", line 11, in <module>
File "C:\Users\Patrick\Anaconda\lib\site-packages\pythoncom.py", line 2, in <m
odule>
import pywintypes
File "C:\Users\Patrick\Anaconda\lib\site-packages\win32\lib\pywintypes.py", li
ne 124, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Users\Patrick\Anaconda\lib\site-packages\win32\lib\pywintypes.py", li
ne 98, in __import_pywin32_system_module__
raise ImportError("No system module '%s' (%s)" % (modname, filename))
ImportError: No system module 'pywintypes' (pywintypes27.dll)
3
5840 INFO: Searching for assembly amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.
21022.8_none ...
5840 WARNING: Assembly not found
5840 ERROR: Assembly amd64_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none
not found
4
Traceback (most recent call last):
File "C:\Users\Patrick\Anaconda\Scripts\pyinstaller-script.py", line 9, in <mo
dule>
load_entry_point('PyInstaller==2.1', 'console_scripts', 'pyinstaller')()
File "C:\Users\Patrick\Anaconda\lib\site-packages\pyinstaller-2.1-py2.7.egg\Py
Installer\main.py", line 88, in run
run_build(opts, spec_file, pyi_config)
File "C:\Users\Patrick\Anaconda\lib\site-packages\pyinstaller-2.1-py2.7.egg\Py
Installer\main.py", line 46, in run_build
PyInstaller.build.main(pyi_config, spec_file, **opts.__dict__)
File "C:\Users\Patrick\Anaconda\lib\site-packages\pyinstaller-2.1-py2.7.egg\Py
Installer\build.py", line 1924, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
File "C:\Users\Patrick\Anaconda\lib\site-packages\pyinstaller-2.1-py2.7.egg\Py
Installer\build.py", line 1873, in build
execfile(spec)
File "C:\Users\Patrick\Desktop\netcdf_grid_extraction\netcdf_grid_extraction.s
pec", line 17, in <module>
console=True )
File "C:\Users\Patrick\Anaconda\lib\site-packages\pyinstaller-2.1-py2.7.egg\Py
Installer\build.py", line 1170, in __init__
strip_binaries=self.strip, upx_binaries=self.upx,
File "C:\Users\Patrick\Anaconda\lib\site-packages\pyinstaller-2.1-py2.7.egg\Py
Installer\build.py", line 1008, in __init__
self.__postinit__()
File "C:\Users\Patrick\Anaconda\lib\site-packages\pyinstaller-2.1-py2.7.egg\Py
Installer\build.py", line 309, in __postinit__
self.assemble()
File "C:\Users\Patrick\Anaconda\lib\site-packages\pyinstaller-2.1-py2.7.egg\Py
Installer\build.py", line 1050, in assemble
dist_nm=inm)
File "C:\Users\Patrick\Anaconda\lib\site-packages\pyinstaller-2.1-py2.7.egg\Py
Installer\build.py", line 842, in checkCache
digest = cacheDigest(fnm)
File "C:\Users\Patrick\Anaconda\lib\site-packages\pyinstaller-2.1-py2.7.egg\Py
Installer\build.py", line 796, in cacheDigest
data = open(fnm, "rb").read()
IOError: [Errno 22] invalid mode ('rb') or filename: ''
And here are the warnings I get that may or may not be relevent and are both related to not being able to find ctypes
890 WARNING: library python%s%s required via ctypes not found
2175 WARNING: library python%s%s required via ctypes not found
The good news is that its seems the third party modules are being accounted for however I am not sure if they are associated with the errors that I am gettting:
4540 INFO: Hidden import 'netCDF4' has been found otherwise
4540 INFO: Hidden import 'progressbar' has been found otherwise
4540 INFO: Hidden import 'codecs' has been found otherwise
4545 INFO: Hidden import 'encodings' has been found otherwise
I just copied the DLL pywintypes27.dll in C:\Python27\Lib\site-packages\pywin32_system32.
I added it in win32/lib.
It's OK!
I had the same problem. The dll, pywintypes27.dll was in C:\Python27\Lib\site-packages\pywin32_system32. I added this directory to my PATH environment variable and py2exe was able to find the DLL. Obviously, setting the path is not the correct solution (and you could possibly do it programatically via os.environ), but, works for me.
Solution to prob 2. The solution in the link below solved the issue for me :)
With pywin32 build 219 installed via conda on python 2.7, importing pythoncom fails with
ImportError: No system module 'pywintypes' (pywintypes27.dll)
The issue is that the library pywintypes27.dll is stored not in
pathtovenv\lib\site-packages\win32\lib\pywintypes27.dll
but in
pathtovenv\lib\site-packages\win32\pywintypes27.dll
Adding in the file win32\lib\pywintypes.py the elif part here below solves the issue
if found is None:
# Not in the Python directory? Maybe we were installed via
# easy_install...
if os.path.isfile(os.path.join(os.path.dirname(__file__), filename)):
found = os.path.join(os.path.dirname(__file__), filename)
elif os.path.isfile(os.path.join(os.path.dirname(__file__), "..", filename)):
found = os.path.join(os.path.dirname(__file__), "..", filename)
In short terms it looks like pywintypes27.dll is located in the wrong folder
http://sourceforge.net/p/pywin32/bugs/685/
I was using a virtual env and had the same problem. The pywintypes35.dll was missing. This was my solution:
pip install pypiwin32
import win32api
I also faced this module not found error multiple times when I recently came to know that win32api should be called in order to get rid of this problem. Do tell if this solution works for you
Not sure if you're still looking for help on this.
Errors 1 and 3 look like the same error. This SO question pointed me in the right direction. Essentially, install the MS VC++ 9.0 x64 redistribution package, and that should take care of those errors.
Error 2 appears to have been taken care of by following Lee's suggestion.
Error 4 is because, for some reason, PyInstaller stuck some empty file names in your binary list. I'm not sure if there's a less-hacky way to fix the error, but I was able to get around it by putting
for b in a.binaries:
if b[0] == '':
a.binaries.remove(b)
after the Analysis( ... ) block in my spec file.
I'm not sure if the library python%s%s required via ctypes not found warnings are relevant. They're awfully suspicious, but I went down a rabbit hole trying to figure out where those warnings were generated and only succeeded in wasting about two hours of my evening.
You should run post-install script for the pywin32 extensions with a '-install' parameter, to ensure the environment is setup correctly.
pywin32_postinstall.py -install
I had a similar problem:
Traceback (most recent call last):
File ".\install\pywin32_postinstall.py", line 605, in <module>
install()
File ".\install\pywin32_postinstall.py", line 328, in install
LoadSystemModule(lib_dir, "pywintypes")
File ".\install\pywin32_postinstall.py", line 166, in LoadSystemModule
mod = imp.load_dynamic(modname, filename)
ImportError: DLL load failed: The specified module could not be found.
My mistake was that I installed pywin32 via pip for user
pip install pywin32 --user
So the needed DLLs were in user's AppData: %appdata%\Python\Python27\site-packages
That's why pywin32_postinstall.py couldn't find them.
Re-installing without --user option helped.
Fix: No system module pywintypes (pywintypes39.dll).
The first step is to open the Python installation directory and find the "pywin32_system32" folder
The second step is to copy the entire folder to "project name\venv\Lib\site-packages"
Sources:https://programmersought.com/article/92924476575/
Good Luck!!
I am using python version 3.8 so I am copying files which ends with 38 (e.g. xyz38.dll)
Download from internet and Copy pythoncom38.dll and pywintype38.dll in the location:
C:\Users\hp\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\win32
NOTE: This location may vary pc to pc so go to that location which is
there in the error displayed in module pywintypes or py_xyz not found error.
(also paste both .dll files in libs or Lib or lib folder inside all win32 folder available at that location)
Close the python application and Re-launch and run your program again [works 100%]
If above doesn't work then uninstall pypiwin32 in command prompt
pip uninstall pypiwin32 and then pip install pipiwin32
and repeat 1st and 2nd step and Restart your pc

Launching IPython qtconsole from command line (after installing all dependencies)

I am a bit of a newbie to the command line. I used to have IPython (with all dependencies configured) on my last MacBook, such that I could click on an icon from the dash to launch iPython qtconsole (outside of terminal shell).
Now, on my new MacBook Pro, after installing all of the same files and dependencies, I am getting:
Jacobs-MacBook-Pro:~ Jacob$ ipython qtconsole
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 8, in <module>
load_entry_point('ipython==1.0.dev', 'console_scripts', 'ipython')()
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/frontend/terminal/ipapp.py", line 390, in launch_new_instance
app.initialize()
File "<string>", line 2, in initialize
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/config/application.py", line 84, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/frontend/terminal/ipapp.py", line 315, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<string>", line 2, in initialize
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/config/application.py", line 84, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/core/application.py", line 323, in initialize
self.parse_command_line(argv)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/frontend/terminal/ipapp.py", line 310, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<string>", line 2, in parse_command_line
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/config/application.py", line 84, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/config/application.py", line 429, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<string>", line 2, in initialize_subcommand
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/config/application.py", line 84, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/config/application.py", line 361, in initialize_subcommand
subapp = import_item(subapp)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/utils/importstring.py", line 40, in import_item
module = __import__(package,fromlist=[obj])
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/frontend/qt/console/qtconsoleapp.py", line 56, in <module>
from IPython.external.qt import QtCore, QtGui
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/external/qt.py", line 23, in <module>
QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/external/qt_loaders.py", line 241, in load_qt
result = loaders[api]()
File "/Library/Python/2.7/site-packages/ipython-1.0.dev-py2.7.egg/IPython/external/qt_loaders.py", line 171, in import_pyqt4
from PyQt4 import QtGui, QtCore, QtSvg
ImportError: dlopen(/Library/Python/2.7/site-packages/PyQt4/QtGui.so, 2): Library not loaded: /usr/local/lib/QtGui.framework/Versions/4/QtGui
Referenced from: /Library/Python/2.7/site-packages/PyQt4/QtGui.so
Reason: image not found
and, again being a newbie, I think part of the problem may rely on the output, here:
Jacobs-MacBook-Pro:~ Jacob$ brew install qt
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
Warning: qt-4.8.4 already installed, it's just not linked
Thanks in an advance for any tips. And if you need me to run any command (to view more outputs) just let me know!
So, you have multiple Python installations, and aren't sure which one you have.
You have both Homebrew and MacPorts.
Your MacPorts is broken and you don't know how to fix it.
Fixing each of these may not be that hard, but I think it's time to wipe the slate clean and start over.
The "easy" way to do this is to reinstall the OS, using the standard backup-and-migrate stuff to preserve your Aqua-level apps, user preferences, documents, etc. But that's pretty drastic, and shouldn't be necessary.
To clean things up manually, first:
Uninstall MacPorts.
brew uninstall $(brew list). This removes all Homebrew packages. You could just unlink instead of uninstall, but you really want to rebuild them once your machine is cleaned up.
sudo rm -rf /Library/Python /Library/Frameworks/Python.framework /usr/local/share/python*. This wipes out most third-party Python installations. And if you don't know where yours came from, it's really the best you can do.
Take a look at whatever's left in /usr/local/bin. All kinds of stuff can end up here, from scripts installed with Apple's Python to the command-line tools for GUI apps like TextMate, Aquamacs, or GitHub to the tools that come with binary installs of SDL or Qt, so you may not want to just wipe out the whole thing—but you do want to look it all over. Also look at /usr/local/lib and /Library/Frameworks.
You also may need to edit your ~/.profile, etc. files to undo changes you or those installers may have made, like adding /opt/local/bin or /Library/Frameworks/Python.framework/Versions/2.7/bin to your PATH. There could also be changes in /etc, but that's less likely (and less likely to cause problems).
Now run brew doctor to make sure Homebrew is happy, reinstall any non-Python-related Homebrew packages and binary installers you want, and now you're ready to install/configure your python, PyQt4-or-PySide, iPython, etc. properly and live happily every after (until you buy a new computer next year).

PIL Module with PyDev

I am new to Python and also Google App Engine, but I am stuck up with the installations of it and its compatibility. I am using mac os -x and eclipse helios and got the pyDev plugin installed but in spite of all this i am still getting errors. . .
Whenever I try to import PIL from the terminal it does not give me any errors meaning that it was installed successfully but when I use the same Import in the eclipse file. I getting the compilation error as:
"Unresolved Import"
Please help me with this
Somehow I tried to fix that, then it gives me the error saying that imaging : no matching architecture in universal wrapper
when I changed the architecture to 32 bit ti gives me this in Eclipse Log :
Traceback (most recent call last):
File "/Users/Vinay/Documents/EclispeHeliosWorkspace/helloworld/Main.py", line 7, in <module>
im.show()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 1483, in show
_show(self, title=title, command=command)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 2123, in _show
apply(_showxv, (image,), options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 2127, in _showxv
apply(ImageShow.show, (image, title), options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageShow.py", line 41, in show
if viewer.show(image, title=title, **options):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageShow.py", line 66, in show
self.show_image(image, **options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageShow.py", line 85, in show_image
return self.show_file(self.save_image(image), **options)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageShow.py", line 81, in save_image
return image._dump(format=self.get_format(image))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 488, in _dump
self.load()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageFile.py", line 164, in load
self.load_prepare()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageFile.py", line 231, in load_prepare
self.im = Image.core.new(self.mode, self.size)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/Image.py", line 37, in __getattr__
raise ImportError("The _imaging C module is not installed")
ImportError: The _imaging C module is not installed
What do I do :( ?
PIL has some specific instructions for installation. Have you seen them?
Installing PIL on GAE
Download the PIL .dmg file. For example, you can download the PIL 1.1.6 .dmg file from http://pythonmac.org/packages/py25-fat/index.html.
Double-click on the installer to start the installation process.
Choose the correct directory. Finish the installation.
This is just for use in your local development environment. When you upload it'll use a GAE supplied version of PIL which means you also have to update your app.yaml file like so:
libraries:
- name: PIL
version: "1.1.7"
as detailed here.
IIRC You will want to install it "inside" your application directory itself so it can be accessed by your application locally. Not sure about that on the MAC however.
I just installed Pillow (using: sudo pip install Pillow) to get PIL in Python 2.7.6 on OS X 10.8.5 Mountain Lion.
I had the same issue in PyDev with Eclipse Kepler. To fix:
Go to:
Eclipse -> Preferences -> PyDev -> Interpreter - Python -> Libraries and click on "New Folder."
Then navigate to:
/Library/Python/2.7/site-packages
and click Open, and then Apply, then OK.
Then I quit Eclipse and restarted -- problem fixed. :)

Problem running python from crontab - "invalid Python installation"

I have python 2.7 installed on my linux box, and I'm trying to schedule a python script via crontab. The script works fine from the command line, however when running via cron I get:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site.py", line 553, in <module>
main()
File "/usr/local/lib/python2.7/site.py", line 535, in main
known_paths = addusersitepackages(known_paths)
File "/usr/local/lib/python2.7/site.py", line 268, in addusersitepackages
user_site = getusersitepackages()
File "/usr/local/lib/python2.7/site.py", line 243, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/usr/local/lib/python2.7/site.py", line 233, in getuserbase
USER_BASE = get_config_var('userbase')
File "/usr/local/lib/python2.7/sysconfig.py", line 535, in get_config_var
return get_config_vars().get(name)
File "/usr/local/lib/python2.7/sysconfig.py", line 434, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/usr/local/lib/python2.7/sysconfig.py", line 298, in _init_posix
raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/include/python2.7/pyconfig.h (No such file or directory)
I see that /usr/include/python2.7 does't exist, but /usr/local/include/python2.7/ does. Did I make a mistake while installing python?
You probably just have 2 versions installed, one of which is broken. If your cron is just directly calling python instead of a specific path, your PATH probably contains /usr/bin before /usr/local/bin (which is typical) - so in your cron, specify which python to use, or remove the existing one in /usr/bin and symlink /path/to/good/python to /usr/bin/python.
Edit: scratch that, just re-read and saw that it works fine from the command line. python-dev is probably the way to go. Sorry!
You need python2.7-dev, which installs the includes and headers.
For Ubuntu, you run sudo apt-get install python2.7-dev to install it. What Linux distro are you running?
I am assuming that in your crontab file, you are giving the full path to the python executable, and not just relying on she-bang with executable permissions. If not, please give point to the full-path python2.7 in the crontab file and also use the same full-path on the command line to ensure that you don't get this problem.If you get this on command line too, then it is probably missing some development headers. (Are you trying to compile something like using setup.py build and trying to do it via crontab?) I am trying to understand where would one need those headers. So, apart from the above suggestion, extra information from your end might ofcourse help further.

Categories

Resources