python/django - "Cannot use ImageField because Pillow is not installed"

I was too getting same problem while implememnting Image Upload using CLoudinary , but found the Above answer, but in some other way.

 sudo pip uninstall PIL

 sudo pip uninstall Pillow

 sudo pip install Pillow

After that mine Problem was solved !


I was having this problem on a Mac with Python 3.6.4. The solution was to uninstall Pillow 5.1.0 and instead install 5.0.0.

pip uninstall Pillow
pip install Pillow==5.0.0

I tried :

  • Reinstall globaly PIL by compiling "Imaging-1.1.7" using some instructions here, but didn't work
  • Reinstall Pillow and it's dependency globally using that link, but didn't work
  • Reinstall GCC4.2 using this link, but it didn't work

I finally figured out I was in the case described in the wonderfull answer to this post. In other words, I am running a mac whose CPU is capable of 64bit but whose kernel firmware is set to 32bit. Which is a problem as the project I'm working on was built for 64bit.

As explained in that post, when you install python3 using an installer (DMG) it will sniff if the kernel is set to 32 bit and install 32bit version of python 3 accordingly. But if you just download the tarball source from python's website and install it with :

cd Python-3.4.1
./configure
make
sudo make install

Then the 64bit version of python3 should be installed. Which you can verify by doing :

file /usr/local/bin/python3
/usr/local/bin/python3: Mach-O 64-bit executable x86_64

That done, all problems are gone with PIL/Pillow in the virtualenv using this 64bit version of python3. Even the pip downgrade became unnecessary.