Windows11下DeepLabCut 3.0.0rc4环境启动失败求助
解决Windows11下DeepLabCut 3.0.0rc4 GPU环境启动失败问题
环境与安装信息
- 系统:Windows11
- Python版本:3.10.14
- TensorFlow版本:2.10
- DeepLabCut版本:3.0.0rc4
- 运行方式:本地GPU
安装命令:
conda env create -f DEEPLABCUT.yaml conda activate deeplabcut python -m deeplabcut
DEEPLABCUT.yaml配置:
name: DEEPLABCUT channels: - conda-forge - defaults dependencies: - python=3.10 - pip - ipython - jupyter - nb_conda - notebook<7.0.0 - ffmpeg - pytables==3.8.0 - git - pip: - "git+https://github.com/DeepLabCut/DeepLabCut.git@pytorch_dlc#egg=deeplabcut[gui,modelzoo,wandb]"
初始启动错误
Traceback (most recent call last): File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\runpy.py", line 187, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\runpy.py", line 146, in _get_module_details return _get_module_details(pkg_main_name, error) File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\runpy.py", line 110, in _get_module_details __import__(pkg_name) File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\deeplabcut\__init__.py", line 76, in <module> from deeplabcut.pose_tracking_pytorch import transformer_reID File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\deeplabcut\pose_tracking_pytorch\__init__.py", line 14, in <module> from .train_dlctransreid import train_tracking_transformer File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\deeplabcut\pose_tracking_pytorch\train_dlctransreid.py", line 15, in <module> import torch File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\torch\__init__.py", line 148, in <module> raise err OSError: [WinError 126] The specified module could not be found. Error loading "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\torch\lib\fbgemm.dll" or one of its dependencies.
尝试修复后的问题
卸载torch-2.4.0+cu118并安装torch==2.3.1后,出现依赖冲突:
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. torchaudio 2.4.0+cu118 requires torch==2.4.0+cu118, but you have torch 2.3.1 which is incompatible. torchvision 0.19.0 requires torch==2.4.0, but you have torch 2.3.1 which is incompatible.
同时触发新的启动错误:
Loading DLC 3.0.0rc4... Traceback (most recent call last): File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\runpy.py", line 187, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\runpy.py", line 146, in _get_module_details return _get_module_details(pkg_main_name, error) File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\runpy.py", line 110, in _get_module_details __import__(pkg_name) File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\deeplabcut\__init__.py", line 61, in <module> from deeplabcut.modelzoo.video_inference import video_inference_superanimal File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\deeplabcut\modelzoo\video_inference.py", line 23, in <module> from deeplabcut.pose_estimation_pytorch.modelzoo.train_from_coco import adaptation_train File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_pytorch\__init__.py", line 11, in <module> from deeplabcut.pose_estimation_pytorch.apis import ( File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_pytorch\apis\__init__.py", line 12, in <module> from deeplabcut.pose_estimation_pytorch.apis.analyze_images import ( File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_pytorch\apis\analyze_images.py", line 27, in <module> from deeplabcut.pose_estimation_pytorch.apis.utils import ( File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_pytorch\apis\utils.py", line 23, in <module> from deeplabcut.pose_estimation_pytorch.data.dataset import PoseDatasetParameters File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_pytorch\data\__init__.py", line 11, in <module> from deeplabcut.pose_estimation_pytorch.data.base import Loader File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_pytorch\data\base.py", line 20, in <module> from deeplabcut.pose_estimation_pytorch.data.dataset import ( File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_pytorch\data\dataset.py", line 20, in <module> from deeplabcut.pose_estimation_pytorch.data.utils import ( File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\deeplabcut\pose_estimation_pytorch\data\utils.py", line 21, in <module> from torchvision.ops import box_convert File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\torchvision\__init__.py", line 10, in <module> from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils # usort:skip File "C:\ProgramData\anaconda3\envs\deeplabcut\lib\site-packages\torchvision\_meta_registrations.py", line 163, in <module> @torch.library.register_fake("torchvision::nms") AttributeError: module 'torch.library' has no attribute 'register_fake'
解决方案
1. 统一Torch套件版本
错误核心是torch、torchvision、torchaudio版本不兼容:torch.library.register_fake是Torch 2.4+新增API,而Torch 2.3.1无此方法;同时torchvision 0.19.0强制要求Torch 2.4.0。需安装完全匹配的GPU版本套件:
激活环境后执行:
pip uninstall -y torch torchvision torchaudio pip install torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu118
2. 修复fbgemm.dll依赖
若安装后仍出现fbgemm.dll加载错误:
- 安装最新版Microsoft Visual C++ Redistributable(x64)
- 确保NVIDIA驱动适配CUDA 11.8(建议更新到450.80.02及以上版本)
3. 验证环境与启动
执行以下代码验证GPU可用性:
import torch print(torch.cuda.is_available())
输出True则GPU配置正常,重新启动DeepLabCut:
python -m deeplabcut
4. 备选:使用官方推荐的conda配置
若上述方法无效,删除现有环境,使用以下yaml创建新环境:
name: dlc_gpu channels: - conda-forge - defaults dependencies: - python=3.10 - pip - ipython - jupyter - nb_conda - notebook<7.0.0 - ffmpeg - pytables==3.8.0 - git - cudatoolkit=11.8 - pip: - deeplabcut[gui,modelzoo,wandb]==3.0.0rc4 - torch==2.3.1 torchvision==0.18.1 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu118
创建并启动环境:
conda env create -f dlc_gpu.yaml conda activate dlc_gpu python -m deeplabcut
内容的提问来源于stack exchange,提问作者Hannah Lyons
相关产品推荐
相关产品推荐

