linuxserver / docker-netbox

GNU General Public License v3.0
79 stars 17 forks source link

Cannot use ImageField because Pillow is not installed #37

Closed natget21 closed 1 year ago

natget21 commented 1 year ago

while using the image lscr.io/linuxserver/netbox:latest on docker raspberry pi 4 net box failed to start with the following log error output

cpu archtecture -> arm64 image.version -> v3.2.5-ls75

deployed with docker-compose file

version: "2.1"
services:
  netbox:
    image: lscr.io/linuxserver/netbox:latest
    container_name: netbox
    environment:
      - PUID=1000
      - PGID=1003
      - TZ=Europe/Rome
      - SUPERUSER_EMAIL=********
      - SUPERUSER_PASSWORD=*******
      - ALLOWED_HOST=192.168.*.*
      - DB_NAME=netbox
      - DB_USER=postgres
      - DB_PASSWORD=******
      - DB_HOST=192.168.*.*
      - DB_PORT=5432
      - REDIS_HOST=192.168.*.*
      - REDIS_PORT=6379
      - REDIS_PASSWORD=*************
      - REDIS_DB_TASK=0
      - REDIS_DB_CACHE=1
     #      - BASE_PATH=<BASE_PATH> #optional
     #      - REMOTE_AUTH_ENABLED=<REMOTE_AUTH_ENABLED> #optional
     #      - REMOTE_AUTH_BACKEND=<REMOTE_AUTH_BACKEND> #optional
     #      - REMOTE_AUTH_HEADER=<REMOTE_AUTH_HEADER> #optional
     #      - REMOTE_AUTH_AUTO_CREATE_USER=<REMOTE_AUTH_AUTO_CREATE_USER> #optional
     #      - REMOTE_AUTH_DEFAULT_GROUPS=<REMOTE_AUTH_DEFAULT_GROUPS> #optional
     #      - REMOTE_AUTH_DEFAULT_PERMISSIONS=<REMOTE_AUTH_DEFAULT_PERMISSIONS> #optional
    volumes:
      - netbox_data:/config
    ports:
      - 8000:8000
    restart: unless-stopped
volumes:
    netbox_data:
        external: true

ERROR LOG Output

running "exec:/usr/bin/python3 ./manage.py remove_stale_contenttypes --no-input" (pre app)...
SystemCheckError: System check identified some issues:
ERRORS:
dcim.DeviceType.front_image: (fields.E210) Cannot use ImageField because Pillow is not installed.
    HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow".
dcim.DeviceType.rear_image: (fields.E210) Cannot use ImageField because Pillow is not installed.
    HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow".
extras.ImageAttachment.image: (fields.E210) Cannot use ImageField because Pillow is not installed.
    HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow".
command "/usr/bin/python3 ./manage.py remove_stale_contenttypes --no-input" exited with non-zero code: 1
Wed Jul 13 01:08:59 2022 - FATAL hook failed, destroying instance
SIGINT/SIGQUIT received...killing workers...
WSGI app 0 (mountpoint='') ready in 8 seconds on interpreter 0xffffb99c4b20 pid: 315 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 315)
spawned uWSGI worker 1 (pid: 334, cores: 1)
[uwsgi-daemons] spawning "/usr/bin/python3 ./manage.py rqworker" (uid: 1000 gid: 1003)
SystemCheckError: System check identified some issues:
ERRORS:
dcim.DeviceType.front_image: (fields.E210) Cannot use ImageField because Pillow is not installed.
    HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow".
dcim.DeviceType.rear_image: (fields.E210) Cannot use ImageField because Pillow is not installed.
    HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow".
extras.ImageAttachment.image: (fields.E210) Cannot use ImageField because Pillow is not installed.
    HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow".
daemon "/usr/bin/python3 ./manage.py rqworker" (pid: 335) annihilated
github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

thespad commented 1 year ago

It's in their requirements.txt and installed as part of the build https://ci.linuxserver.io/blue/organizations/jenkins/Docker-Pipeline-Builders%2Fdocker-netbox/detail/master/324/pipeline/139#step-165-log-210 so the packages should be there.

natget21 commented 1 year ago

It's in their requirements.txt and installed as part of the build https://ci.linuxserver.io/blue/organizations/jenkins/Docker-Pipeline-Builders%2Fdocker-netbox/detail/master/324/pipeline/139#step-165-log-210 so the packages should be there.

