最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - pip install torchtext: OSError: [WinError 127] The specified procedure could not be found - Stack Overflow

programmeradmin3浏览0评论

I am using Python 3.11.9 , PyCharm 2024.3.5 (Professional Edition), CUDA 12.8 , Windows 11 x64 , PyTorch nightly (what support NVIDIA Blackwell) . I also install Visual C++ Redistributable latest #latest-microsoft-visual-c-redistributable-version

import torch
print(torch.__version__)
print(torch.version.cuda)

# 2.8.0.dev20250322+cu128
# 12.8
Microsoft Windows [Version 10.0.26100.3476]
(c) Microsoft Corporation. All rights reserved.

C:\Users\ADMIN>nvidia-smi
Sun Mar 30 22:31:06 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 572.83                 Driver Version: 572.83         CUDA Version: 12.8     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                  Driver-Model | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 5090      WDDM  |   00000000:01:00.0  On |                  N/A |
|  0%   31C    P0             59W /  575W |    1477MiB /  32607MiB |      1%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A            5328    C+G   ...IA app\CEF\NVIDIA Overlay.exe      N/A      |
|    0   N/A  N/A            5636    C+G   ...8wekyb3d8bbwe\WebViewHost.exe      N/A      |
|    0   N/A  N/A            7136    C+G   ....0.3124.93\msedgewebview2.exe      N/A      |
|    0   N/A  N/A            7456    C+G   ...8bbwe\PhoneExperienceHost.exe      N/A      |
|    0   N/A  N/A           10016    C+G   ...s\PowerToys.PowerLauncher.exe      N/A      |
|    0   N/A  N/A           10068    C+G   ...em32\ApplicationFrameHost.exe      N/A      |
|    0   N/A  N/A           10924    C+G   ...IA app\CEF\NVIDIA Overlay.exe      N/A      |
|    0   N/A  N/A           12072    C+G   ...Files\Notepad++\notepad++.exe      N/A      |
|    0   N/A  N/A           12224    C+G   ...yb3d8bbwe\WindowsTerminal.exe      N/A      |
|    0   N/A  N/A           14288    C+G   ...Chrome\Application\chrome.exe      N/A      |
|    0   N/A  N/A           14740    C+G   ....0.3124.93\msedgewebview2.exe      N/A      |
|    0   N/A  N/A           18980    C+G   ...SnippingTool\SnippingTool.exe      N/A      |
|    0   N/A  N/A           21592    C+G   ...xyewy\ShellExperienceHost.exe      N/A      |
|    0   N/A  N/A           23220    C+G   ...y\StartMenuExperienceHost.exe      N/A      |
|    0   N/A  N/A           23692    C+G   C:\Windows\explorer.exe               N/A      |
|    0   N/A  N/A           28184    C+G   ...adeonsoftware\AMDRSSrcExt.exe      N/A      |
|    0   N/A  N/A           29356    C+G   ...crosoft OneDrive\OneDrive.exe      N/A      |
|    0   N/A  N/A           30376    C+G   ..._cw5n1h2txyewy\SearchHost.exe      N/A      |
|    0   N/A  N/A           32972    C+G   ...ntrolPanel\SystemSettings.exe      N/A      |
|    0   N/A  N/A           33200    C+G   ...Chrome\Application\chrome.exe      N/A      |
|    0   N/A  N/A           35108    C+G   ...indows\System32\ShellHost.exe      N/A      |
|    0   N/A  N/A           35464    C+G   ....0.3124.93\msedgewebview2.exe      N/A      |
+-----------------------------------------------------------------------------------------+

C:\Users\ADMIN>

My notebook

!pip install torchtext

c:\users\admin\pycharmmiscproject\.venv\lib\site-packages (from sympy>=1.13.3->torch>=2.3.0->torchtext) (1.3.0)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\admin\pycharmmiscproject\.venv\lib\site-packages (from jinja2->torch>=2.3.0->torchtext) (3.0.2)
Downloading torchtext-0.18.0-cp311-cp311-win_amd64.whl (1.9 MB)
   ---------------------------------------- 0.0/1.9 MB ? eta -:--:--
   ---------------------------------------- 1.9/1.9 MB 21.6 MB/s eta 0:00:00
Installing collected packages: torchtext
Successfully installed torchtext-0.18.0

and

import torchtext.datasets as datasets
dataset_movies = datasets.IMDB(root='./data', split='train')

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[29], line 1
----> 1 import torchtext.datasets as datasets
      3 dataset_movies = datasets.IMDB(root='./data', split='train')

File ~\PyCharmMiscProject\.venv\Lib\site-packages\torchtext\__init__.py:18
     15     _WARN = False
     17 # the following import has to happen first in order to load the torchtext C++ library
---> 18 from torchtext import _extension  # noqa: F401
     20 _TEXT_BUCKET = "/"
     22 _CACHE_DIR = os.path.expanduser(os.path.join(_get_torch_home(), "text"))

File ~\PyCharmMiscProject\.venv\Lib\site-packages\torchtext\_extension.py:64
     59     # This import is for initializing the methods registered via PyBind11
     60     # This has to happen after the base library is loaded
     61     from torchtext import _torchtext  # noqa
---> 64 _init_extension()

File ~\PyCharmMiscProject\.venv\Lib\site-packages\torchtext\_extension.py:58, in _init_extension()
     55 if not _mod_utils.is_module_available("torchtext._torchtext"):
     56     raise ImportError("torchtext C++ Extension is not found.")
---> 58 _load_lib("libtorchtext")
     59 # This import is for initializing the methods registered via PyBind11
     60 # This has to happen after the base library is loaded
     61 from torchtext import _torchtext

File ~\PyCharmMiscProject\.venv\Lib\site-packages\torchtext\_extension.py:50, in _load_lib(lib)
     48 if not path.exists():
     49     return False
---> 50 torch.ops.load_library(path)
     51 return True

File ~\PyCharmMiscProject\.venv\Lib\site-packages\torch\_ops.py:1392, in _Ops.load_library(self, path)
   1387 path = _utils_internal.resolve_library_path(path)
   1388 with dl_open_guard():
   1389     # Import the shared library into the process, thus running its
   1390     # static (global) initialization code in order to register custom
   1391     # operators with the JIT.
-> 1392     ctypes.CDLL(path)
   1393 self.loaded_libraries.add(path)

File ~\AppData\Local\Programs\Python\Python311\Lib\ctypes\__init__.py:376, in CDLL.__init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    373 self._FuncPtr = _FuncPtr
    375 if handle is None:
--> 376     self._handle = _dlopen(self._name, mode)
    377 else:
    378     self._handle = handle

OSError: [WinError 127] The specified procedure could not be found

What is the reason, and how to fix it?

Related /

发布评论

评论列表(0)

  1. 暂无评论