Automatically use locally available version libfreeimage
See original GitHub issueWhat would it take to make this package try to automatically use the pre-installed version of that library instead of downloading its own copy? (N.B. I realise that $IMAGEIO_FREEIMAGE_LIB
may be set on the user environment to point to a common installation of the file, however, I’m looking for an automated solution.)
For example, in conda-forge, freeimage is currently available for installation (https://anaconda.org/conda-forge/freeimage, v3.18), in a variety of platforms. One of the issues I’m trying to improve is the support for different OS/architecture types. Specifically, I’d like to have support of OSX/arm64 (new M1 macs). This would be possible by setting $IMAGEIO_FREEIMAGE_LIB
, however, this would be a little bit uglier from a packaging perspective. Moreover, not all packaging systems support this kind of strategy.
Furthermore, as of now, everytime a new combination of os/hardware is introduced, you must ensure that the binary is available remotely, on the freeimage repository, and then patch imageio to make it work for that new OS/arch combination. An auto-detection would allow one to benefit from the existing library if available w/o an extra effort.
Another side effect of this behaviour is that you need to have some sort of external directory in which we are caching the downloaded freeimage library. If no environment variable is set, multiple users (benefiting from a global imageio installation) will end up downloading multiple copies of this file. An auto-detect strategy would make this package a bit more “unmutable” after installation.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (10 by maintainers)
Top GitHub Comments
With conda (at least I tested on Windows), imageio will “automatically” use the installed freeimage library (it searches the known locations and shared library names). Not as elegant as you suggest, but seems to work for most known environments so far…
For example, with MSYS2 packages, the shared system library can also be detected (known location and filename), so freeimage is added as an optional dependency in the package manager and we removed the binary download scripts to avoid any problems.
@anjos Yep, see also https://github.com/imageio/imageio/issues/628#issuecomment-838470536 (and similar comments across issues). The idea is to eventually move the FreeImage backend into its own repo and make it a dependency that can be installed via
pip install imageio[freeimage]
.