转载请注明出处
个人博客:https://maxusun.github.io/
本人使用的电脑是锐龙4700u的CPU,其显卡是自带的AMD显卡,引用pytorch并使用时,出现下面的报错:
E:\DeepDiag\backend>python manage.py runserver 127.0.0.1:8080
Watching for file changes with StatReloader
Performing system checks...
2020-07-09 23:50:38.515924: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-07-09 23:50:38.519293: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Using TensorFlow backend.
Segmentation Models: using `keras` framework.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "D:\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "D:\Python\Python36\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "D:\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "D:\Python\Python36\lib\site-packages\django\core\management\commands\runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "D:\Python\Python36\lib\site-packages\django\core\management\base.py", line 395, in check
include_deployment_checks=include_deployment_checks,
File "D:\Python\Python36\lib\site-packages\django\core\management\base.py", line 382, in _run_checks
return checks.run_checks(**kwargs)
File "D:\Python\Python36\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "D:\Python\Python36\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "D:\Python\Python36\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
return check_method()
File "D:\Python\Python36\lib\site-packages\django\urls\resolvers.py", line 407, in check
for pattern in self.url_patterns:
File "D:\Python\Python36\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "D:\Python\Python36\lib\site-packages\django\urls\resolvers.py", line 588, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "D:\Python\Python36\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "D:\Python\Python36\lib\site-packages\django\urls\resolvers.py", line 581, in urlconf_module
return import_module(self.urlconf_name)
File "D:\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "E:\DeepDiag\backend\deepdiag\urls.py", line 9, in <module>
path('diag/', include('api.urls.diag')),
File "D:\Python\Python36\lib\site-packages\django\urls\conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "D:\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "E:\DeepDiag\backend\api\urls\diag.py", line 2, in <module>
from api.views import diag
File "E:\DeepDiag\backend\api\views\diag.py", line 6, in <module>
import api.views.segmentation_tumor.process as stp
File "E:\DeepDiag\backend\api\views\segmentation_tumor\process.py", line 6, in <module>
import torch
File "D:\Python\Python36\lib\site-packages\torch\__init__.py", line 81, in <module>
ctypes.CDLL(dll)
File "D:\Python\Python36\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] 找不到指定的模块。
全网找bug找了半天,网上说的各种下载驱动,vcredist_x86都没有解决问题,后来把下载的pytorch删除,然后安装cpu版本的pytorch才没有报错,但是这样就不能使用GPU跑对应的代码了,不过可以使用Google的Colab跑代码,具体教程可以看有关的博客。
这个坑先记下来,以后再填。我感觉主要原因是使用的锐龙处理器,并且自带的GPU是AMD的GPU