How to install Pillow on Python 3.5? - python-3.x

As the title suggested I have trouble installing Pillow on Python 3.5.2. I believe I already have pip and easyinstall preinstalled. I have viewed some tutorials and attempted to type '>$pip install Pillow' into the IDLE shell but it came back with a syntax error. I am new to programming and have no prior IT exprience so please be specific and put it in simple terms. My OS is Windows 10. Thanks.

sudo pip3 install Pillow - unix-style
pip install Pillow - windows
http://pillow.readthedocs.io/en/3.1.x/installation.html

Installing stuff on ms-windows is such a can of worms that it is probably easiest to use a specialized Python distribution for ms-windows, like Anaconda or Enghought. These come with a lot of packages pre-installed, and have their own package managers to make adding more stuff easier for you.

sudo pip3 install Pillow==5.0.0
This will saves you

Use pip install Pillow. It worked for me

try typing pip in the command line maybe you didn't install pip properly
if you didn't then go to here to install pip

Related

Error installing psycopg2 on macOS with building wheel [duplicate]

I'm attempting to make a website with a few others for the first time, and have run into a weird error when trying to use Django/Python/VirtualEnv. I've found solutions to this problem for other operating systems, such as Ubuntu, but can't find any good solutions for Mac.
This is the relevant code being run:
virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt
After running that block, I get the following errors:
AssertionError
Failed building wheel for django-toolbelt
Running setup.py bdist_wheel for psycopg2
...
AssertionError
Failed building wheel for psycopg2
Failed to build django-toolbelt psycopg2
I believe I've installed the "django-toolbelt" and "psycopg2", so I'm not sure why it would be failing.
The only difference I can think of is that I did not use the command
sudo apt-get install libpq-dev
as was instructed for Ubuntu usage as I believe that installing postgresql with brew took care of the header.
Thanks for any help or insight!
For MacOS users
After trying all the above methods (which did not work for me on MacOS 10.14), that one worked :
Install openssl with brew install openssl if you don't have it already.
add openssl path to LIBRARY_PATH :
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
install psycopg2 with pip pip3 install psycopg2
I had the same problem on Arch linux. I think that it's not an OS dependant problem. Anyway, I fixed this by finding the outdated packages and updating then.
pip uninstall psycopg2
pip list --outdated
pip install --upgrade wheel
pip install --upgrade setuptools
pip install psycopg2
I was also getting same error.
Using Python 3.7.3 and pip 19.1.1.
I used following command.
pip install psycopg2-binary==2.8.3
TDLR
If you aren't used to installing Python C-extensions, and psycopg2 isn't a core part of your work, try
pip install psycopg2-binary
Building Locally
psycopg2 is a C-extension, so it requires compilation when being installed by pip. The Build Prerequisites section of the docs explain what must be done to make installation via pip possible. In summary (for psycopg 2.8.5):
a C compiler must be installed on the machine
the Python header files must be installed
the libpq header files must be installed
the pg_config program must be installed (it usually comes with the libpq headers) and on $PATH.
With these prerequisites satisfied, pip install psycopg2 ought to succeed.
Installing pre-compiled wheels
Alternatively, pip can install pre-compiled binaries so that compilation (and the associated setup) is not required. They can be installed like this:
pip install psycopg2-binary
The docs note that
The psycopg2-binary package is meant for beginners to start playing with Python and PostgreSQL without the need to meet the build requirements.
but I would suggest that psycopg2-binary is often good enough for local development work if you are not using psycopg2 directly, but just as a dependency.
Concluding advice
Read the informative installation documentation, not only to overcome installation issues but also to understand the impact of using the pre-compiled binaries in some scenarios.
I had same problem and this appears to be a Mojave Issue, I was able to resolve with:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
For Mac OS X users:
1. First check your postgresql path by running this command in terminal:
pg_config
If this fails lookup how to add pg_config to your path.
2. Next install Xcode Tools by running this command in terminal:
xcode-select --install
If you have both those sorted out now try to install psycopg2 again
For MacOS users, this question has the correct solution:
install command line tools if necessary:
xcode-select --install
then
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2
I was also facing the same after running all the above commands, but the following two commands worked for me:
Instead of pip, use this:
sudo apt-get install libpq-dev
then run this command:
pip install psycopg2
On OS X, I was able to solve this by simply upgrading wheel before installing psycopg2:
pip install --upgrade wheel
For OSX Sierra users, it seems that an xcode update is the solution: Can't install psycopg2 package through pip install... Is this because of Sierra?
I tried all the above solutions but they did not work for me. What I did was change the psycopg2 version in my requirements.txt file from psycopg2==2.7.4 to psycopg2==2.7.6
Is your error message complete? the most encountered reason for failing to install psycopg2 on mac from pip is pg_config is not in path.
by the way, using macports or fink to install psycopg2 is more recommended way, so you don't have to worry about pg_config, libpq-dev and python-dev.
plus, are using Python 3.5? then upgrage your wheel to > 0.25.0 using pip.
I faced the same issue, but the answers above didn't work for me.
So this is what I did in my requirements.txt
psycopg2-binary==2.7.6.1 and it worked fine
I had this issue on several packages, including psycopg2, numpy, and pandas. I simply removed the version from the requirements.txt file, and it worked.
So instead of psycopg2-binary==2.7.6.1 I just had psycopg2-binary.
I know you are asking for development environment but if you are deploying on server say, Heroku. Just add below line in the requirements.txt of your project.
django-heroku==0.3.1
As this package itself will install the required packages like psycopg2 on server deployment.So let the server(heroku) should take care of it.
sudo apt install libpq-dev python3.X-dev
where X is the sub version,
these should be followed by :
pip install --upgrade wheel
pip install --upgrade setuptools
pip install psycopg2
Enjoy !!!
I solved my problem by updating/installing vs_BuildTools. The link to the software was given in the error itself.
Error Image
Fixed by installing python3.7-dev: sudo apt install python3.7-dev, based on the link.
Python: 3.7
Ubuntu: 20.04.3 LTS

