CircleCI-Public / cimg-python

The Next-Gen CircleCI Python Docker Convenience Image.
https://circleci.com/developer/images/image/cimg/python
MIT License
32 stars 30 forks source link

Libmagic missing since update to `3.9.15` #161

Closed timobrembeck closed 1 year ago

timobrembeck commented 1 year ago

I use python-magic in my project https://github.com/digitalfabrik/integreat-cms and since the update from 3.9.14 to 3.9.15, my builds fail with:

import magic
  File "/home/circleci/project/.venv/lib/python3.9/site-packages/magic/__init__.py", line 209, in <module>
    libmagic = loader.load_lib()
  File "/home/circleci/project/.venv/lib/python3.9/site-packages/magic/loader.py", line 49, in load_lib
    raise ImportError('failed to find libmagic.  Check your installation')
ImportError: failed to find libmagic.  Check your installation

I'm not sure whether it was just a coincidence that libmagic was installed before and now isn't anymore, but just wanted to let you know that the update had this side effect. For the moment, I just downgraded the image tag. Please let me know whether this was unintentional and will be added again in future versions of this image, or whether I should install this dependency separately in my CircleCI workflow. Thanks a lot in advance!

FelicianoTech commented 1 year ago

Investigating

merwan commented 1 year ago

Same issue here with the upgrade from 3.8.14 to 3.8.15, downgrading temporarily until this issue is fixed or we have directions on whether we should manage the dependency by ourselves

FelicianoTech commented 1 year ago

Okay so these were removed and it looks to have happened with the change in the base image from Ubuntu 20.04 to 22.04. We will re-add these libraries and respin these two images so that they are fixed.

I'll update here when they are ready for you to use again.


While I work on this, quick tip I like to give people and one I follow for my own projects. If you identify dependencies for your project, I would install them in your CI config regardless on whether or not our images have them. This way, in a situation like this, your builds won't break. If our images already have it, the package manager will say so and won't do anything (thus saving you time). This tip may not work for every situation but can be helpful.

FelicianoTech commented 1 year ago

These images have been updated and this issue should be resolved.

merwan commented 1 year ago

Thanks for the tip to add dependencies needed for a project, however it can be quite cumbersome in some cases. Here, libmagic is a dependency of a dependency, and the package is very widely used as stated in the fix for the base image: https://github.com/CircleCI-Public/cimg-base/commit/29db736b0339cd9aa604d21c9530f57e0d4f4743

That being said, thanks for the update, this solves the issue on our side with the following python:3.8 image:

cimg/python:3.8:
  using image cimg/python@sha256:bc11a82befac6618d9f1b4ac3ec05de2c48d6c3b2a11e50a9928d4b979ac4f1e
FelicianoTech commented 1 year ago

Seems like the fix worked well, closing.