0

Instead of:

scipy.misc.imsave(category + '/' + str(i) + '.jpg', image) 

I am using:

imageio.imwrite(category + '/' + str(i) + '.jpg', image)

And it's giving me the following error:

error in image: 6078 - Imageio Pillow plugin requires Pillow lib.

Pillow is installed

What should I look into?

David Buck
  • 3,752
  • 35
  • 31
  • 35
  • Have you installed `pillow`? You can install/update it by running `pip install --upgrade pillow` – Anwarvic Nov 20 '19 at 06:26
  • Yes, it tells me: Requirement already up-to-date: pillow in c:\users\laura\anaconda3\envs\fer-env\lib\site-packages (6.2.1) – user12401882 Nov 20 '19 at 06:38
  • Are you using a virtual environment or do you have mutliple versions of python? – Anwarvic Nov 20 '19 at 06:43
  • Using a virtual environment in this case! – user12401882 Nov 20 '19 at 06:45
  • 1
    Then, try running `pip install --target c:\users\laura\anaconda3\envs\fer-env\lib\site-packages --upgrade pillow` – Anwarvic Nov 20 '19 at 06:50
  • Using cached https://files.pythonhosted.org/packages/2c/ee/289ddb9884665aba9ad10d88c4edf867b87bcb93e3acbeeac41d30d87865/Pillow-6.2.1-cp36-cp36m-win_amd64.whl ERROR: imgaug 0.2.9 requires opencv-python, which is not installed. ERROR: imgaug 0.2.9 has requirement numpy>=1.15.0, but you'll have numpy 1.14.3 which is incompatible. Installing collected packages: pillow Successfully installed pillow-6.2.1 – user12401882 Nov 20 '19 at 06:54
  • And this is what I get: error in image: 0 - cannot import name '_imaging' from 'PIL' (C:\Users\laura\Anaconda3\envs\FER-env\lib\site-packages\PIL\__init__.py) error in image: 1 - Imageio Pillow plugin requires Pillow lib. – user12401882 Nov 20 '19 at 06:56
  • Have you activated the virtual environment before installing?? – Anwarvic Nov 20 '19 at 07:06
  • What is the python version in the virtual environment? – Anwarvic Nov 20 '19 at 07:23
  • Python 3.7.3 and yes, I installed it when the virtual environment was activated! (Thank you so much so far btw) – user12401882 Nov 20 '19 at 08:29
  • I suggest creating another virtual environment, activate it and install `imagio` using conda instead of `pip` by running `conda install -c anaconda pillow` – Anwarvic Nov 20 '19 at 09:17
  • So, I think the error was due to the fact that the python version in the virtual env was 3.7.3 and the version on my system 3.6.5. I now created a new virtual env with 3.6.5 and it works :) Thanks!! – user12401882 Nov 20 '19 at 09:30
  • Glad I could help, I've added an answer to help other people – Anwarvic Nov 20 '19 at 09:57

1 Answers1

0

I believe this could happen due to one of these reasons:

  • You have two versions of python
  • You are using a virtual environment created with conda and you're installing imageio using pip.

Either way, you can follow these steps to solve your issue:

  • Create a conda virtual environment. The following command will create a virtual environment called env:
conda create -n env
  • Activate the virtual environment using:
conda activate env
  • Install imageio using:
conda install -c anaconda pillow
Anwarvic
  • 12,156
  • 4
  • 49
  • 69