Blender Cycles runs inside Docker cannot find any device in #72550

Closed
opened 2019-12-18 16:40:35 +01:00 by Hai Vu · 14 comments

System Information
Operating system: Ubuntu 18.04.3
Graphics card: NVIDIA Quadro P6000
Docker version: 19.03.5
Driver version: 435.21
CUDA version: 10.1
OpenGL version string: 4.6.0 NVIDIA 435.21

Blender Version
Broken: 2.80, 2.81, 2.81a from this URL
Worked: 2.79b

Short description of error
Cycles Engine does not find any render device in Docker.
len(bpy.context.preferences.addons['cycles'].preferences.devices) = 0
Tried on any nvidia/cuda tag ubuntu18.04 version 10+ image.

Exact steps for others to reproduce the error

  • Install Docker 19.03 and nvidia-container-toolkit
  • Put Blender inside a Docker container (in my case I use this Dockerfile)
  • Run the container by docker run --gpus=all ...
  • Enter the container bash by docker exec -it <container-name> bash
  • Run blender in headless mode with this script:
import bpy

print(len(bpy.context.preferences.addons['cycles'].preferences.devices))
  • The result returns 0.

The script above runs outside the container (in the same host machine) returns 2 (my GPU and CPU)

This equivalent script:

import bpy

print(len(bpy.context.user_preferences.addons['cycles'].preferences.devices))

runs in Blender 2.79b in the same condition also returns 2

UPDATE
Run this command then blender will correctly find all the devices:

bpy.context.preferences.addons['cycles'].preferences.get_devices()

This is the table describe what I was doing:

Blender version Environment Print ...preferences.device Run ...get_device() then print ...device
2.79b Docker and on host 2 2
2.81a Docker 0 2
2.81a On host 2 2

So I have to manually run ...get_device() on Docker? Might this be a bug or just a minor limitation?

