You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
'import imageio' on M1 MacBook with Python 3.9 causes "MemoryError" - installed with conda/pip #665
changed the title [-]import image on M1 MacBook with python 3.9 causes "MemoryError" - installed with conda/pip[/-][+]'import imageio' on M1 MacBook with python 3.9 causes "MemoryError" - installed with conda/pip[/+]on Oct 13, 2021
changed the title [-]'import imageio' on M1 MacBook with python 3.9 causes "MemoryError" - installed with conda/pip[/-][+]'import imageio' on M1 MacBook with Python 3.9 causes "MemoryError" - installed with conda/pip[/+]on Oct 13, 2021
Python 3.9.1rc1 | packaged by conda-forge | (default, Nov 28 2020, 22:21:58)
[Clang 11.0.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import imageio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/samlerman/code/miniforge3/lib/python3.9/site-packages/imageio/__init__.py", line 38, in <module>
from . import plugins
File "/Users/samlerman/code/miniforge3/lib/python3.9/site-packages/imageio/plugins/__init__.py", line 87, in <module>
from . import freeimage
File "/Users/samlerman/code/miniforge3/lib/python3.9/site-packages/imageio/plugins/freeimage.py", line 13, in <module>
from ._freeimage import fi, download, IO_FLAGS, FNAME_PER_PLATFORM # noqa
File "/Users/samlerman/code/miniforge3/lib/python3.9/site-packages/imageio/plugins/_freeimage.py", line 1332, in <module>
fi = Freeimage()
File "/Users/samlerman/code/miniforge3/lib/python3.9/site-packages/imageio/plugins/_freeimage.py", line 428, in __init__
def error_handler(fif, message):
MemoryError
@almarklein agreed. I think lazy-loading/lazy-importing any plugin on first use sounds like a better solution. However, I don't have a lot of free time to implement stuff at the moment.
Do you know if freeimage is still actively maintained? Their website looks a bit dated and their last release is from a few years ago. If it isn't maintained anymore, then we may need to adjust to that.
Yes, if you install ImageIO in a conda environment and imageio-ffmpeg on a bare-metal /system default python (via pip install) then you will end up with each package being installed in a separate environment. Both ImageIO and imageio-ffmpeg are on conda-forge, so you should be able to conda install imageio imageio-ffmpeg.
Dang. Is there any way to get it to work through pip? My school cluster seems to bug for some reason when I enable the conda-forge channel. I'm using a conda .yml file which downloads imageio and imageio-ffmpeg through pip.
Conda is something I never really picked up. My projects live either in a venv (via poetry) or bare-metal so this is, unfortunately, outside of my area of expertise. However, @anjos might know.
@anjos The problem is that @slerman12 is installing imageio and imageio-ffmpeg through pip into a conda environment, and that imageio doesn't find the ffmpeg executable afterwards. Do you know why this could be and if there is an easy fix for it?
Likely, the base conda environment @slerman12 is installing imageio-ffmeg does not contain the ffmpeg binary. If you install ffmpeg on that environment, does that fix it?
The conda-forge imageio-ffmpeghas a direct dependence on ffmpeg. This level of control is possible because conda/mamba can have non-Python dependencies (contrary to pip/setuptools). For pip-based installs, I guess this must be manually handled somehow.
Activity
[-]import image on M1 MacBook with python 3.9 causes "MemoryError" - installed with conda/pip[/-][+]'import imageio' on M1 MacBook with python 3.9 causes "MemoryError" - installed with conda/pip[/+][-]'import imageio' on M1 MacBook with python 3.9 causes "MemoryError" - installed with conda/pip[/-][+]'import imageio' on M1 MacBook with Python 3.9 causes "MemoryError" - installed with conda/pip[/+]FirefoxMetzger commentedon Oct 13, 2021
Hi @slerman12 , could you provide the full stack trace of the
MemoryError?slerman12 commentedon Oct 13, 2021
almarklein commentedon Oct 13, 2021
I did not even realize that we were trying to load the freeimage lib by default. We probably shouldn't.
Also, I have no idea what the plans of the freeimage devs are for providing binaries for M1.
FirefoxMetzger commentedon Oct 13, 2021
@almarklein agreed. I think lazy-loading/lazy-importing any plugin on first use sounds like a better solution. However, I don't have a lot of free time to implement stuff at the moment.
Do you know if freeimage is still actively maintained? Their website looks a bit dated and their last release is from a few years ago. If it isn't maintained anymore, then we may need to adjust to that.
almarklein commentedon Oct 18, 2021
From what you say it looks like it isn't really. I recall there was a port on Github at some point.
Me neither. But making the import lazy is something that an outside contributor could do relatively easily:
FNAME_PER_PLATFORManddownloadfrom_freeimage.pytofreeimage.pyfreeimage.pyinitializefiandIO_FLAGSto None, and create a small function to import and set these (as globals) later.fiis used, check iffiisNoneand if so call that function.That should do the trick.
kmilos commentedon Oct 18, 2021
There are some commits happening, but no idea about roadmap. As far as forks go, I know WinIMerge are maintaining their own for example...
slerman12 commentedon Sep 29, 2022
Hi, is there still a known bug with M1 Mac? I get the following error:
RuntimeError: No ffmpeg exe could be found. Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.FirefoxMetzger commentedon Sep 29, 2022
@slerman12 Your error doesn't sound like it is related to this issue. Instead, you simply didn't perform the post-install step needed to get the ffmpeg plugin. In the docs on the ffmpeg plugin you can find how to do this: https://imageio.readthedocs.io/en/stable/_autosummary/imageio.plugins.ffmpeg.html#module-imageio.plugins.ffmpeg
slerman12 commentedon Sep 29, 2022
The strange thing is I definitely have installed imageio-ffmpeg.
pip install imageio-ffmpegHowever, when I run the recommended install
pip install imageio[ffmpeg], I get this error, might be a mistake:zsh: no matches found: imageio[ffmpeg].FirefoxMetzger commentedon Sep 29, 2022
@slerman12 Which version of ImageIO are you using?
slerman12 commentedon Sep 29, 2022
I tried the latest version and
2.9.0.slerman12 commentedon Sep 29, 2022
Is it possible that it's because I installed within a conda environment?
FirefoxMetzger commentedon Sep 29, 2022
Yes, if you install ImageIO in a conda environment and
imageio-ffmpegon a bare-metal /system default python (via pip install) then you will end up with each package being installed in a separate environment. Both ImageIO andimageio-ffmpegare on conda-forge, so you should be able toconda install imageio imageio-ffmpeg.slerman12 commentedon Sep 29, 2022
I had it installed in conda, but through pip. I uninstalled from pip, re-installed with conda, and it works. :)
slerman12 commentedon Sep 29, 2022
Dang. Is there any way to get it to work through pip? My school cluster seems to bug for some reason when I enable the conda-forge channel. I'm using a conda .yml file which downloads
imageioandimageio-ffmpegthrough pip.FirefoxMetzger commentedon Sep 30, 2022
Conda is something I never really picked up. My projects live either in a venv (via poetry) or bare-metal so this is, unfortunately, outside of my area of expertise. However, @anjos might know.
@anjos The problem is that @slerman12 is installing imageio and imageio-ffmpeg through pip into a conda environment, and that imageio doesn't find the ffmpeg executable afterwards. Do you know why this could be and if there is an easy fix for it?
anjos commentedon Sep 30, 2022
Likely, the base conda environment @slerman12 is installing imageio-ffmeg does not contain the
ffmpegbinary. If you installffmpegon that environment, does that fix it?The conda-forge
imageio-ffmpeghas a direct dependence on ffmpeg. This level of control is possible because conda/mamba can have non-Python dependencies (contrary to pip/setuptools). For pip-based installs, I guess this must be manually handled somehow.