ERROR: torch-1.10.0+cu113-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform

I tried to install pytorch from site using,
pip3 install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio===0.10.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
That didn't work, so I downloaded it from
'https://download.pytorch.org/whl/cu113/torch_stable.html'
and now I have a file called torch-1.10.0+cu113-cp36-cp36m-win_amd64.whl
How do I install it using pip?
pip3 install torch-1.10.0+cu113-cp36-cp36m-win_amd64.whl
You need to ensure you have CPython 3.6 otherwise you may get an error saying the file is not a supported wheel on this platform. Also, this package is compiled for 64bit Windows, so you need to be on that architecture.
More on the naming convention in this answer:
https://stackoverflow.com/questions/37023557/what-does-version-name-cp27-or-cp35-mean-in-python#:~:text=win_amd64%20%2D%20this%20has%20been%20compiled,this%20is%20a%20wheel%20distribution.
Try:
pip install --find-links https://download.pytorch.org/whl/torch_stable.html
torch==1.10.0+cpu

Spyder, clean Win installation, ver. 4.2.3 - pip gives message "No module named pip"

I have Spyder, clean Win10 installation, ver. 4.2.3.
When I run command pip, it gives message:
Note: you may need to restart the kernel to use updated packages.
C:\Users\UserName\AppData\Local\Programs\Spyder\Python\python.exe: No module named pip
I restarted Spyder, Win10, nothing helps.
How to fix it?
Thanks.
(Spyder maintainer here) We don't provide pip in our Windows app to prevent people breaking Spyder by installing any kind of packages with it.
The best way to use other packages that don't come with our app is to install Miniconda, create a conda environment after that with the packages you want to use and spyder-kernels, and finally connect Spyder to that env.
If you have python 3.4+ then pip should be installed with python.
To check that, you can run
pip help
in your windows command line.
However, if it isn't the case then download the get-pip.py file and run
python get-pip.py
and the pip installation should start. You can use pip help to verify this.
Another source of the problem might be that pip isn't listed in your PATH variables and thus isn't recognized by your command line.

If anaconda has a package and it is not in pip, how do I install it?

I want to install gudhi packages.
It seems that the package only says that it can be installed only with anaconda. But I want to install it with pip , not anaconda.
When I checked the package, I found a zip file called tar.bz2, which I tried to install using it, but I can not figure out what to do.
And I do not know if this is the right way.
So I would like to seek advice.
Thank you for reading.
There is no pip install gudhi available.
If you don't want to go with conda, you will have to follow the installation guide.
If make cython works, you can then [sudo] python[3] setup.py install to install it on your system.
[EDIT]
A gudhi pip package is now available.

How can I install cython using cygwin

I want to install cython with help of cygwin. But in cygwin I found many errors regarding header file.
I already install python in Cygwin.
Do not use cygwin, per documentation.
Adding a better-late-than-never answer though I just managed to install it. In the Cygwin installer mark for installation the following items:
python2
python2-pip
python2-devel
Also possible to change python2 to python3. I also installed (don't know if necessary):
gcc-core
gcc-g++
cygwin-devel
Hopefully I didn't forget anything. After completion of the installation, run the Cygwin terminal, and in there run:
pip2 install --upgrade pip
pip2 install --upgrade wheel
pip2 install Cython
And you're done.

Resources