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. :)
Related
I'm running Python 3.10.2288.0 (x64) on a Windows 10 OS.
I use IDLE as interpreter.
So far, I have been running IDLE (in and out venv) by:
C:path\to\venv venv\Scripts\Activate
(venv) C:path\to\venv python -m idlelib.idle
All of a sudden, this command didn't work anymore.
The following error appeared:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\idlelib\idle.py", line 13, in <module>
from idlelib.pyshell import main # This is subject to change
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\idlelib\pyshell.py", line 53, in <module>
from idlelib import debugger
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\idlelib\debugger.py", line 7, in <module>
from idlelib import macosx
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\idlelib\macosx.py", line 7, in <module>
from test.support import requires, ResourceDenied
ModuleNotFoundError: No module named 'test'
I tried to reinstall Python, but nothing changed.
The same error appears when running command outside the venv.
It seems that everything is up-to-date.
What do you suggest?
Thanks,
idromv
This is the result of a buggy fix to a bug that is triggered when Python is installed without the test module. The bug appeared in 3.10.8 and 3.12.0a1, released a week ago, and at least in Microsoft Store Python 3.10.2288.0.
Omitting the test module seem to not currently be an option on Mac, so this should not be a problem there.
One fix anywhere is to edit /Lib/idlelib/macosx.py: delete line 7, from test.support import requires, ResourceDenied, and replace line 23, requires('gui') with pass. This may require admin privileges.
On Windows, rerun the python.org installer, chose Modify, and check the box to install the test suite.
For the Windows store Python, including the test suite may not be an option. One can, as mentioned in the comments, instead get the python.org installer and install with the test suite.
I don't know what the situation is for *nix.
I made an exe to read images including gifs using pyinstaller. However, the exe can't read gif and the below error occurs. I have installed the latest version of imageio and the program works in interpreter. Could you advise? Thanks in advance.
The line raising error:
cv_gif = imageio.mimread(pic_path)
Error:
Traceback (most recent call last):
File "Image Viewer.py", line 3085, in <module>
File "Image Viewer.py", line 522, in go
File "Image Viewer.py", line 1264, in ShowANI
File "imageio\core\functions.py", line 247, in mimread
File "imageio\core\imopen.py", line 277, in imopen
ValueError: Could not find a backend to open `C:\Users\simon\Practice\testdir3\alpaca.gif`` with iomode `rI`.
Based on the extension, the following plugins might add capable backends:
pillow: pip install imageio[pillow]
GIF-PIL: pip install imageio[pillow]
I have exactly the same problem.
This might have something to do with the new feature of imageio introduced in version 2.11.0: Choose plugin based on extension and plugin lazy-import. Revert back to 2.10.5 solves the problem.
Just manually copied the folder \Lib\site-packages\imageio and replaced the imagoio folder of the exe, then it works.
I have been using Visual Studio Code to develop some python programs. Modules that I import include numpy and cssutils. Sometimes VS CODE asked for upgrade that I usually agreed. Then today, VS CODE suddenly cannot find cssutils. I and my students checked all the environment variables, path variables, and surveyed the internet, but couldn't find any clue. Some people said it is a VS CODE bug that the authors claimed has been fixed but actually not. Some people suggests adding some declaration to the launch.json file and setting.json.
We tried all and none worked. We have also shut down the PC and rerun vscode.
Finally, we uninstalled cssutils and pip install it again. Then the problem became that numpy cannot be imported. Then we tried all the methods listed in the above and surveyed the internet. We also decide to uninstall and reinstall vs code. But none worked.
Can someone help ?
We have tried the following:
pip installed numpy
pip3 installed numpy
pip uninstalled numpy and then pip installed it.
We checked the path of the python interpreter in vs code environment settings.
We tried adding #{workspaceRoot} to the environment attribute in launch file.
We tried relaunching vs code.
We tried shut down the computer and then powered it on again.
We tried to reinstall vs code.
But none of the above worked.
We also tried importing numpy in powershell and it worked fine.
PS C:\Users\XXXXXXXXXXXXXXXXXXX> & 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\python.exe' 'c:\Users\FARN\.vscode\extensions\ms-python.python-2019.8.30787\pythonFiles\ptvsd_launcher.py' '--default' '--client' '--host' 'localhost' '--port' '50166' 'C:\Users\XXXXXXXXXXXXXXXXXXX/src/CnTaaD.py' '-L'
python 3.x
1.here: C:\Users\XXXXXXXXXXXXXXXXXXXXXXX
T0, starting testing task: <CnUserManager.CnUserManagerClass object at 0x000001BAC67866A0>
CnServerConnector: rootDir = C:\Users\XXXXXXXXXXXXXXXXXXXXXXXX
FM cmdLineJsonFilePath: C:\Users\XXXXXXXXXXXXX\YYYYYYYY.json
try opening file in python 3 in utf8!
try loading json file!
success in loading json file: <_io.TextIOWrapper name='C:\\Users\\XXXXXXXXXXXXXXXXXX\\YYYYYYY.json' mode='r' encoding='utf8'>
After loading the recorded projects json!
icoPath: C:\Users\XXXXXXXXXXXXXXXXX\src\pictures\animation\setDefault\logocute64.ico
---[ testerFrankWang02 userRecord already exists!]-------------------------
Traceback (most recent call last):
File "c:\Users\FARN\.vscode\extensions\ms-python.python-2019.8.30787\pythonFiles\ptvsd_launcher.py", line 43, in <module>
main(ptvsdArgs)
File "c:\Users\FARN\.vscode\extensions\ms-python.python-2019.8.30787\pythonFiles\lib\python\ptvsd\__main__.py", line 432, in main
run()
File "c:\Users\FARN\.vscode\extensions\ms-python.python-2019.8.30787\pythonFiles\lib\python\ptvsd\__main__.py", line 316, in run_file
runpy.run_path(target, run_name='__main__')
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\FARN\Documents\LINUX\realtime\PRGM\TaaDPlaygroundClient/src/CnTaaD.py", line 35, in <module>
CnUserManager.CnUserManagerClass(sys.argv)
File "C:\Users\FARN\Documents\LINUX\realtime\PRGM\TaaDPlaygroundClient/src\CnUserManager.py", line 1334, in __init__
import CnProjectManager
File "C:\Users\FARN\Documents\LINUX\realtime\PRGM\TaaDPlaygroundClient/src\CnProjectManager.py", line 30, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
Press any key to continue . . .
It looks like you're using an installation of Python from Visual Studio instead of your own installed copy. Is that on purpose? And is that the installation of Python you installed numpy into?
The easiest way to see if numpy was installed where you expected is to run & 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\python.exe' '-m' 'pip' 'list' (that quoting might be wrong, but basically you want -m pip list passed to the Python interpreter). That will list what pip has installed.
The best solution to this is to use a virtual environment and install into that.
all,
I've installed the package:pywinauto successfully with "pip install pywinauto", but it always fails, why?
I did it in this way:
pip install pywinauto
and then under the windows cmd env, I run the python:
and then:
import pywinauto
I got the following errors:
....
>>> import pywinauto
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\pywinauto\__init__.py", line 40, in <module>
from . import findwindows
File "C:\Python27\lib\site-packages\pywinauto\findwindows.py", line 42, in <module>
from . import controls
File "C:\Python27\lib\site-packages\pywinauto\controls\__init__.py", line 36,in <module>
from . import uiawrapper # register "uia" back-end (at the end of uiawrapper module)
File "C:\Python27\lib\site-packages\pywinauto\controls\uiawrapper.py", line 44, in <module>
from ..uia_defines import IUIA
File "C:\Python27\lib\site-packages\pywinauto\uia_defines.py", line 175, in <module>
pattern_ids = _build_pattern_ids_dic()
File "C:\Python27\lib\site-packages\pywinauto\uia_defines.py", line 163, in _build_pattern_ids_dic
if hasattr(IUIA().ui_automation_client, cls_name):
File "C:\Python27\lib\site-packages\pywinauto\uia_defines.py", line 50, in __call__
cls._instances[cls] = super(_Singleton, cls).__call__(*args, **kwargs)
File "C:\Python27\lib\site-packages\pywinauto\uia_defines.py", line 60, in __init__
self.UIA_dll = comtypes.client.GetModule('UIAutomationCore.dll')
File "C:\Python27\lib\site-packages\comtypes\client\_generate.py", line 97, in GetModule
tlib = comtypes.typeinfo.LoadTypeLibEx(tlib)
File "C:\Python27\lib\site-packages\comtypes\typeinfo.py", line 485, in LoadTypeLibEx
_oleaut32.LoadTypeLibEx(c_wchar_p(szFile), regkind, byref(ptl))
File "_ctypes/callproc.c", line 950, in GetResult
WindowsError: [Error -2147312566] Error loading type library/DLL
It looks like you're using old OS Windows version like Windows XP. MS UI Automation is included into Windows Vista and later. But you may install .NET Framework 3.0+ to get UIAutomationCore.dll available even on Windows XP. If you don't need MS UI Automation technology at all, just run pip uninstall comtypes and pywinauto will work with Win32 API only.
If installing .NET Framework 3.0+ doesn't help (or if it's already installed) and you need to use Win XP, install Windows update KB971513. It solved the loading library issue for me.
I need upgrade the Winxp to Win7 or Win8, or Win10.
I have Mercurial 1.8.1, Python 2.6.6 installed on Win 2k8 R2 running on a vm. I have tried installing from msi, source and using tortisehg. Command-line Hg works fine but I get the same error when running the hgweb.cgi:
Traceback (most recent call last):
File ".\hgweb.cgi", line 17, in
application = hgweb(config)
File "mercurial\hgweb\__init__.pyc", line 26, in hgweb
File "mercurial\hgweb\hgwebdir_mod.pyc", line 61, in __init__
File "mercurial\hgweb\hgwebdir_mod.pyc", line 70, in refresh
File "mercurial\ui.pyc", line 35, in __init__
File "mercurial\demandimport.pyc", line 75, in __getattribute__
File "mercurial\demandimport.pyc", line 47, in _load
File "mercurial\util.pyc", line 576, in
File "mercurial\demandimport.pyc", line 85, in _demandimport
File "mercurial\windows.pyc", line 21, in
File "mercurial\demandimport.pyc", line 75, in __getattribute__
File "mercurial\demandimport.pyc", line 47, in _load
File "mercurial\osutil.pyc", line 12, in
File "mercurial\osutil.pyc", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.
The other answers I have found on SO and elsewhere pointed me to try installing from source, dropping the pure osutil into the install, or installing an older version. I have tried them all.
This is especially frustrating because I have other, similar non-vm machines running fine but have been unable to find the disconnect.
Ideas?
I had the same error using following system configuration
Python-2.6.6 installed as msi
mercurial-1.8.2-x86 installed as msi
IIS7
I solved this problem simply:
Python has been installed early
Uninstall Mercurial msi package
Download and install "Mercurial-1.8.2 (32-bit py2.6)" installer from mercurial website which is marked as "This is recommended for hgweb setups".
copyed content of C:\Python26\Lib\site-packages\mercurial\ to the directory used in IIS7 website setup.
Till now all is working. Hope this will help.
Whenever I have less than descriptive error messages that tell me something is going on at the system level but not what, I use Sysinternals' Procmon to tell me what's going with the registry and filesystem. It's verbose, and getting the filter to show just the process of interest takes some learning, but you can export the results to Excel and skim them for suspicious-looking results. Pay particular attention to failures, of course.
Give it a try and see what DLL is being searched for.