[Python] Could not Install Package due to an OSError - PYTorch with cuda installation

Discussão em 'Python' iniciado por Stack, Julho 18, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to install the Pytorch package with the following line of command:

    pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu12


    But I'm getting the following error, and I'm unable to resolve it. I did not find any suitable solution, can anyone help?

    C:\Users\40003000>pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 --user
    Looking in indexes: https://download.pytorch.org/whl/cu118
    Requirement already satisfied: torch in c:\users\40003000\appdata\local\programs\python\python311\lib\site-packages (2.7.0)
    Requirement already satisfied: torchvision in c:\users\40003000\appdata\local\programs\python\python311\lib\site-packages (0.22.0)
    Collecting torchaudio
    Using cached https://download.pytorch.org/whl/cu118/torchaudio-2.7.1%2Bcu118-cp311-cp311-win_amd64.whl.metadata (6.8 kB)
    Requirement already satisfied: filelock in c:\users\40003000\appdata\local\programs\python\python311\lib\site-packages (from torch) (3.18.0)
    Requirement already satisfied: typing-extensions>=4.10.0 in c:\users\40003000\appdata\local\programs\python\python311\lib\site-packages (from torch) (4.14.1)
    Requirement already satisfied: sympy>=1.13.3 in c:\users\40003000\appdata\local\programs\python\python311\lib\site-packages (from torch) (1.14.0)
    Requirement already satisfied: networkx in c:\users\40003000\appdata\local\programs\python\python311\lib\site-packages (from torch) (3.5)
    Requirement already satisfied: jinja2 in c:\users\40003000\appdata\local\programs\python\python311\lib\site-packages (from torch) (3.1.6)
    Requirement already satisfied: fsspec in c:\users\40003000\appdata\local\programs\python\python311\lib\site-packages (from torch) (2025.3.0)
    Requirement already satisfied: numpy in c:\users\40003000\appdata\local\programs\python\python311\lib\site-packages (from torchvision) (2.3.1)
    Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\users\40003000\appdata\local\programs\python\python311\lib\site-packages (from torchvision) (11.3.0)
    INFO: pip is looking at multiple versions of torchaudio to determine which version is compatible with other requirements. This could take a while.
    Using cached https://download.pytorch.org/whl/cu118/torchaudio-2.7.0%2Bcu118-cp311-cp311-win_amd64.whl.metadata (6.8 kB)
    Collecting torch
    Using cached https://download.pytorch.org/whl/cu118/torch-2.7.0%2Bcu118-cp311-cp311-win_amd64.whl.metadata (29 kB)
    Requirement already satisfied: mpmath<1.4,>=1.1.0 in c:\users\40003000\appdata\local\programs\python\python311\lib\site-packages (from sympy>=1.13.3->torch) (1.3.0)
    Requirement already satisfied: MarkupSafe>=2.0 in c:\users\40003000\appdata\local\programs\python\python311\lib\site-packages (from jinja2->torch) (3.0.2)
    Downloading https://download.pytorch.org/whl/cu118/torchaudio-2.7.0%2Bcu118-cp311-cp311-win_amd64.whl (4.1 MB)
    ━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.1/4.1 MB ? eta -:--:--
    ERROR: Could not install packages due to an OSError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\40003000\\AppData\\Local\\Temp\\pip-unpack-dfsjx2p1\\torchaudio-2.7.0+cu118-cp311-cp311-win_amd64.whl'
    Check the permissions.


    I'm getting this error for the last 4 days. I tried to do multiple things to solve it but without success. I'm also the administrator of this system. I'm using Python 3.11.

    Please let me know if anyone has a solution.

    Continue reading...

Compartilhe esta Página