Issue with Installing Pillow for Python - python

I am trying to install Pillow in my RedHat operating system through pip
sudo pip install Pillow
However, I receive the following error
You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting Pillow
/usr/lib/python2.6/sitepackages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading Pillow-4.2.1.tar.gz (12.7MB)
100% |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 12.7MB 35kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-5XOfq_/Pillow/setup.py", line 143
required = {'jpeg', 'zlib'}
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5XOfq_/Pillow
How can I address this?
Thanks

The error you're getting has to do with the new syntax for creating sets that was introduced in Python 2.7.
{item1, item2, ...}
It seems you're running a version of Python prior to 2.7, which doesn't recognize this as valid syntax.
Pillow's web site includes notes on which versions of Pillow are compatible with which versions of Python. You'll need to either upgrade Python (recommended), or choose an older version of Pillow which works with the Python version you have.

http://prodiguer.github.io/synda/faq.html#transfer-module
here says:
This bug affects 3.6 version installed from source (RPM 3.6 and DEB
3.6 should not be affected). It has been fixed in 3.7. It can be fixed in 3.6 by downgrading the pypi pillow package:
pip install pillow==3.4.2

Related

pip msgpack error while installing requirements

I used pip install -r requirements.txt, and got this error:
AttributeError: module 'msgpack' has no attribute 'dumps'
Full log: https://pastebin.com/aTTwyrML
requirements.txt: https://github.com/poljar/weechat-matrix/blob/master/requirements.txt
This also seems to break other uses of pip install.
I can't find any pip issues or solutions to this anywhere.
EDIT: msgpack is being inmported from: '/usr/lib/python3.8/site-packages/msgpack/__init__.py'
Other packages that cause the error:
pytconf
You're running python version 3.8 and msgpack only supports up to 3.7. This might be causing a problem installing msgpack via pip or there's some breaking implementation in 3.8 that's not in 3.7 and under. I know I've run into some trouble with sharing projects between teams that are using 3.8 and teams that are using earlier verions.
msgpack on pypi.

Reportlab install: need Pillow. Pillow install: need zlib. Zlib install: file not found

Relevant details:
Windows 8
Python 2.7 and 3.7 installed. I'm trying to migrate from 2.7 to 3.7, starting by making sure I have every package I use installed for 3.7
IDE is PyCharm. I tried installing packages that way, but proxy blah blah connection issues blah blah, gave up on that rabbit hole
I am installing from CMD, where I also have a proxy issue, so I'm downloading packages and installing from there.
pip version 19.0.3
C:\Users\me\Downloads>py -3 -m pip install zlib-1.2.11.tar.gz
Processing c:\users\me\downloads\zlib-1.2.11.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python37\lib\tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\me\
\AppData\\Local\\Temp\\pip-req-build-itydqf_9\\setup.py'
Command "python setup.py egg_info" failed with error code 1 in C:\Users\me\AppData\Local\Temp\pip-req-build-itydqf_9\
I have tried installing zlib1211 as well.
I have tried 17 versions of Pillow. 4.0.0, 3.4.2 (succeeded but Reportlab requires 4.0 minimum), 6.1.0, and I've tried .whls and .eggs and such to no avail. I've been to dozens of pages looking to solve each issue I've come across, and I have no more things to try. zlib isn't even in pypi.
What else can I do?
zlib isn't a python package, you can't use pip to install it.
you can try this or use cygwin
I finally found a workable solution. As #Sobhan mentioned, I can't use pip to install zlib. However, once I installed zlib from his link, I still couldn't get Pillow to install, because the headers or libraries couldn't be found for my Pillow install.
#ash's answer here finally helped. I apparently needed to use the Pillow .exe to install Pillow instead of banging my head against the wall with pip for that, too. Reportlab then installed via pip without incident.

Installing Pillow on Python 2.7

When I try to install Pillow (as a wheel file)
C:\Python27\Scripts>pip install C:\Users\karth\Desktop\Pillow-3.4.2-cp36-cp36m-win_amd64.whl
I get the following error.
Pillow-3.4.2-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.
You have a wheel file which is expecting a different Python version.
The cp36, indicates CPython 3.6, i.e. Python 3.6. You are running Python 2.7.
Either update your Python version, or more suitably, get a wheel file of the correct version from PyPi https://pypi.python.org/pypi/Pillow/4.0.0

