2023年9月1日 星期五

安裝 PyTorch 時出現 typing-extensions 模組相依性衝突問題

今天在 Thonny 編輯器中安裝 PyTorch 時出現 typing-extensions 模組相依性衝突問題 :

C:\Users\tony1>pip install torch torchvision torchaudio    
Collecting torch
  Downloading torch-2.0.1-cp310-cp310-win_amd64.whl (172.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 172.3/172.3 MB 13.1 MB/s eta 0:00:00
Collecting torchvision
  Downloading torchvision-0.15.2-cp310-cp310-win_amd64.whl (1.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 19.1 MB/s eta 0:00:00
Collecting torchaudio
  Downloading torchaudio-2.0.2-cp310-cp310-win_amd64.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 22.5 MB/s eta 0:00:00
Requirement already satisfied: filelock in c:\users\tony1\appdata\roaming\python\python310\site-packages (from torch) (3.12.3)
Requirement already satisfied: typing-extensions in c:\users\tony1\appdata\roaming\python\python310\site-packages (from torch) (4.5.0)
Requirement already satisfied: sympy in c:\users\tony1\appdata\roaming\python\python310\site-packages (from torch) (1.12)
Collecting networkx (from torch)
  Downloading networkx-3.1-py3-none-any.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 26.1 MB/s eta 0:00:00
Requirement already satisfied: jinja2 in c:\users\tony1\appdata\roaming\python\python310\site-packages (from torch) (3.1.2)
Requirement already satisfied: numpy in c:\users\tony1\appdata\roaming\python\python310\site-packages (from torchvision) (1.24.3)
Requirement already satisfied: requests in c:\users\tony1\appdata\roaming\python\python310\site-packages (from torchvision) (2.31.0)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\users\tony1\appdata\roaming\python\python310\site-packages (from torchvision) (10.0.0)
Collecting typing-extensions (from torch)
  Obtaining dependency information for typing-extensions from https://files.pythonhosted.org/packages/ec/6b/63cc3df74987c36fe26157ee12e09e8f9db4de771e0f3404263117e75b95/typing_extensions-4.7.1-py3-none-any.whl.metadata
  Downloading typing_extensions-4.7.1-py3-none-any.whl.metadata (3.1 kB)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\tony1\appdata\roaming\python\python310\site-packages (from jinja2->torch) (2.1.3)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\tony1\appdata\roaming\python\python310\site-packages (from requests->torchvision) (3.2.0)
Requirement already satisfied: idna<4,>=2.5 in c:\users\tony1\appdata\roaming\python\python310\site-packages (from requests->torchvision) (3.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\tony1\appdata\roaming\python\python310\site-packages (from requests->torchvision) (1.26.16)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\tony1\appdata\roaming\python\python310\site-packages (from requests->torchvision) (2023.7.22)
Requirement already satisfied: mpmath>=0.19 in c:\users\tony1\appdata\roaming\python\python310\site-packages (from sympy->torch) (1.3.0)
Downloading typing_extensions-4.7.1-py3-none-any.whl (33 kB)
Installing collected packages: typing-extensions, networkx, torch, torchvision, torchaudio
  Attempting uninstall: typing-extensions
    Found existing installation: typing_extensions 4.5.0
    Uninstalling typing_extensions-4.5.0:
      Successfully uninstalled typing_extensions-4.5.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow-intel 2.13.0 requires typing-extensions<4.6.0,>=3.6.6, but you have typing-extensions 4.7.1 which is incompatible.
Successfully installed networkx-3.1 torch-2.0.1 torchaudio-2.0.2 torchvision-0.15.2 typing-extensions-4.7.1

雖然顯示 ERROR, 但看起來是把原先的 4.5.0 版移除, 改安裝 4.7.1 版而已, 實際上不影響 PyTorch 運作 : 

>>> import torch   
>>> torch.__version__    
'2.0.1+cpu'

參考 :


沒有留言 :