Closed kaikiat closed 2 years ago
The python3.9 docker image ships its build of python in /usr/local/bin/python3. This is independent of the underlying distribution's copy of python in /usr/bin/python. When you install python3-magic it goes into /usr/lib/python3/dist-packages/ and is only visible to the distribution install. e.g, you can run /usr/bin/python3 and then import magic
works.
The second issue is that your requirements.txt is specifying platform_system requirements that will exclude this docker image (which is linux). The third issue is that python-magic-bin is a fork of python-magic that includes binaries, but it's not the one in this repo.
So tl;dr you should:
apt install libmagic1
in the container, you don't need libmagic1-dev or python3-magicplatform_system
requirements in your requirements.txtThanks it works as expected !
I am getting this error when I try to use Docker + python-magic in my project.
This is my Dockerfile. I have tried installing
libmagic-dev
andlibmagic1libmagic1
andpython3-magic
but it does not seem to work.And this is a portion of my requirements.txt
I am not sure if you have knowledge on this and any help will be greatly appreciated. Thank you!