Error installing pydns

While trying to install pydns module i am getting this error:
C:\Windows\system32>pip install pydns
Collecting pydns
Using cached pydns-2.3.6.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Shiva\AppData\Local\Temp\pip-build-294324_x\pydns\setup.py", line 12, in <module>
import DNS
File "C:\Users\Shiva\AppData\Local\Temp\pip-build-294324_x\pydns\DNS\__init__.py", line 14, in <module>
import Type,Opcode,Status,Class
ImportError: No module named 'Type'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Shiva\AppData\Local\Temp\pip-build-294324_x\pydns\
I tried pip install py3dns as well but it doesn't work.
You are using the wrong version of python. pydns is not supported for python 3. pydns works for python2.7
For python3 use pip3 install py3DNS
The pydns is not supported with Python 3. You need to use python 2.7 to work with it.
It seem that there is a conflict between pyDNS and dnspython built-in package :
** / ! \ To run this solution for python3 please replace pyDNS by py3DNS**
Step 1 remove dnspython :
$ pip uninstall dnspython
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Found existing installation: dnspython 1.15.0
Uninstalling dnspython-1.15.0:
Would remove:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/*
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dnspython-1.15.0.dist-info/*
Would not remove (might be manually added):
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Base.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Base.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Class.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Class.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Lib.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Lib.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Opcode.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Opcode.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Status.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Status.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Type.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/Type.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/lazy.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/lazy.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/win32dns.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/dns/win32dns.pyo
Proceed (y/n)? y
Successfully uninstalled dnspython-1.15.0
Step 2 remove pyDNS :
$ pip uninstall pydns
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Found existing installation: pydns 2.3.6
Uninstalling pydns-2.3.6:
Would remove:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Base.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Base.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Class.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Class.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Lib.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Lib.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Status.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Status.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Type.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/Type.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/lazy.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/lazy.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/win32dns.py
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DNS/win32dns.pyo
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydns-2.3.6.dist-info/*
Proceed (y/n)? y
Successfully uninstalled pydns-2.3.6`
### Step 2 Install pyDNS again :
`$ pip install pydns
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Processing /Library/Caches/pip/wheels/54/c3/70/622b2f4958520225fab47eceb1e2659ac4d03ec6760ec26024/pydns-2.3.6-py2-none-any.whl
Installing collected packages: pydns
Successfully installed pydns-2.3.6
Step 3 Check the installed package with :
$ python -m DNS
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named DNS.__main__; 'DNS' is a package and cannot be directly executed
Enjoy

"AssertionError: Only python 2.7 and later is supported by ptyprocess", when installing pexpect via pip on python 2.6

I got following error when trying install pexpect via pip:
# pip install pexpect
Collecting pexpect
do_ypcall: clnt_call: RPC: Unable to receive; errno = Connection refused
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Using cached pexpect-4.0.tar.gz
Collecting ptyprocess>=0.5 (from pexpect)
Using cached ptyprocess-0.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-2X4It7/ptyprocess/setup.py", line 10, in <module>
"Only python 2.7 and later is supported by ptyprocess.")
AssertionError: Only python 2.7 and later is supported by ptyprocess.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-2X4It7/ptyprocess
It's pretty clear that downloaded ptyprocess works only with python 2.7, but doesn't pip should download correct packages versions, that are compatible with installed python versions?
My system info:
pip -V: pip 7.1.2 from /usr/lib/python2.6/site-packages (python 2.6)
python -V: Python 2.6.6
OS: CentOS 6.3
BTW: yum install pexpect succesfully installs pexpect package
Thank You
yum will install pexpect v2.3.6.
easy_install or pip will install pexpect v4.0.1 as of today.
You can use pexpect version 3.3 which not depends on ptyprocess version.
# easy_install pexpect==3.3
or
# pip install pexpect==3.3
AssertionError: Only python 2.7 and later is supported by ptyprocess.
pyexpect depends on ptyprocess>=0.5 (https://github.com/pexpect/pexpect/blob/master/setup.py#L66)
You will need to install a version of ptyprocess that is >=0.5 but works with python 2.6 first, then install pyexpect.
edit looks like you are out of luck, 0.5 requires python 2.7 (https://github.com/pexpect/ptyprocess/blob/master/setup.py#L9-L10). Your system package has it patched to work with 2.6 so you'll have to use that.

Categories