linuxserver / docker-blender

Responsive web accessible Blender Docker container with hardware acceleration.
GNU General Public License v3.0
63 stars 15 forks source link

[BUG] Blender version mismatch and missing Draco encoder #13

Closed leota closed 2 months ago

leota commented 2 months ago

Is there an existing issue for this?

Current Behavior

I'm using the image linuxserver/blender:4.2.1 but when running blender --version I get Blender 4.0.2. I'm expecting Blender 4.2.1 instead. Besides that, when trying to export a scene in GLTF format using compression I'm getting: ERROR: Draco mesh compression is not available because library could not be found at /usr/bin/4.0/python/lib/python3.12/site-packages/libextern_draco.so

Full error:

Blender 4.0.2
Read blend: "/app/cube.blend"
Warning: region type 14 missing in space type "Image" (id: 6) - removing region
regiondata free error
Warning: region type 15 missing in space type "Image" (id: 6) - removing region
Warning: region type 14 missing in space type "Image" (id: 6) - removing region
regiondata free error
Warning: region type 15 missing in space type "Image" (id: 6) - removing region
Warning: region type 14 missing in space type "Image" (id: 6) - removing region
regiondata free error
Warning: region type 15 missing in space type "Image" (id: 6) - removing region
Warning: region type 14 missing in space type "Image" (id: 6) - removing region
regiondata free error
Warning: region type 15 missing in space type "Image" (id: 6) - removing region
Error: Engine 'BLENDER_EEVEE_NEXT' not available for scene 'Scene' (an add-on may need to be installed or enabled)
Warning: File written by newer Blender binary (402.66), expect loss of data!
18:31:17 | ERROR: Draco mesh compression is not available because library could not be found at /usr/bin/4.0/python/lib/python3.12/site-packages/libextern_draco.so
Traceback (most recent call last):
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/__init__.py", line 752, in execute
    from .blender.exp import gltf2_blender_export
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 16, in <module>
    from . import gltf2_blender_gather
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather.py", line 11, in <module>
    from . import gltf2_blender_gather_nodes
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py", line 15, in <module>
    from . import gltf2_blender_gather_tree
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py", line 7, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
Error: Python: Traceback (most recent call last):
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/__init__.py", line 752, in execute
    from .blender.exp import gltf2_blender_export
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 16, in <module>
    from . import gltf2_blender_gather
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather.py", line 11, in <module>
    from . import gltf2_blender_gather_nodes
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py", line 15, in <module>
    from . import gltf2_blender_gather_tree
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py", line 7, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
Location: /usr/share/blender/scripts/modules/bpy/ops.py:109
Traceback (most recent call last):
  File "/app/script.py", line 25, in <module>
    main()
  File "/app/script.py", line 21, in main
    export_to_gltf("/app/out.gltf")
  File "/app/script.py", line 11, in export_to_gltf
    bpy.ops.export_scene.gltf(
  File "/usr/share/blender/scripts/modules/bpy/ops.py", line 109, in __call__
    ret = _op_call(self.idname_py(), kw)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Error: Python: Traceback (most recent call last):
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/__init__.py", line 752, in execute
    from .blender.exp import gltf2_blender_export
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_export.py", line 16, in <module>
    from . import gltf2_blender_gather
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather.py", line 11, in <module>
    from . import gltf2_blender_gather_nodes
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py", line 15, in <module>
    from . import gltf2_blender_gather_tree
  File "/usr/share/blender/scripts/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py", line 7, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
Location: /usr/share/blender/scripts/modules/bpy/ops.py:109

Blender quit
Error: Not freed memory blocks: 4, total unfreed memory 0.000092 MB

Expected Behavior

I expect the Blender version to match the image version, and the GLTF export to work properly with Draco compression.

Steps To Reproduce

  1. Build this image:
FROM linuxserver/blender:4.2.1

WORKDIR /app

COPY cube.blend /app
COPY script.py /app

CMD tail -f /dev/null

with script.py being:

import bpy
import sys
import os

def load_blend_file(file_path):
    bpy.ops.wm.open_mainfile(filepath=file_path)

def export_to_gltf(file_path):
    bpy.ops.export_scene.gltf(
        filepath=file_path,
        export_draco_mesh_compression_enable=True,
        export_draco_mesh_compression_level=6,
        export_apply=True,
    )

def main():
    load_blend_file("/app/cube.blend")
    export_to_gltf("/app/out.gltf")

if __name__ == "__main__":
    main()

and cube.blend just the default scene with a Cube.

  1. docker build -t blender-4.2.1 .
  2. docker run -d --rm --name blender-container blender-4.2.1
  3. docker exec -it blender-container /bin/bash
  4. blender -b -P script.py

Environment

- OS: MacOS 14.4
- How docker service was installed: Mac installer, run with Docker.app

CPU architecture

arm64

Docker creation

docker build -t blender-4.2.1 .
docker run -d --rm  --name blender-container blender-4.2.1

### Container logs

```bash
2024-08-31 19:25:36 [migrations] started
2024-08-31 19:25:36 [migrations] no migrations found
2024-08-31 19:25:36 usermod: no changes
2024-08-31 19:25:36 ───────────────────────────────────────
2024-08-31 19:25:36 
2024-08-31 19:25:36       ██╗     ███████╗██╗ ██████╗
2024-08-31 19:25:36       ██║     ██╔════╝██║██╔═══██╗
2024-08-31 19:25:36       ██║     ███████╗██║██║   ██║
2024-08-31 19:25:36       ██║     ╚════██║██║██║   ██║
2024-08-31 19:25:36       ███████╗███████║██║╚██████╔╝
2024-08-31 19:25:36       ╚══════╝╚══════╝╚═╝ ╚═════╝
2024-08-31 19:25:36 
2024-08-31 19:25:36    Brought to you by linuxserver.io
2024-08-31 19:25:36 ───────────────────────────────────────
2024-08-31 19:25:36 
2024-08-31 19:25:36 To support LSIO projects visit:
2024-08-31 19:25:36 https://www.linuxserver.io/donate/
2024-08-31 19:25:36 
2024-08-31 19:25:36 ───────────────────────────────────────
2024-08-31 19:25:36 GID/UID
2024-08-31 19:25:36 ───────────────────────────────────────
2024-08-31 19:25:36 
2024-08-31 19:25:36 User UID:    911
2024-08-31 19:25:36 User GID:    911
2024-08-31 19:25:36 ───────────────────────────────────────
2024-08-31 19:25:36 Linuxserver.io version: 4.2.1-ls125
2024-08-31 19:25:36 Build-date: 2024-08-29T14:46:52+00:00
2024-08-31 19:25:36 ───────────────────────────────────────
2024-08-31 19:25:36     
2024-08-31 19:25:37 [custom-init] No custom files found, skipping...
2024-08-31 19:25:37 [ls.io-init] done.
2024-08-31 19:25:37 Obt-Message: Xinerama extension is not present on the server
2024-08-31 19:25:37 ObRender-Message: Cannot load image "/blender/blender.svg" from file "/blender/blender.svg"
2024-08-31 19:25:37 19
2024-08-31 19:25:36 ...........+..+....+...........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..+.+......+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..........+.+.....+...+.+......+.....+.......+......+......+.....+....+......+...+...+........+.........+......+.....................+.+.....+.......+..+...............+...+.+......+...........+...+....+...+.....+...+....+...+..+......+.......+..+.+......+...........+.............+.........+..+....+.........+..+....+......+...........+.......+..+...+.+...........+...............+.+..+...+....+.....+................+..+...+.......+.....+.+.....+....+...+.......................+..........+......+.....+......+...+.+.....+.............+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2024-08-31 19:25:37 .......+....+...............+.....+.......+......+...............+...+.....+.+......+..+.+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.+...+..............+...+....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.....+......+..+.+.....+.+......+..+..........+..+.+............+...............+...............+..+...+......+....+........+...+.+.....+....+......+...........+.......+...........+......+....+...........+..........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2024-08-31 19:25:37 -----
2024-08-31 19:25:37 _XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
2024-08-31 19:25:37 
2024-08-31 19:25:37 Xvnc KasmVNC 1.2.0 - built Aug 28 2024 20:01:21
2024-08-31 19:25:37 Copyright (C) 1999-2018 KasmVNC Team and many others (see README.me)
2024-08-31 19:25:37 See http://kasmweb.com for information on KasmVNC.
2024-08-31 19:25:37 Underlying X server release 12014000, The X.Org Foundation
2024-08-31 19:25:37 
2024-08-31 19:25:37 The XKEYBOARD keymap compiler (xkbcomp) reports:
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86CameraAccessEnable
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86CameraAccessDisable
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86CameraAccessToggle
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86NextElement
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86PreviousElement
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86AutopilotEngageToggle
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86MarkWaypoint
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86Sos
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86NavChart
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86FishingChart
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86SingleRangeRadar
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86DualRangeRadar
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86RadarOverlay
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86TraditionalSonar
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86ClearvuSonar
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86SidevuSonar
2024-08-31 19:25:37 > Warning:          Could not resolve keysym XF86NavInfo
2024-08-31 19:25:37 Errors from xkbcomp are not fatal to the X server
2024-08-31 19:25:37 MESA: error: ZINK: failed to choose pdev
2024-08-31 19:25:37 glx: failed to create drisw screen
github-actions[bot] commented 2 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

aptalca commented 2 months ago

Regarding version: https://github.com/linuxserver/docker-blender?tab=readme-ov-file#arm-devices

Regarding script: we don't support custom docker builds or running manual commands inside the container

Regarding plugin: you can install additional packages via this mod: https://github.com/linuxserver/docker-mods/tree/universal-package-install

leota commented 2 months ago

Thanks for the quick reply. It does make sense now!