2

Using python3, I am unable to import the imageio module into my python program, which I need, as I try to animate a list of PNG images I have. Thus far I have tried:

"pip3 install imageio" both running as myself and as root. The install succeeded, but it still errors out as in the subject line. I suppose I could try "apt-get install (package name)", but need to determine the package_name.

Any ideas more than welcome - TIA.

Scott Hunter
  • 48,888
  • 12
  • 60
  • 101
user3063547
  • 739
  • 1
  • 8
  • 18
  • My mistake. I typed imageio into the tag space and it must have expanded to javax.imageio. It should just be "imageio". For reference, found this snippet of code elsewhere on stackoverflow for doing animation of gif files: import imageio ims = [imageio.imread(f) for f in list_of_im_paths] imageio.mimwrite(path_to_save_gif, ims) – user3063547 Feb 23 '22 at 21:07
  • I found a way to do it without imageio (just matplotlib) at stackoverflow:https://stackoverflow.com/questions/61716066/creating-an-animation-out-of-matplotlib-pngs – user3063547 Feb 23 '22 at 22:53
  • What error message are you getting? – FirefoxMetzger Mar 01 '22 at 13:25
  • import imageio ModuleNotFoundError: No module named 'imageio' – user3063547 Mar 02 '22 at 16:07
  • Sounds like you are installing it for a different version of python than you are using later on. Have you tried `python -m pip install imageio` or - if you are on a UNIX system - `python3 -m pip install imageio`? (if you are using conda or venv this might also affect things) – FirefoxMetzger Mar 03 '22 at 08:34
  • Thanks so much for that. I succeeded with "python3 -m pip install imageio" in that it installed imageio, and now when I run the python code and "import imageio" I don't see the import error any longer. Greatly appreciate it! – user3063547 Mar 04 '22 at 19:36
  • I am having a similar issue. I also can't import imageio from a venv. I have tried `subprocess.check_call([sys.executable, '-m', 'pip', '-q', 'install', '--user', '--force-reinstall', '--upgrade', 'imageio'])` to try and install it for the user and the embedded python executable, but still cannot import. – WASasquatch Apr 24 '23 at 20:53

1 Answers1

2

Try importing the last version.

import imageio.v3 as iio

im = iio.imread('imageio:chelsea.png')
print(im.shape)  # (300, 451, 3)

ref https://imageio.readthedocs.io/en/stable/examples.html

Seba R
  • 31
  • 5