When I import Image from PIL I get this error message.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.local/lib/python3.8/site-packages/PIL/Image.py", line 94, in <module>
from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/home/pi/.local/lib/python3.8/site-packages/PIL/__init__.py)
The way it says to install pillow errors out for me
pip install --upgrade Pillow
It says that it doesn't have the .whl so it defaults to the old setup.py then errors and doesn't install.
only
sudo apt install python3-pil
seems to install pillow correctly
this is for python3.8.x
Try using pip3 instead of pip. pip sometimes defaults to Python 2.x. See the following question to change this behavior: How to override the pip command to Python3.x instead of Python2.7?
pip3 install --upgrade Pillow
Related
I have install pywifi module and it success, when I try to import pywifi,I got this error.
>>> import pywifi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/pywifi/__init__.py", line 15, in <module>
from .wifi import PyWiFi
File "/Library/Python/2.7/site-packages/pywifi/wifi.py", line 15, in <module>
from .iface import Interface
File "/Library/Python/2.7/site-packages/pywifi/iface.py", line 15, in <module>
raise NotImplementedError
NotImplementedError
someone can help me?
Which python version are you running? It might be because it is installed as a Python 3 package and you're running Python 2.7 or the opposite.
To specifically install the package for Python 3, try entering this command:
pip3 install pywifi
or
python3 -m pip install pywifi
To specifically install the package for Python 2, try entering this command:
pip2 install pywifi
or
python -m pip install pywifi
I got similar errors, from the error message, I tried to install those packages that pywifi seemed to depend on, i.e., I ran
pip install comtypes
pip install iface
then it worked.
pip install pyiwn
Requirement already satisfied: pyiwn in ./anaconda/lib/python2.7/site-packages (0.9)
The details of the package are at https://pypi.org/project/pyiwn/ and https://github.com/riteshpanjwani/pyiwn
>>> from pyiwn import pyiwn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/#USER_NAME/anaconda/lib/python2.7/site-packages/pyiwn/pyiwn.py", line 1, in <module>
from pyiwn import utils
ImportError: cannot import name util
can anyone solve this?
We can force a pip re-install, without using the cached version.
pip install --upgrade --force-reinstall pyiwn --no-cache-dir
or for py2.7, pip1.4+ use --no-deps --ignore-installed
Found the problem, the error occurred as the developer didn't mention which python to use. My pip install defaulted to python2. But the pyiwn library only works for python3. That's the reason for utils error.
I have pip installed:
[amr#h2oamr kits]$ python get-pip.py
Requirement already up-to-date: pip in /usr/local/lib/python2.7/site-packages
However, I'm getting this error when trying to install Django:
[amr#h2oamr kits]$ pip install django
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in ?
from pip import main
ImportError: No module named pip
I am stuck trying to move forward. I installed pip as recommended by using a get-pip.py module I downloaded.
This upgrade also did not work.
[amr#h2oamr kits]$ pip install --upgrade pip
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in ?
from pip import main
ImportError: No module named pip
How can I remove pip altogether, and then re-install it?
you can use the command $ rm pip to remove pip and then $sudo apt-get install pip to get the latest version
I tried installing the autogui python extension:
pip3 install pyautogui
And this installation attempt results in the following error message:
Collecting pyautogui
Using cached PyAutoGUI-0.9.33.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/00/zcr6mkx90hg7kr4x_ks6nhhw0000gn/T/pip-build-edy15oyn/pyautogui/setup.py", line 6, in <module>
version=__import__('pyautogui').__version__,
File "/private/var/folders/00/zcr6mkx90hg7kr4x_ks6nhhw0000gn/T/pip-build-edy15oyn/pyautogui/pyautogui/__init__.py", line 110, in <module>
from . import _pyautogui_osx as platformModule
File "/private/var/folders/00/zcr6mkx90hg7kr4x_ks6nhhw0000gn/T/pip-build-edy15oyn/pyautogui/pyautogui/_pyautogui_osx.py", line 4, in <module>
import Quartz
File "/usr/local/lib/python3.5/site-packages/Quartz/__init__.py", line 5, in <module>
import objc
File "/usr/local/lib/python3.5/site-packages/objc/__init__.py", line 18, in <module>
_update()
File "/usr/local/lib/python3.5/site-packages/objc/__init__.py", line 15, in _update
import objc._objc as _objc
ImportError: dlopen(/usr/local/lib/python3.5/site-packages/objc/_objc.cpython-35m-darwin.so, 2): Symbol not found: _PyObject_REPR
Referenced from: /usr/local/lib/python3.5/site-packages/objc/_objc.cpython-35m-darwin.so
Expected in: flat namespace
in /usr/local/lib/python3.5/site-packages/objc/_objc.cpython-35m-darwin.so
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/00/zcr6mkx90hg7kr4x_ks6nhhw0000gn/T/pip-build-edy15oyn/pyautogui
My Mac OS version is OS X El Capitan 10.11.3, my Python3 version is 3.5.1, and my pip3 version is pip 8.0.2.
There seems to be a similar question on Stackoverflow (Cannot install pip install pyautogui, error code 1), but the fix does not apply to my problem; I have already installed "pillow". Also, I have read the documentation (https://pypi.python.org/pypi/PyAutoGUI), and installed pyobjc-core as well as pyobjc. Setuptools are installed and up-to-date.
Does anyone have an idea how to fix this error (and install pyautogui)? I think the error might originate, because _PyObject_REPR is missing in Python 3.5.1.
I found a workaround. This code by "Kentzo" fixed the issue for me:
pip3 install https://github.com/GreatFruitOmsk/pyobjc-core/releases/download/v3.0.5.dev0/pyobjc-core-3.0.5.tar.gz
Since the code is not written by me, please use this workaround at your own risk.
If you are like me and had no success installing pyautogui, here is what I did to fix the issue:
Install Xcode from the Mac App Store. This is a requirement for installing PyObjC. Details can be found here.
sudo pip3 install pyobjc-core
sudo pip3 install pyobjc
sudo pip3 install Pillow
sudo pip3 install pyautogui
Steps 2, 3, and 5 are detailed here.
Step 4 is described here, another Stackoverflow post.
SOLVED
Run:
1. sudo pip3 install pil
2. sudo pip3 install Pillow
3. sudo pip3 install pyautogui
Bingo! installed without an error
The sequence of steps which worked for me on macOS High Sierra(10.13.4) :
Install Xcode from AppStore
activate virtual environment (if needed)
pip3 install pyobjc-core
pip3 install pyobjc-framework-Quartz
pip3 install image
pip3 install pyautogui
I've been trying to import h5py to read this type of file.
Here is my code:
import h5py
file_1 = h5py.File("Out_fragment.h5py")
print file_1
The output is:
Traceback (most recent call last):
File "./week11.py", line 17, in <module>
import h5py
ImportError: No module named h5py
I also used pip install h5py to get this module and am not sure why it did not seem install properly.
Thanks.
On Ubuntu. You can try the following three commands:
sudo pip install cython
sudo apt-get install libhdf5-dev
sudo pip install h5py
source: https://github.com/fchollet/keras/issues/3426
For windows you just need to install it normally using easy install feature:
pip install h5py
you can visit their website from here: H5py