I am running a production docker setup right now - freshly installed from inventree:latest. When uploading a WebP image file to a part, I get an Error (loosely translated back to english):
Lade ein gültiges Bild hoch. Die hochgeladene Datei ist entweder kein Bild oder ein beschädigtes Bild.
EN: upload a valid image file. The uploaded file is either not an image or damaged
As discussed in #2993 the necessary dependencies should already be part of the docker install - has anything changed here? what package should I check for on my system?
InvenTree-Version: 0.10.0 dev
Django Version: 3.2.16
Commit Hash: 26f71b3
Commit Date: 2023-01-26
Database: postgresql
Debug-Mode: False
Deployed using Docker: True
Active plugins: [{'name': 'IPNAutoGenerator', 'slug': 'ipnautogenerator', 'version': None}, {'name': 'Brother Labels', 'slug': 'brother', 'version': '0.6.0'}]
No response
@simonkuehling can you provide an example image file that is failing for you?
And, are you uploading the file from your computer, or "downloading" via URL?
@SchrodingersGat I am uploading the file from my computer and tried a variety of different .webp files to be sure.
Just tested against this example image from the Google WebP site as well: https://www.gstatic.com/webp/gallery/1.webp
@SchrodingersGat whatever is needed, sure!
I tried looking at the console via docker attach inventree-server
, but could not get any error output more than Bad Request: /api/part/171/
when upoading a local file from my computer.
When loading from a URL I see a slightly more useful message:
/root/.local/lib/python3.9/site-packages/PIL/Image.py:3281: UserWarning: image file could not be identified because WEBP support not installed
warnings.warn(message)
Bad Request: /api/part/171/
This is what is installed inside the inventree-server docker:
$ docker exec inventree-server pip show Pillow
Name: Pillow
Version: 9.4.0
Summary: Python Imaging Library (Fork)
Home-page: https://python-pillow.org
Author: Alex Clark (PIL Fork Author)
Author-email: [email protected]
License: HPND
Location: /root/.local/lib/python3.9/site-packages
Requires:
Required-by: brother-ql-inventree, django-stdimage, pdf2image, weasyprint
Does this help?
I installed strictly following the installation instructions form https://docs.inventree.org/en/latest/start/docker_prod/ - so it is running the image from docker hub... The system is a Raspbian GNU/Linux 11 (bullseye)
(on a Raspberry Pi 3B+).
Further digging shows:
$ docker exec inventree-server apt list webp
Listing...
webp/stable,now 0.6.1-2.1 armhf [installed]
$ docker exec inventree-server apt list libwebp-dev
Listing...
libwebp-dev/stable 0.6.1-2.1 armhf
I see on some other projects that the libwebp-dev package is mentioned as a dependency for Pillow (rather than webp
) - could this be something?
[EDIT]
In the Pillow docs I found libwebp-dev
as a requirement as well:
https://pillow.readthedocs.io/en/stable/installation.html
Their reference Dockerfile for Debian 11 includes it as well:
https://github.com/python-pillow/docker-images/blob/main/debian-11-bullseye-x86/Dockerfile
I get the same output:
(env) [email protected]:/home/inventree# apt list webp
Listing... Done
webp/stable,now 0.6.1-2.1 amd64 [installed]
The only major difference I can see is that you're running on rasbian?
@simonkuehling as I cannot replicate and don't have a rasbian setup to replicate on, if you can have a poke around and try to work out why this is failing, that'd be great.
@SchrodingersGat I have been digging a bit and had some success so far:
First, to validate I checked for webp support in the Pillow features inside the inventree-server
container:
$ docker exec -it inventree-server /bin/bash
[email protected]:/home/inventree/InvenTree# python
[...]
>>> from PIL import features
>>> print (features.check_module('webp'))
False
Then I installed the libwebp-dev
package via apt (still inside the container bash) and reinstalled Pillow
[email protected]:/home/inventree/InvenTree# apt install libwebp-dev
[email protected]:/home/inventree/InvenTree# pip install --upgrade --force-reinstall --no-cache-dir Pillow
Now I get a True
for the feature:
[email protected]:/home/inventree/InvenTree# python
[...]
>>> from PIL import features
>>> print (features.check_module('webp'))
True
I do not know how to restart the InvenTree server from within the container right now - I guess the changes I just made won't be persistent when I restart the whole container, right? Can you give me a hint for this?
Very interesting...
My suggestion for how to test the server with the correct pillow setup: Stay in the bash session (after you have installed libwebp-dev as above) and then run the following command to start the web server:
gunicorn -c ./gunicorn.conf.py InvenTree.wsgi -b 0.0.0.0:8000 --chdir ./InvenTree
@simonkuehling looks like it for sure. Can you submit a PR for adding this to the dockerfile? Nice work figuring this out :)
Sure, the pull request is submitted at #4335
Owner Name | inventree |
Repo Name | InvenTree |
Full Name | inventree/InvenTree |
Language | Python |
Created Date | 2017-03-23 |
Updated Date | 2023-03-31 |
Star Count | 2586 |
Watcher Count | 61 |
Fork Count | 411 |
Issue Count | 141 |
Issue Title | Created Date | Updated Date |
---|