-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Open
Description
Description
In Python, importing onnxruntime emits un-suppressible GPU discovery warning despite ORT_LOGGING_LEVEL=ERROR/FATAL.
$ export ORT_LOGGING_LEVEL=ERROR
$ python -c "import onnxruntime as ort
2026-01-21 12:08:58.794991221 [W:onnxruntime:Default, device_discovery.cc:164 DiscoverDevicesForPlatform] GPU device discovery failed: device_discovery.cc:89 ReadFileContents Failed to open file: "/sys/class/drm/card3/device/vendor"
Occurs in Docker/Linux without GPU present or no permissions.
Expected
env var ORT_LOGGING_LEVEL is respected, no hard coded logging level.
Root Cause
onnxruntime/python/onnxruntime_pybind_module.cc statically initializes LoggingManager lm_info at module load:
- Hard-coded to ORT_LOGGING_LEVEL_WARNING
- Bypasses env variable
ORT_LOGGING_LEVEL
[source](
onnxruntime/onnxruntime/python/onnxruntime_pybind_module.cc
Lines 36 to 38 in ef7d2f6
| OrtEnv::LoggingManagerConstructionInfo lm_info{nullptr, nullptr, ORT_LOGGING_LEVEL_WARNING, "Default"}; | |
| Status status; | |
| ort_env = OrtEnv::GetOrCreateInstance(lm_info, status, use_global_tp ? &global_tp_options : nullptr).release(); |
Environment
- OS: Linux Mint native, within Docker
- Python 3.10, 3.11
- onnxruntime-gpu 1.23.2
Repro
export ORT_LOGGING_LEVEL=ERROR
python -c "import onnxruntime as ort"
# Still warns
2026-01-21 12:08:58.794991221 [W:onnxruntime:Default, device_discovery.cc:164 DiscoverDevicesForPlatform] GPU device discovery failed: device_discovery.cc:89 ReadFileContents Failed to open file: "/sys/class/drm/card3/device/vendor"Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels