Installing Pillow on Python 2.7 - python

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

Related

ERROR: (wheel).whl is not a supported wheel on this platform

I'm trying to build Tensorflow from source (if I install directly it works fine but I'm trying to get AVX2/FMA extensions support as I can't use CUDA/GPU) and I'm following this tutorial to build Tensorflow 1.15 (which is needed for the project that I use, I can't use 2.x).
I've built Tensorflow successfully, but when I try to install the wheel with pip I get the following error:
ERROR: tensorflow-1.15.5-cp37-cp37m-macosx_11_0_x86_64.whl is not a supported wheel on this platform.
Well, I know what the error means but the problem is that:
The wheel, as implied by the filename, is built for:
Python 3.7
macOS 11.0
x86/64
Which is already what I have (yup, double checked Python version, it's exactly Python 3.7.9, and no I'm not on M1 if that matters, I'm on Intel Mac). Why am I getting this error message even though I'm on the platform that the wheel is built for?
UPDATE: I'm already on the latest pip as of writing, and I can verify pip and python point to the same version:
(tf) can#can-mbp tensorflow % which pip
/opt/anaconda3/envs/tf/bin/pip
(tf) can#can-mbp tensorflow % which python
/opt/anaconda3/envs/tf/bin/python
(tf) can#can-mbp tensorflow % pip -V
pip 21.0 from /opt/anaconda3/envs/tf/lib/python3.7/site-packages/pip (python 3.7)
(tf) can#can-mbp tensorflow % python -V
Python 3.7.9
FOR MACOS - BIG SUR
I was able to solve this problem when I found that the version of the macOS operating system does not match the version actually recognized by python
I'm using macOS 11.4, the file is with this version. But when typing a command in the terminal, I found that python recognizes 11.0.
python3
from distutils import util
util.get_platform()
>> 'macosx-11.0-arm64'
generated file name:
opencv_python-4.5.2+2344814-cp39-cp39-macosx_11_4_arm64.whl
new file name:
opencv_python-4.5.2+2344814-cp39-cp39-macosx_11_0_arm64.whl
Upon #Axe319's comment I took a look at https://github.com/apple/tensorflow_macos/issues/46 and seen that simply changing the wheel's filename's OS section to 10_9 works. There is probably a bug with parsing macOS 11.0 or Python doesn't think it supports 11.0 (maybe that particular Python/pip version was before Big Sur was released).
Make sure the Python version you are using (32/64 bit) does match what the wheel requires ;)

Torch installation results in not supported wheel on this platform

Tried running pip3 install torch===1.4.0 torchvision===0.5.0 -f https://download.pytorch.org/whl/torch_stable.html first, taken from PyTorch website
which resulted in
No matching distribution found for torch===1.4.0
and Could not find a version that satisfies the requirement torch===1.4.0 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
Finally downloaded the .whl file from downloads page and tried installing locally like so 'C:\Users\Raf\AppData\Local\Programs\Python\Python38\Scripts\pip.exe' install torch-1.4.0+cpu-cp37-cp37m-win_amd64.whl
after which I get torch-1.4.0+cpu-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform.
using 64 Python 3.8, on 64 bit Windows
using 64 Python 3.8
but you downloaded the cp37 whl which is for python 3.7. There is currently no whl file available for python 3.8. So either install from source (probably not recommended), install a different python version or create a virtual environment with python 3.7
Update
There is now: https://download.pytorch.org/whl/cpu/torch-1.4.0%2Bcpu-cp38-cp38-win_amd64.whl
I faced the similar issue, even if your python version is correct you can still face this problem if you had install 32x instead of 64x
If it is 32-bit you will face the same problem.
To check the bit version of python on your system run this
python -c "import struct;print( 8 * struct.calcsize('P'))"
This will return 32 or 64
If it returns 32 change it to 64 and reinstall the PyTorch
https://www.python.org/downloads/windows/

Issue with Installing Pillow for 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

Python pip argparse upgrade

I have been attempting to upgrade argparse on Ubuntu 16.04 to the latest version, but pip keeps saying that it is part of the standard library.
How can this package be upgraded?
$ sudo pip install argparse --upgrade
Collecting argparse
Using cached argparse-1.4.0-py2.py3-none-any.whl
Installing collected packages: argparse
Found existing installation: argparse 1.2.1
Not uninstalling argparse at /usr/lib/python2.7, as it is in the standard library.
Successfully installed argparse-1.2.1
Thanks.
Argparse is maintained as a separate package here: https://pypi.python.org/pypi/argparse
Which is where pip is going to collect it.
But
As of Python >= 2.7 and >= 3.2, the argparse module is maintained
within the Python standard library. For users who still need to
support Python < 2.7 or < 3.2, it is also provided as a separate
package....
So, you are getting the error because it is part of the standard library, but also available to install via pip if you are using a version of Python for which it isn't.
If you really need to install 1.4.0 try this: (worked for me on my Windows 2.7.11 install)
Download the gzip file, not the wheel, from the pypi downloads page
Uncompress the archive and open a terminal in the argparse-1.4.01 folder
Run python setup.py install (See the 'Install' section of first link)
And check you now have the correct version (hopefully):
>>> import argparse
>>> argparse.__version__
'1.4.0'
Note:
This still leaves the original argparse.py (in ...Python27\Lib for me) intact, and places the 1.4.0 egg in site-packages, with an easy-install.pth file which I presume ensures that this version gets used in preference to the standard library one.

How to get Python packages installed as .exe to run on Windows 10; "failed to create process"

After installing Python 3.5.1 on Windows 10 x64, cpplint installed from pip produces the error: failed to create process. There seems to be a possibly related issue with pip related to having a space in the path, which exists in my use case. It seems to be related to how the exe is created. How can this error be remedied? Reinstalling Python and cpplint does not solve the problem.
C:\Users>python -V
Python 3.5.1
C:\Users>pip list
pip (7.1.2)
setuptools (18.2)
C:\Users>pip -V
pip 7.1.2 from c:\users\john hagen\appdata\local\programs\python\python35\lib\site-packages (python 3.5)
C:\Users>pip install cpplint
Collecting cpplint
Using cached cpplint-0.0.6.tar.gz
Installing collected packages: cpplint
Running setup.py install for cpplint
Successfully installed cpplint-0.0.6
C:\Users>where.exe cpplint
C:\Users\John Hagen\AppData\Local\Programs\Python\Python35\Scripts\cpplint.exe
C:\Users>cpplint
failed to create process.
Yep, this is a pip bug.
The workaround is to add quotes around the path in the first line of generated python scripts in the \Scripts\ directory. In the case of cpplint this is 'cpplint-script.py'. In your case the generated first line should something like:
#!c:\users\john hagen\appdata\local\programs\python\python35\python.exe
and should be edited to:
#!"c:\users\john hagen\appdata\local\programs\python\python35\python.exe"

Categories