0

torch cpu gets installed although torch cuda was installed successfully and could be imported

@morpheusposted 8/7/2026, 6:15:48 AM·1 reply

What happened?
The torch installation fails.
torch cuda fails, then it tries to install torch for cpu.
The problem is, that torch actually was installed correctly. The way torch.js tries to import torch fails and so torch.js "thinks" it couldn't be imported.
A user reported this and I want to forward it to you.

Steps to reproduce

  1. install transcribix from scratch

Your system (OS / GPU / RAM / VRAM / etc.)
OS: Windows 10
GPU: RTX 4070
RAM: 64 GB

Logs / full error output

Microsoft Windows [Versión 10.0.19045.6466]
(c) Microsoft Corporation. Todos los derechos reservados.

D:\pinokio\api\Transcribix-Pinokio.git>conda_hook & conda deactivate & conda deactivate & conda deactivate & conda activate base & D:\pinokio\api\Transcribix-Pinokio.git\venvs\whisper\Scripts\activate D:\pinokio\api\Transcribix-Pinokio.git\venvs\whisper && uv pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu121
Using Python 3.10.20 environment at: venvs\whisper      
Checked 2 packages in 4ms

(whisper) (base) D:\pinokio\api\Transcribix-Pinokio.git>

Microsoft Windows [Versión 10.0.19045.6466]
(c) Microsoft Corporation. Todos los derechos reservados.

D:\pinokio\api\Transcribix-Pinokio.git>conda_hook & conda deactivate & conda deactivate & conda deactivate & conda activate base & D:\pinokio\api\Transcribix-Pinokio.git\venvs\whisper\Scripts\activate D:\pinokio\api\Transcribix-Pinokio.git\venvs\whisper && python -c "import torch" 2>/dev/null || echo TORCH_IMPORT_FAILED
El sistema no puede encontrar la ruta especificada.     
TORCH_IMPORT_FAILED

(whisper) (base) D:\pinokio\api\Transcribix-Pinokio.git>

Microsoft Windows [Versión 10.0.19045.6466]
(c) Microsoft Corporation. Todos los derechos reservados.

D:\pinokio\api\Transcribix-Pinokio.git>conda_hook & conda deactivate & conda deactivate & conda deactivate & conda activate base & D:\pinokio\api\Transcribix-Pinokio.git\venvs\whisper\Scripts\activate D:\pinokio\api\Transcribix-Pinokio.git\venvs\whisper && uv pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu
Using Python 3.10.20 environment at: venvs\whisper      
Checked 2 packages in 4ms

(whisper) (base) D:\pinokio\api\Transcribix-Pinokio.git>

I tested your script manually and figured out the problem. It's this part 2>/dev/null which makes it fail.
The following code shows it. (A new line means, the import worked)

  1. Your command (throws an error)
  2. Only import torch (gives a new line = worked)
  3. Your command without echo (throws an error)
  4. Your command with echo but without 2>/dev/null (gives a new line = worked)
(env) (base) d:\Tests>python -c "import torch" 2>/dev/null || echo TORCH_IMPORT_FAILED
Das System kann den angegebenen Pfad nicht finden.
TORCH_IMPORT_FAILED

(env) (base) d:\Tests>python -c "import torch"

(env) (base) d:\Tests>python -c "import torch" 2>/dev/null
Das System kann den angegebenen Pfad nicht finden.

(env) (base) d:\Tests>python -c "import torch" || echo TORCH_IMPORT_FAILED

(env) (base) d:\Tests>

If torch can be installed it uses to be able to be imported as well. If not, it also wouldn't help to install torch for cpu.
The fallback wouldn't work like that, cuz no matter if the event occurs or not, it would execute the fallback as next step which means everyone would get torch cpu
So I think the best way is to remove that shell run with the import check entirely.

module.exports = {
  run: [
    {
      // NVIDIA: install CUDA build of torch
      when: "{{gpu === 'nvidia'}}",
      method: "shell.run",
      params: {
        venv: "{{args.venv}}",
        path: "{{args.path}}",
        message: [
          "uv pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu121"
        ]
      }
    },
    {
      // Non-NVIDIA: install CPU build of torch
      when: "{{gpu !== 'nvidia'}}",
      method: "shell.run",
      params: {
        venv: "{{args.venv}}",
        path: "{{args.path}}",
        message: [
          "uv pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu"
        ]
      }
    },
  ]
}

On a side note: torch+cu121 is not compatible with RTX 50 series. They require torch+cu128 or higher.
whisper and meanwhile most, if not all apps work with torch+cu128
So if you want to support all NVIDIA GPUs you could use this install command instead:
uv pip install torch==2.7.0 torchvision==0.22.0 torchaudio==2.7.0 --index-url https://download.pytorch.org/whl/cu128 --force-reinstall --no-deps

Replies (1)
Up to 10 files, 25MB each. Images are optimized; GIFs -> MP4; videos 720p (max 120s).