yea however it didn't work however I installed an older version of netbox and it works i belive there is some issue in the newer version

thespad commented 1 year ago

I'll have to do some testing on arm because I can't replicate it on x86_64.

DarylStark commented 1 year ago

What version did you install? Cause I downgraded to 3.2.2 and still have the same issue on ARM64.

natget21 commented 1 year ago

What version did you install? Cause I downgraded to 3.2.2 and still have the same issue on ARM64.

linuxserver/netbox:3.1.11

thespad commented 1 year ago

So we made a change with 3.2.0 to install Pillow via pip rather than from the Alpine package repos to fix an issue on x86_64 and it sounds like that might have been the breaking point for arm.

Can you exec into the container and try:

pip3 uninstall pillow
apk add py3-pillow

Then restart the container and see if it starts working.

natget21 commented 1 year ago

this seems to make the installation work perfectly however now i am seeing the error whenever i browse the deployed netbox URL

netbox image version v3.2.6-ls77 cpu archtecture -> arm64 raspberry pi 4 4GB ram . . . last output log

No queues have been specified. This process will service the following queues by default: high, default, low [uwsgi-daemons] spawning "/usr/bin/python3 ./manage.py rqworker" (uid: 1000 gid: 1003) spawned uWSGI worker 1 (pid: 128, cores: 1) uWSGI is running in multiple interpreter mode spawned uWSGI master process (pid: 120) invalid HTTP request size (max 4096)...skip invalid HTTP request size (max 4096)...skip invalid HTTP request size (max 4096)...skip

thespad commented 1 year ago

Can you try adding buffer-size = 32768 to /app/netbox/netbox/uwsgi.ini and restart, see if that fixes the request size errors.

thespad commented 1 year ago

@natget21 @DarylStark could you try docker.io/lsiodev/netbox:3.2.7-pillow and see if it fixes your issues.

DarylStark commented 1 year ago

@natget21 @DarylStark could you try docker.io/lsiodev/netbox:3.2.7-pillow and see if it fixes your issues.

Amazing! It works! It gives me a Bad Request (400) error on the webpage now, but that might be the result of swapping versions so many times and using the same database, so I will troubleshoot that myself.

Thanks for the quick response and the effort. Really appreciated!

natget21 commented 1 year ago

@thespad it's working now thanks. im also getting the bad request but that is due to ALLOWED_HOST config I belive

Can you try adding buffer-size = 32768 to /app/netbox/netbox/uwsgi.ini and restart, see if that fixes the request size errors.

DarylStark commented 1 year ago

Yep, it is indeed due to the ALLOWED_HOST variable. Trying to find how I can add multiple hosts to that var.

thespad commented 1 year ago

Cool, we need to do a few more tests to make sure we're not going to break anything and then I'll get a PR sorted to get the build fixed.

natget21 commented 1 year ago

Yep, it is indeed due to the ALLOWED_HOST variable. Trying to find how I can add multiple hosts to that var.

@DarylStark did you manage to pass the allowed host to skip the bad request ?

I tried these environments

 - ALLOWED_HOSTS = ['*']

 - ALLOWED_HOSTS = ['netbox.domain.com']

  - ALLOWED_HOSTS = ['127.0.0.1','0.0.0.0','192.168.1.2', 'localhost', 'domain.com','netbox.domain.com', '*']
  - USE_X_FORWARDED_HOST=True
  - CORS_ORIGIN_ALLOW_ALL=True

but still, I get the bad request on the front end and on the log

Invalid HTTP_HOST header: 'netbox.domain.com'. You may need to add 'netbox.domain.com' to ALLOWED_HOSTS.

DarylStark commented 1 year ago

Yes, eventually I fixed it in the configuration file. The environment variable you set in the docker-compose.yaml file is only used during initial setup.

natget21 commented 1 year ago

can you tell me where in the configuration you added it? and shouldn't it be copied from the environment upon installation if this is a bug maybe you or @thespad can add it along with the pillow error on the next version realease

DarylStark commented 1 year ago

can you tell me where in the configuration you added it? and shouldn't it be copied from the environment upon installation if this is a bug maybe you or @thespad can add it along with the pillow error on the next version realease

I'm not at home right now so I cannot log in to see where it is exactly, but if you open the configuration file (which should be in /config) you can find the ALLOWED_HOSTS list and you can add domains.

natget21 commented 1 year ago

got it thanks