Research Notes

[Solved] OSError: [WinError 127] 지정된 프로시저를 찾을 수 없습니다 본문

Programming Language/Python

[Solved] OSError: [WinError 127] 지정된 프로시저를 찾을 수 없습니다

jiachoi 2022. 4. 14. 14:13

1. Error message : OSError: [WinError 127] 지정된 프로시저를 찾을 수 없습니다

- Python Geometric 모듈을 import하다가 이런 에러가 남

- 프로시저 시작 지점 ~\torch_sparse\_version.pyd에서 찾을 수 없습니다 --> 이런 창이 뜸

이런 메시지가 먼저 나오고, 아래의 에러가 뜸

 

2. 해결방법 

- 대박 이틀만에 해결했다;;

시도한 방법 순서) 

1. NVIDIA Driver, CUDA, CUDNN, Torch 싹 지우고 재설치

- 내 로컬에 깔려있던 CUDA 버전이 Pytorch 1.11.0 버전이랑 호환이 안됨

- Python Geometric을 실행시키기 위한 최소 버전도 안되어서 모두 재설치함

- "프로그램 삭제"에 들어가서 NVIDIA 관련된 프로그램 모두 삭제함.. 

1.1. 환경 리셋

 

1.2 NVIDIA Driver, CUDA, CUDNN 설치 

- 내 Desktop에 깔려있는 GPU와 동일한걸로 nvidia driver 재설치

- 그래픽카드 이름 확인 (python에서)

import torch 
torch.cuda.get_device_name(0)  
>> 'GeForce GTX 1060 6GB'
 

Advanced Driver Search official NVIDIA drivers

Advanced Driver Search official NVIDIA drivers

www.nvidia.com

 

- pytorch 1.11.0과 호환되는 cuda version 설치 

 

CUDA Toolkit Archive

Previous releases of the CUDA Toolkit, GPU Computing SDK, documentation and developer drivers can be found using the links below. Please select the release you want from the list below, and be sure to check www.nvidia.com/drivers for more recent production

developer.nvidia.com

 

- CUDNN도 설치한 cuda 버전이랑 맞는 걸로 다운로드 받아야 함 

-  nvidia 계정이 필요 (인증, 로그인 등 필요함)

 

 

Installation — pytorch_geometric 2.0.5 documentation

pip install torch-scatter -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html pip install torch-sparse -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html pip install torch-geometric where ${CUDA} and ${TORCH} should be replaced by the specific CUD

pytorch-geometric.readthedocs.io

 

1.3 CUDNN 설치 후, CUDA가 설치된 폴더에 CUDNN 압축이 해제된 파일을 모두 옮겨줌

- cuda 설치

- cuda 파일 경로 : "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\"  --> 여기 아래에 CUDNN 압축 해제 파일 다 옮김 

 

1.4 torch 및 관련 파일 설치 

https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html#id1 

 

Installation — pytorch_geometric 2.0.5 documentation

pip install torch-scatter -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html pip install torch-sparse -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html pip install torch-geometric where ${CUDA} and ${TORCH} should be replaced by the specific CUD

pytorch-geometric.readthedocs.io

 

-> 같은 에러가 발생함 ;; 

 

2. 가상환경 생성 

2.1 새로운 가상환경 생성

- 새로운 가상환경에서 처음부터 다시 다 세팅함 (아래 글 참고) 

https://eunhye-zz.tistory.com/14 

 

[Jupyter notebook] 아나콘다 가상 환경 생성 및 활용

파이썬을 사용하면서 여러 패키지들을 설치하다보면 어느 순간 에러가 뜨는 경우가 생기게 됩니다. 또 다양한 프로젝트들을 진행함에 따라 사용하는 패키지들의 버전이 달라지게 되는데 이때

eunhye-zz.tistory.com

- torch install 

https://pytorch.org/

 

PyTorch

An open source machine learning framework that accelerates the path from research prototyping to production deployment.

pytorch.org

- torch 버전과 cuda 버전 확인함 

python -c "import torch; print(torch.__version__)"
>>> 1.11.0

python -c "import torch; print(torch.version.cuda)"
>>> 11.3

-  아래의 글을 보고 설치함

# 사용 코드 
pip install torch-scatter -f https://data.pyg.org/whl/torch-1.11.0+cu113.html
pip install torch-sparse -f https://data.pyg.org/whl/torch-1.11.0+cu113.html
pip install torch-geometric

# 다른 버전에 적용할 때, 형식 
# pip install torch-scatter -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html
# pip install torch-sparse -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html
# pip install torch-geometric

- https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html#id1   

 

Installation — pytorch_geometric 2.0.5 documentation

pip install torch-scatter -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html pip install torch-sparse -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html pip install torch-geometric where ${CUDA} and ${TORCH} should be replaced by the specific CUD

pytorch-geometric.readthedocs.io

 

 

2.2 만든 가상환경과 jupyter notebook 연결 

conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch-lts -c conda-forge
pip install jupyter notebook
pip install ipykernel
python -m ipykernel install --user --name [venv 이름]

 

< 결과 > 

- 드디어 torch_geometric.~ 관련 라이브러리들이 import 된다 

- CUDA 버전을 Pytorch 1.11.0에 맞게 맞춰줘야 했던 것 같고, 가상환경과 주피터 노트북을 연결 안해서 한참 헤맸다.. 

- 오랜만에 해보는 삽질;; 최대한 피하고싶다 

- 오늘 안에 pytorch 에러 해결해서 그래도 다행이다ㅎㅎ