Install Pillow from PyCharm

Posted by in Software

My environment on windows has a lot of restrictions, including one to prohibit execution of files placed anywhere else except C:\Windows, C:\Program Files and C:\Program Files (x86). Therefore, the virtual environments resides in something like C:\Program Files\Python\virtualenvs.

I’ve set up a virtualenv for my application (from PyCharm) and I have some problems installing packages via pip or easy_install.

Besides that, when installing PIL (or Pillow), pip gets the source and wants to compile it. Apparently, there’s a way to get pip to download a binary package for windows via a wheel option:

$ pip install --use-wheel Pillow

Otherwise, one would need to use easy_install (which uses python eggs):

$ easy_install Pillow

However, in my case both pip and easy install do nothing when ran in command line mode (not even display help when necessary):

Empty command

Empty command

Solution

My solution is to perform the same task via pycharm :) To do that, I’m using the following steps:

  • Create a virtual env via PyCharm (if you haven’t already)
  • Create a new Run/Debug Configuration
  • Select Edit Configurations
  • Select a normal Python configuration
  • Create a configuration pointing to easy_install.py in your virtualenv. Your result should be something like:
    Python configuration

    Python configuration

    Note the Script Parameters being the package you want installed.

  • Run the configuration

After that, PyCharm will install Pillow and your project will have it, without needing a compiler (which was the whole point).

HTH,


A little experiment: If you find this post and ad below useful, please check the ad out :-)