**System Information** Operating system: Ubuntu 18.04.3 Graphics card: NVIDIA Quadro P6000 Docker version: 19.03.5 Driver version: 435.21 CUDA version: 10.1 OpenGL version string: 4.6.0 NVIDIA 435.21 **Blender Version** Broken: 2.80, 2.81, 2.81a from this [URL](http://download.blender.org/release/Blender2.81) Worked: 2.79b **Short description of error** Cycles Engine does not find any render device in Docker. `len(bpy.context.preferences.addons['cycles'].preferences.devices) = 0` Tried on any `nvidia/cuda` tag ubuntu18.04 version 10+ image. **Exact steps for others to reproduce the error** - Install Docker 19.03 and `nvidia-container-toolkit` - Put Blender inside a Docker container (in my case I use [this Dockerfile](https://gist.github.com/h3d-haivq/672b742fc9c17fdae36c54a20b0479db)) - Run the container by `docker run --gpus=all ... ` - Enter the container bash by `docker exec -it <container-name> bash` - Run `blender` in headless mode with this script: ``` import bpy print(len(bpy.context.preferences.addons['cycles'].preferences.devices)) ``` - The result returns `0`. The script above runs outside the container (in the same host machine) returns `2` (my GPU and CPU) This equivalent script: ``` import bpy print(len(bpy.context.user_preferences.addons['cycles'].preferences.devices)) ``` runs in Blender 2.79b in the same condition also returns `2` **UPDATE** Run this command then blender will correctly find all the devices: ``` bpy.context.preferences.addons['cycles'].preferences.get_devices() ``` This is the table describe what I was doing: | Blender version | Environment | Print `...preferences.device` | Run `...get_device()` then print `...device` | | --- | --- | --- | --- | | 2.79b | Docker and on host | `2` | `2` | | 2.81a | Docker | `0` | `2` | | 2.81a | On host | `2` | `2` | So I have to manually run `...get_device()` on Docker? Might this be a bug or just a minor limitation?
Author

Added subscriber: @aperture147

Added subscriber: @aperture147

Added subscriber: @StephenSwaney

Added subscriber: @StephenSwaney

I wonder if this is related to OpenGL versions. What version does your Docker gpu report?

I wonder if this is related to OpenGL versions. What version does your Docker gpu report?
Author

There's no XServer inside Docker, so I cannot get the OpenGL version inside it. But I got this in my host machine:
OpenGL version string: 4.6.0 NVIDIA 435.21
The docker container share the same kernel and driver. Hope this will help you to debug.

There's no XServer inside Docker, so I cannot get the OpenGL version inside it. But I got this in my host machine: `OpenGL version string: 4.6.0 NVIDIA 435.21` The docker container share the same kernel and driver. Hope this will help you to debug.
Author

I also updated my system information, hope it will help you.

I also updated my system information, hope it will help you.
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker
Member

Please get the system info from inside the docker container. That will show you what the docker image provides and blender is able to detect. You can test this with the minimum requirement and find out that this setup is supported or not.

 blender --background --python-expr "import sys_info; sys_info.write_sysinfo('/tmp/system-info.txt')"

At this point this feels more a support question and should perhaps be discussed in support channels first and once an actual bug on blender is found a ticket here can be created.

Please get the system info from inside the docker container. That will show you what the docker image provides and blender is able to detect. You can test this with the minimum requirement and find out that this setup is supported or not. ``` blender --background --python-expr "import sys_info; sys_info.write_sysinfo('/tmp/system-info.txt')" ``` At this point this feels more a support question and should perhaps be discussed in support channels first and once an actual bug on blender is found a ticket here can be created.
Author

I've just found that use those command will make blender to find my device:

import bpy

bpy.context.preferences.addons['cycles'].preferences.get_devices()
print(len(bpy.context.user_preferences.addons['cycles'].preferences.devices)) # Now it's 2, not zero

This is the table describe what I was doing:

Blender version Environment Print ...preferences.device Run ...get_device() then print ...device
2.79b Docker and on host 2 2
2.81a Docker 0 2
2.81a On host 2 2

So I have to manually run ...get_device() on Docker? Might this be a bug or just a minor limitation?

I've just found that use those command will make blender to find my device: ``` import bpy bpy.context.preferences.addons['cycles'].preferences.get_devices() print(len(bpy.context.user_preferences.addons['cycles'].preferences.devices)) # Now it's 2, not zero ``` This is the table describe what I was doing: | Blender version | Environment | Print `...preferences.device` | Run `...get_device()` then print `...device` | | --- | --- | --- | --- | | 2.79b | Docker and on host | `2` | `2` | | 2.81a | Docker | `0` | `2` | | 2.81a | On host | `2` | `2` | So I have to manually run `...get_device()` on Docker? Might this be a bug or just a minor limitation?
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Member

Changed status from 'Needs User Info' to: 'Archived'

Changed status from 'Needs User Info' to: 'Archived'
Aaron Carlisle self-assigned this 2019-12-23 20:27:07 +01:00
Member

I am assuming this is a minor limitation due to Blender not being able to generate the preferences file which runs get_device() from the actual UI

I am assuming this is a minor limitation due to Blender not being able to generate the preferences file which runs `get_device() ` from the actual UI

Added subscriber: @pampa

Added subscriber: @pampa

This comment was removed by @pampa

*This comment was removed by @pampa*

I had the same problem
and the script solved it
import bpy

bpy.context.preferences.addons['cycles'].preferences.get_devices()
print(len(bpy.context.user_preferences.addons['cycles'].preferences.devices)) # Now it's 2, not zero

thanks @aperture147

I had the same problem and the script solved it import bpy bpy.context.preferences.addons['cycles'].preferences.get_devices() print(len(bpy.context.user_preferences.addons['cycles'].preferences.devices)) # Now it's 2, not zero thanks @aperture147
Sign in to join this conversation.
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#72550
No description provided.