0

I am trying to install Pillow for my Python (Version 2.7.12). However, I heard that PIL and Pillow cannot co-exist in the system. So I tried to uninstall PIL from my system with the following code

sudo pip uninstall pil

But it did not work and an error popped up

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main

Can I ask what that means? And how can I completely remove PIL in order for me to install Pillow.

Thank you so much for the help in advanced

Tommy

  • Which version of `pip` do you have? (You can check running `pip --version`) – Danibix May 10 '18 at 08:36
  • Hi Danibix, Im using 10.0.1. – user1127763 May 10 '18 at 08:55
  • Pillow is packaged as python-pil and python3-pil in all currently supported versions of Ubuntu, and it has replaced the discontinued PIL project in the default Ubuntu repositories since Ubuntu 13.04. You should uninstall pillow that you installed with pip and install python-pil and/or python3-pil instead. Source: https://askubuntu.com/questions/832943/python-not-finding-file-that-exists/922495#922495 – karel May 10 '18 at 09:16

1 Answers1

0

According to this discussion on Github, it seems that it has been introduced a change in pip library that breaks it.

The suggested solution for the moment is to downgrade the version of pip to 9.0.3

pip install --user --upgrade pip==9.0.3
Danibix
  • 2,047
  • 2
  • 18
  • 27
  • Thank you so much for the help. I tried to downgrade it using your suggest but I get the following error. Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip-9.0.3.dist-info' Consider using the `--user` option or check the permissions. – user1127763 May 10 '18 at 09:18
  • @user1127763 I've updated the answer. If it doesn't work also with this method, try to run the command as superuser, using `sudo` to run the command. – Danibix May 10 '18 at 09:22