aicore.bond

Base de todo despliegue con GPU · 62 casos

Errores de CUDA y Docker: la GPU no llega al contenedor y la memoria se agota

«could not select device driver», contenedores que no ven la GPU, exit code 137 por OOM y desajustes entre driver, CUDA y PyTorch.

could not select device driverOCI runtime create failednvidia-container-cli: initialization errorexit code 137CUDA out of memoryCUDA Setup failed despite GPU being availableno CUDA-capable device is detected
nvidia-container-cli: detection error: open…
Docker falla al arrancar con GPU (libnvidia-tls.so.470.129.06: no such file or directory) GitHub · NVIDIA/nvidia-container-toolkit #246
nvidia-container-cli: initialization error…
Docker Compose no inicia el contenedor GPU (nvidia-container-cli: initialization error) GitHub · NVIDIA/nvidia-container-toolkit #250
nvidia-container-cli: mount error: file…
Docker en WSL2 falla al montar librerías NVIDIA (libnvidia-ml.so.1: file exists: unknown) GitHub · NVIDIA/nvidia-container-toolkit #289
Clang en Docker no compila OpenMP offload a NVPTX (LLVM OpenMP GPU Offloading Docker Image) Stack Overflow · 0 votos
failed to locate libcuda.so.515.105.01…
nvidia-ctk cdi generate no localiza la librería del driver (failed to locate libcuda.so.515.105.01) GitHub · NVIDIA/nvidia-container-toolkit #82
dxcore initialization failed, continuing…
nvidia-docker falla en Jetson Nano tras reinstalar (dxcore initialization failed) GitHub · NVIDIA/nvidia-container-toolkit #294
RuntimeError: CUDA Setup failed despite GPU…
bitsandbytes en Windows falla al cargar CUDA (CUDA Setup failed despite GPU being available) GitHub · bitsandbytes-foundation/bitsandbytes #748
CUDA_SETUP: WARNING! libcudart.so not found…
bitsandbytes no detecta CUDA pese a haber GPU (libcudart.so not found in any environmental path) GitHub · bitsandbytes-foundation/bitsandbytes #487
nvidia-container-cli: initialization error…
Contenedor con GPU sin root falla en Docker Desktop (load library failed: libnvidia-ml.so.1) Stack Overflow · 3 votos
nvidia-container-cli: initialization error…
Docker Compose con runtime NVIDIA falla y docker run no (load library failed: libnvidia-ml.so.1) Stack Overflow · 3 votos
dlerror: libnvinfer.so.7: cannot open shared…
TensorFlow no carga TensorRT 8 (dlerror: libnvinfer.so.7: cannot open shared object file) Stack Overflow · 28 votos
Unable to find installation candidates for…
poetry add torch falla en Mac M1 (Unable to find installation candidates for nvidia-cudnn-cu11) Stack Overflow · 6 votos
nvidia-container-cli: initialization error…
Docker no arranca contenedores con GPU (load library failed: libnvidia-ml.so.1) Stack Overflow · 19 votos
RuntimeError: cannot get YoloLayer_TRT plugin…
TensorRT falla al convertir ONNX en Docker (cannot get YoloLayer_TRT plugin creator) Stack Overflow · 0 votos
PyTorch rompe en torch.from_numpy (RuntimeError: Numpy is not available) Stack Overflow · 47 votos
RuntimeError: CUDA error: unspecified launch…
PyTorch 1.3 en Windows se cae al azar en backward (CUDA error: unspecified launch failure) GitHub · pytorch/pytorch #27837
Failed call to cuInit: CUDA_ERROR_NOT_INITIALI…
TensorFlow no ve la A100 en Docker (Failed call to cuInit: CUDA_ERROR_NOT_INITIALIZED) Stack Overflow · 4 votos
Why does nvidia-smi show same CUDA version…
nvidia-smi dentro del contenedor muestra la versión del host (same CUDA version and driver version) Stack Overflow · 2 votos
exec: "nvidia-smi": executable file not found…
Docker en WSL2: exec: "nvidia-smi": executable file not found in $PATH Stack Overflow · 0 votos
PyTorch en Colab se rompe al usar la GPU (CUDA error: device-side assert triggered) Stack Overflow · 95 votos
nvidia-container-cli: initialization error…
nvidia-docker 2.6.0-1 deja de funcionar en WSL2 (OCI runtime create failed: container_linux.go:367) GitHub · NVIDIA/nvidia-docker #1496
RuntimeError: CUDA error: CUBLAS_STATUS_EXECUT…
PyTorch falla solo en GPU (RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED) Stack Overflow · 25 votos
nvidia-container-cli: container error: cgroup…
Docker falla con el runtime NVIDIA en Debian testing (cgroup subsystem devices not found) GitHub · NVIDIA/nvidia-docker #1447
PyTorch falla al seleccionar GPU (RuntimeError: CUDA error: invalid device ordinal) Stack Overflow · 26 votos
Could not load dynamic library…
TensorFlow no encuentra la librería CUDA (Could not load dynamic library 'libcublas.so.10) Stack Overflow · 32 votos
RuntimeError: CUDA error: an illegal memory…
PyTorch falla aleatoriamente en multi-GPU (CUDA error: an illegal memory access was encountered) GitHub · pytorch/pytorch #21819
nvidia-docker falla al arrancar el contenedor (OCI runtime create failed: container_linux.go:349) GitHub · NVIDIA/nvidia-docker #1225
Docker no da acceso a la GPU (CUDA Version: N/A and torch.cuda.is_available returns False) Stack Overflow · 22 votos
How to stop running TensorRT server without…
nvprof falla al parar el servidor TensorRT (stop running TensorRT server without using ctrl-c) Stack Overflow · 0 votos
PyTorch rechaza etiquetas float en la pérdida (RuntimeError: expected scalar type Long but found Float) Stack Overflow · 56 votos
RuntimeError: DataLoader worker (pid(s)…
PyTorch en Windows falla al iterar el DataLoader (DataLoader worker (pid(s) 15332) exited unexpectedly) Stack Overflow · 37 votos
AssertionError: Torch not compiled with CUDA…
PyTorch instalado sin soporte CUDA al usar .cuda() (Torch not compiled with CUDA enabled) GitHub · pytorch/pytorch #30664
PyTorch agota la memoria de la GPU al entrenar (CUDA out of memory) Stack Overflow · 194 votos
RuntimeError: Input type (torch.FloatTensor)…
PyTorch falla en forward con datos en CPU (Input type (torch.FloatTensor) and weight type) Stack Overflow · 202 votos
docker: Error response from daemon: Unknown…
Docker no reconoce el runtime de NVIDIA (Unknown runtime specified nvidia) Stack Overflow · 27 votos
ModuleNotFoundError: No module named…
PyTorch y TensorBoard: falta el paquete (No module named 'tensorboard.summary) Stack Overflow · 25 votos
The size of tensor a (4) must match the size…
PyTorch falla con PNG de 4 canales (The size of tensor a (4) must match the size of tensor b (3)) Stack Overflow · 45 votos
BERT en PyTorch rechaza labels (TypeError: forward() got an unexpected keyword argument 'labels) Stack Overflow · 26 votos
ValueError: Target size (torch.Size([16]))…
PyTorch: la loss rechaza el target (Target size (torch.Size([16])) must be the same as input size) Stack Overflow · 49 votos
nvidia-container-cli: initialization error…
nvidia-docker en openSUSE no ve la GPU (nvidia-docker on opensuse) GitHub · NVIDIA/nvidia-docker #657
Expected 4-dimensional input for…
PyTorch falla sin dimensión de lote (Expected 4-dimensional input for 4-dimensional weight 32 3 3) Stack Overflow · 34 votos
pip install torch falla en Windows (ModuleNotFoundError: No module named 'tools.nnwrap) Stack Overflow · 105 votos
Expected object of scalar type Float but got…
PyTorch falla al entrenar (Expected object of scalar type Float but got scalar type Double) Stack Overflow · 126 votos
PyTorch aborta en GPU (RuntimeError: CUDA error: device-side assert triggered) Stack Overflow · 19 votos
ImportError: libtorch_python.so: cannot open…
PyTorch falla al importar torch._C (libtorch_python.so: cannot open shared object file) Stack Overflow · 9 votos
RuntimeError: Can't call numpy() on Variable…
PyTorch no convierte a NumPy un tensor con gradiente (Can't call numpy() on Variable that requires grad) Stack Overflow · 59 votos
ValueError: optimizer got an empty parameter…
PyTorch: Adam no ve las capas de una lista (optimizer got an empty parameter list) Stack Overflow · 32 votos
RuntimeError: CUDA out of memory. Tried to…
PyTorch falla con memoria libre de sobra (CUDA out of memory. Tried to allocate 12.50 MiB) GitHub · pytorch/pytorch #16417
nvcc y nvidia-smi muestran versiones de CUDA distintas (Different CUDA versions shown by nvcc and NVIDIA-smi) Stack Overflow · 365 votos
nvidia-container-cli: initialization error…
nvidia-docker falla al iniciar con GPUs ocupadas (timeout limit of nvidia-docker initialization) Stack Overflow · 0 votos
RuntimeError: Cannot re-initialize CUDA in…
PyTorch con multiprocessing falla en CUDA (Cannot re-initialize CUDA in forked subprocess) Stack Overflow · 40 votos
TensorFlow no arranca sin libcublas (ImportError: libcublas.so.9.0: cannot open shared object file) Stack Overflow · 50 votos
RuntimeError: Trying to backward through the…
PyTorch falla en el segundo backward del bucle (Trying to backward through the graph a second time) Stack Overflow · 58 votos
AssertionError: Torch not compiled with CUDA…
PyTorch falla al iterar el DataLoader (Torch not compiled with CUDA enabled) Stack Overflow · 24 votos
exec: "nvidia-smi": executable file not found…
nvidia-docker no encuentra nvidia-smi dentro del contenedor (nvidia-smi executable file not found) Stack Overflow · 0 votos
PyTorch: torch.dot con matrices (RuntimeError: 1D tensors expected, but got 2D and 2D tensors) Stack Overflow · 94 votos
Couldn't open CUDA library libcuda.so.1
TensorFlow no encuentra la librería del driver (Tensorflow cannot open libcuda.so.1) Stack Overflow · 27 votos
CUDA 8 en Ubuntu 16.04 (CUDA driver version is insufficient for CUDA runtime version) Stack Overflow · 35 votos
Instalar CUDA en macOS con brew en lugar del DMG (This executed without error.) Stack Overflow · 12 votos
CUDA instalado sin /usr/local/cuda (ls: cannot access /usr/local/cuda*: No such file or directory) Stack Overflow · 68 votos
CUDA en OSX devuelve el error 46 (all CUDA-capable devices are busy or unavailable) Stack Overflow · 35 votos
CUDA falla al lanzar el kernel (CUDA driver version is insufficient for CUDA runtime version) Stack Overflow · 43 votos

Qué falla y por qué

Antes de Ollama, ComfyUI o vLLM está el runtime: el driver de NVIDIA, el toolkit de contenedores y la versión de CUDA con la que se compiló PyTorch. La mitad de los errores que la gente atribuye a una aplicación son en realidad de esta capa, y se reconocen por el mensaje: si habla de «device driver», «nvidia-container» o «kernel image», el problema no está en el modelo.

La otra mitad es memoria. Un contenedor que muere con código 137 lo hizo porque el sistema lo mató al quedarse sin memoria; una GPU que lanza «out of memory» con la tarjeta medio vacía suele tener procesos antiguos que aún retienen memoria. Los dos casos están cubiertos aquí con las comprobaciones que los distinguen.

Con el tiempo la categoría ha crecido hacia dos frentes más. Uno es el toolkit de contenedores de NVIDIA: errores de CDI, de ldcache y de librerías como libnvidia-ml.so que impiden que el contenedor arranque aunque el driver del host esté bien. El otro son los conflictos de dependencias de Python al instalar PyTorch o bitsandbytes: paquetes que se pisan, ruedas compiladas para otra versión de CUDA y avisos de que la librería se instaló sin soporte de GPU.

Preguntas frecuentes

¿Por qué Docker no ve la GPU aunque nvidia-smi funcione en el host?

Porque el contenedor no tiene acceso al dispositivo ni al runtime de NVIDIA: hace falta el toolkit instalado y arrancar el contenedor pidiendo la GPU. Que nvidia-smi funcione en el host solo confirma el driver, no el paso de la GPU al contenedor.

¿Qué significa el código de salida 137?

Que el proceso recibió una señal de terminación tras agotar la memoria del sistema, no la de la GPU. Es un límite de memoria del contenedor o del host; súbelo o reduce el consumo del proceso antes de mirar la tarjeta gráfica.

¿Tengo que instalar CUDA dentro de la imagen?

No en la mayoría de los casos: la imagen trae las librerías de CUDA y el host solo necesita el driver, que se comparte con el contenedor. Instalar un toolkit completo dentro de la imagen suele crear desajustes entre versiones.

Otras categorías

  • Ollama — GPU no detectada, «CUDA error: out of memory», modelos que no cargan, puerto 11434 ocupado y problemas de red detrás de proxy.
  • ComfyUI — Falta torch o CUDA no coincide, nodos personalizados que no importan, modelos que no aparecen y errores de memoria en la GPU.
  • Open WebUI — Docker no resuelve el host, Ollama no aparece en el desplegable, errores de base de datos y volúmenes sin permisos.
  • n8n — Webhooks con la URL equivocada, ECONNREFUSED entre contenedores, volúmenes sin permisos, base de datos y clave de cifrado perdida.
  • vLLM y llama.cpp — Binarios compilados para otra arquitectura, KV cache que no cabe, GGUF incompatibles y errores de driver al arrancar el servidor.