안녕하세요? QGIS와 Python을 이용한 종 분포 모델링(SDM: Species Distribution Modeling)을 시리즈 글로 정리해 보겠습니다. 이번에는 첫 번째 실습으로 Python 설치 및 환경 설정을 주된 내용으로 정리해 보겠습니다.
*이 글은 국립공원 비대면 학습동아리 '파크랩(ParkLab)'의 학습용 자료입니다. 스터디에 참여하는 조경학, 컴퓨터공학 등 다양한 전공자분들의 참여를 통해 콘텐츠는 수시로 수정, 보완될 수 있습니다. 유튜브 영상과 프레젠테이션 자료는 아래 링크를 참고하시면 됩니다.
먼저 '종 분포 모델링'에 대해 간략히 알아보도록 하겠습니다. 해당 내용은 위키백과를 참고하였습니다.
종 분포 모델링(SDM)
종 분포 모델링은 Species distribution modelling, 줄여서 SDM이라는 약어로 표기하며 아래 용어로도 쓰이고 있습니다.
- 환경 지위 모델링(ENM: Environmental Niche Modelling)
- 생태 지위 모델링(ENM: Ecological Niche Modelling)
- 서식지 모델링(habit modeling)
- 예측 서식지 분포 모델링(predictive habitat distribution modelling)
- 범위 매핑(range mapping)
SDM은 컴퓨터 알고리즘을 사용하여 지리적 공간과 시간에 걸쳐 종의 분포를 예측하는 과정입니다. 이를 위해서는 연구지역의 환경 데이터(environment data)가 필요합니다.
환경 데이터는 대부분 기후 데이터(climate data), 예를 들면 기온(temperature), 강수량(precipitation)과 같은 자료를 사용합니다. 토양 유형(soil type), 수심(water depth) 및 토지 피복(land cover)등 다른 변수를 포함하기도 합니다. 이러한 환경 데이터는 환경 조건이 종의 발생(presence) 또는 풍부함(richness)에 어떻게 영향을 미치는지 이해하고 예측하는 목적(즉, 생태 예측)으로 사용됩니다.
Python SDM
이 글에서는 Python으로 SDM을 실습하는 내용을 다룹니다. 해당 실습은 UC 버클리 데이터 과학자, 다니엘 퍼먼(Daniel Furman, UC Berkeley data scientist) 님이 작성하신 글 소스코드를 QGIS에 맞게 제가 수정, 보완한 것입니다. 좋은 정보를 공유해 주신 다니엘 퍼먼 님께 감사의 마음을 전합니다.
*결론부터 말씀드리면, 원본 소스코드에서 포인트 샘플링 목적으로 사용하는 rasterstats 모듈의 처리 속도가 상당히 느립니다. 이 부분을 QGIS의 Point sampling tool로 교체해서 수십분을 수초로 단축시켰습니다.
Python SDM은 종의 존재 위치(presence locations)를 기후 변수(climate variable)와 연관시켜, 전체 경관에서 ’종의 적합성(species suitability)’을 예측(predict)하는 기능들을 제공합니다.
Python SDM 워크플로(workflow)
워크플로는 아래와 같습니다. 일단 연구대상 종의 위치정보(존재, 부재 정보 포함)와 환경 데이터(기온, 강수량 등)가 필요합니다. 먼저, 종의 존재 좌표에서 환경 데이터 정보, 즉 환경변수 값들을 샘플링합니다. 해당 정보에 통계 모델을 적용하여 종-환경 간 관계(species-environment relationship)를 정의합니다.
이 정의로 우리는 연구대상 종의 서식 환경조건을 확률적으로 이해할 수 있습니다. 이를 통해 종-환경 관계가 연구공간 전체에 매핑되어 종의 잠재적 분포(potential distribution)을 모델링(내삽)하거나, 미래/과거 기후 또는 새로운 지리적 영역에 대한 예측 모델링(외삽)이 기능해 집니다.
내삽(보간, interpolation)과 외삽(보외, extrapolation)의 개념에 참고될 만한 글을 링크하였습니다.
아래 그림은 Python SDM 워크플로를 다시 한번 정리해 본 것입니다.
이번 실습을 통해 우리는 Python 코드베이스(codebase)로 종 분포 모델링 작업공간(SDM workspace)을 생성하고, 선택한 ML 분류기(Machine Learning classifier)로 종 분포 모델링(SDM) 세트를 실행해 볼 수 있습니다. 환경 데이터는 1970-2000 기후 특징(climate features)을 사용하여 연구 공간 전체에 모델 예측(model predictions)을 시각화해 볼 것입니다. 그렇다면 먼저 무엇을 해야 할까요?! 내 컴퓨터에 Python부터 설치해 보겠습니다!
Python 설치
Python은 공식 홈페이지에서 최신 버전을 내려받으실 수 있습니다. Anaconda(https://www.anaconda.com/) 등 다양한 방식으로 Python을 설치하실 수 있는데요, 데이터 분석 도구는 개인의 선택입니다.
이 실습 글은 Python 3.9.7 버전(https://www.python.org/ftp/python/3.9.7/python-3.9.7-amd64.exe) 설치를 기준으로 작성했습니다.
Python 설치 시 'Add Python 3.9 to PATH'를 체크해 줍니다.
설치가 완료되면 'Setup was successful'이라는 메시지를 보실 수 있습니다!
내 컴퓨터에 설치된 Python을 직접 실행해볼까요?! 명령 프롬프트(관리자 권한으로 실행)를 실행하고,
아래와 같이 'python'을 입력해서 파이썬 실행을 체크해 봅니다. 종료는 Ctrl+Z를 입력하시면 됩니다!
파이썬용 패키지 설치하는 pip 업그레이드 설치
이번엔 pip을 통해 Python SDM에 필요한 파이썬용 패키지들을 추가 설치해 보겠습니다. pip은 파이썬용 패키지를 설치해 주는 프로그램(Package Installer for Python)입니다.
pip의 최신 버전 업그레이드는 'pip install --upgrade pip' 명령어를 통해 실행하실 수 있습니다. 여기서 'pip install --upgrade 패키지명'은 일종의 문법입니다. '--upgrade'는 옵션은 지정된 패키지를 최신으로 업그레이드하는 의미를 담고 있습니다. 만약 권한 오류가 발생한다면 '--user' 옵션을 추가해서 해당 문제를 처리하실 수 있습니다.
pip을 통해 설치되는 파이썬용 패키지(소포)들은 PyPI라는 저장소(물류센터)에 위치하고 있습니다. 우리는 pip 명령어를 통해 원하는 소포를 내 PC로 이관합니다. PyPI는 파이썬 프로그래밍언어용 소프트웨어 저장소(repository)로 공식 홈페이지는 아래와 같습니다.
주피터 노트북(Jupyter Notebook) 설치
이번에는 pip을 통해 개발 도구를 하나 설치해 보겠습니다. '주피터 노트북(Jupyter Notebook)'은 웹브라우저에서 파이썬 프로그래밍이 가능한 애플리케이션입니다. 'pip install notebook' 명령어로 설치하며 'jupyter notebook'이라는 명령어를 통해 실행하실 수 있습니다.
학습 데이터 다운로드
이 시점에서 소스코드를 포함한 학습 데이터를 내려받도록 하겠습니다. 공간정보는 다니엘 퍼먼 님이 제공해주신 조슈아 트리(Joshua tree) 공개 자료를 사용합니다. *DATA.zip은 압축을 해제합니다.
- JTREE.shp : 조슈아 트리(Joshua tree)
- BIOCLIM/bclim*.asc: 조슈아 트리 연구지역으로 자른 생물 기후 특징
- SDM_Species_Distribution_Modeling_v.0.3.ipynb
- python-3.9.7-amd64.exe
C:\Users\{사용자 이름} 폴더에 'SDM_Species_Distribution_Modeling_v.0.3.ipynb' 파일을 위치시키고 주피터 노트북에서 해당 파일을 실행합니다. 아래와 같이 파일이 실행되실 겁니다.
주피터 노트북은 Cell 단위로 소스코드를 실행할 수 있습니다. 'Shift+Enter' 입력을 통해 현재 커서가 위치한 하나의 Cell을 실행한 후, 아래 Cell로 커서를 이동시킬 수 있습니다. 그밖에 'Kernel > Restart & Clear Output'을 통해 전체 소스코드를 초기화하거나 'Kernel > Restart & Run All'로 전체 실행하는 기능이 자주 사용됩니다. 이외 기능을 차차 알아가도록 하겠습니다.
섹션 1 | 설정 (Set up)
먼저 작업 디렉토리를 변경하고, 변경 여부를 확인해 보겠습니다. 작업 디렉토리에는 앞서 내려받은 학습 데이터가 위치해야 합니다. 현재 작업 디렉토리를 확인하고 변경하는 코드는 아래와 같습니다. 저는 D:\GEODATA가 학습 데이터를 위치시켜 놓은 폴더입니다.
import os
os.getcwd() # 현재 작업 디렉토리
os.chdir('D:\\GEODATA') # 작업 디렉토리 변경
os.getcwd() # 현재 작업 디렉토리
다음으로 작업 디렉토리에 입출력용 'INPUT'과 'OUTPUT' 폴더를 생성합니다. 우리는 'DATA' 폴더에 있는 자료를 'INPUT' 폴더에 코드로 복사하여 실습을 진행할 것입니다. 그리고 종 분포 모델링 결과물은 'OUTPUT' 폴더에 생성될 예정입니다.
os.mkdir("INPUT") # 작업 디렉토리에 'INPUT(입력)' 폴더 생성
os.mkdir("OUTPUT") # 작업 디렉토리에 'OUTPUT(출력)' 폴더 생성
다음으로는 모듈을 찾고 불러오는 구문입니다. 'import 모듈 as 모듈 이름'과 같은 형식으로 선언할 수 있습니다. shutil과 glob은 내장 모듈이지만 geopandas는 현재 내 컴퓨터에 설치되어 있지 않으므로 'ModuleNotFoundError'를 경험하실 것입니다. 추가 모듈을 설치해 보겠습니다!
import geopandas as gpd # GeoPandas(지오판다스)
import shutil # shutil(shell utility, 쉘 유틸리티)
import glob # glob(글로브)
pip을 통한 모듈 설치는 명령 프롬프트(관리자 권한으로 실행)에서 해당 설치 명령어를 실행하시면 됩니다. *아래 명령어를 복사 후 명령 프롬프트에서 오른쪽 마우스를 클릭하시면 자동 붙여넣기 됩니다.
pip install --upgrade pip
pip install wheel
pip install pipwin
pipwin refresh
윈도우에서는 pip을 통해 설치할 수 없는 모듈도 존재합니다. 캘리포니아대학교 형광역학실험실(LFD)의 크리스토프 골크(Christoph Gohlke) 님은 'Unofficial Windows Binaries for Python Extension Packages'에서 해당 wheel(*.whl) 파일들을 제공해 주고 계십니다. 공식 홈페이지는 아래와 같습니다.
그리고 pipwin 모듈을 통해 우리는 이러한 wheel 파일을 설치할 수 있습니다. 이제 아래와 같이 모듈들을 설치해 줍니다.
pipwin install gdal
pipwin install pyproj
pipwin install six
pipwin install rtree
pipwin install shapely
pipwin install fiona
pipwin install rasterio
pipwin install pandas
pipwin install geopandas
pipwin install numpy
자, 이제 geopandas도 오류가 발생하지 않을 겁니다!
pip을 통해 설치할 수 있는 나머지 모듈도 추가해 줍니다! 여기까지 첫번째 실습을 진행해 봤습니다.
pip install matplotlib
pip install xgboost
pip install lightgbm
pip install pyimpute
작업 결과를 비교하실 수 있게 제 명령 프롬프트 내용을 공유해 봅니다.
(참고) 패키지 설치과정에서 아래와 같은 오류를 경험하실 수 있습니다.
ERROR: Could not install packages due to an OSError: [WinError 5] 액세스가 거부되었습니다.
관리자 실행 상태인지 체크해 보시고, (관리자 권한이면) 해당 명령어를 재실행해 보시기 바랍니다.
Microsoft Windows [Version 10.0.19044.1526]
(c) Microsoft Corporation. All rights reserved.
C:\Windows\system32>pip install --upgrade pip
Requirement already satisfied: pip in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (22.0.3)
C:\Windows\system32>pip install wheel
Collecting wheel
Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel
Successfully installed wheel-0.37.1
C:\Windows\system32>pip install pipwin
Collecting pipwin
Using cached pipwin-0.5.1-py2.py3-none-any.whl
Requirement already satisfied: docopt in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pipwin) (0.6.2)
Collecting six
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Requirement already satisfied: requests in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pipwin) (2.27.1)
Requirement already satisfied: pySmartDL>=1.3.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pipwin) (1.3.4)
Requirement already satisfied: packaging in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pipwin) (21.3)
Requirement already satisfied: pyprind in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pipwin) (2.11.3)
Requirement already satisfied: js2py in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pipwin) (0.71)
Requirement already satisfied: beautifulsoup4>=4.9.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pipwin) (4.10.0)
Requirement already satisfied: soupsieve>1.2 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from beautifulsoup4>=4.9.0->pipwin) (2.3.1)
Requirement already satisfied: tzlocal>=1.2 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from js2py->pipwin) (4.1)
Requirement already satisfied: pyjsparser>=2.5.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from js2py->pipwin) (2.7.1)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from packaging->pipwin) (3.0.6)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from requests->pipwin) (1.26.8)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from requests->pipwin) (2021.10.8)
Requirement already satisfied: idna<4,>=2.5 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from requests->pipwin) (3.3)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from requests->pipwin) (2.0.10)
Requirement already satisfied: tzdata in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from tzlocal>=1.2->js2py->pipwin) (2021.5)
Requirement already satisfied: pytz-deprecation-shim in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from tzlocal>=1.2->js2py->pipwin) (0.1.0.post0)
Installing collected packages: six, pipwin
Successfully installed pipwin-0.5.1 six-1.16.0
C:\Windows\system32>pipwin refresh
Building cache. Hang on . . .
Done
C:\Windows\system32>pipwin install gdal
Package `gdal` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/x6hvwk7i/GDAL-3.4.1-cp39-cp39-win_amd64.whl
GDAL-3.4.1-cp39-cp39-win_amd64.whl
[*] 30.0 MB / 30.0 MB @ 1.6 MB/s [##################] [100%, 0s left]
Processing c:\users\bhyu\pipwin\gdal-3.4.1-cp39-cp39-win_amd64.whl
Installing collected packages: GDAL
Successfully installed GDAL-3.4.1
C:\Windows\system32>pipwin install pyproj
Package `pyproj` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/x6hvwk7i/pyproj-3.3.0-cp39-cp39-win_amd64.whl
pyproj-3.3.0-cp39-cp39-win_amd64.whl
[*] 6.1 MB / 6.1 MB @ 1.4 MB/s [##################] [100%, 0s left]
Processing c:\users\bhyu\pipwin\pyproj-3.3.0-cp39-cp39-win_amd64.whl
Requirement already satisfied: certifi in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pyproj==3.3.0) (2021.10.8)
Installing collected packages: pyproj
Successfully installed pyproj-3.3.0
C:\Windows\system32>pipwin install six
Package `six` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/x6hvwk7i/six-1.16.0-py3-none-any.whl
six-1.16.0-py3-none-any.whl
[*] 11 kB / 11 kB @ 0 bytes/s [##################] [100%, 0s left]
Processing c:\users\bhyu\pipwin\six-1.16.0-py3-none-any.whl
six is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
C:\Windows\system32>pipwin install rtree
Package `rtree` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/x6hvwk7i/Rtree-0.9.7-cp39-cp39-win_amd64.whl
Rtree-0.9.7-cp39-cp39-win_amd64.whl
[*] 322 kB / 322 kB @ 197 kB/s [##################] [100%, 0s left]
Processing c:\users\bhyu\pipwin\rtree-0.9.7-cp39-cp39-win_amd64.whl
Installing collected packages: Rtree
Successfully installed Rtree-0.9.7
C:\Windows\system32>pipwin install shapely
Package `shapely` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/x6hvwk7i/Shapely-1.8.1.post1-cp39-cp39-win_amd64.whl
Shapely-1.8.1.post1-cp39-cp39-win_amd64.whl
[*] 965 kB / 965 kB @ 415 kB/s [##################] [100%, 0s left]
Processing c:\users\bhyu\pipwin\shapely-1.8.1.post1-cp39-cp39-win_amd64.whl
Installing collected packages: Shapely
Successfully installed Shapely-1.8.1.post1
C:\Windows\system32>pipwin install fiona
Package `fiona` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/x6hvwk7i/Fiona-1.8.21-cp39-cp39-win_amd64.whl
Fiona-1.8.21-cp39-cp39-win_amd64.whl
[*] 540 kB / 540 kB @ 289 kB/s [##################] [100%, 0s left]
Processing c:\users\bhyu\pipwin\fiona-1.8.21-cp39-cp39-win_amd64.whl
Requirement already satisfied: cligj>=0.5 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from Fiona==1.8.21) (0.7.2)
Requirement already satisfied: six>=1.7 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from Fiona==1.8.21) (1.16.0)
Requirement already satisfied: click-plugins>=1.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from Fiona==1.8.21) (1.1.1)
Requirement already satisfied: certifi in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from Fiona==1.8.21) (2021.10.8)
Requirement already satisfied: gdal~=3.4.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from Fiona==1.8.21) (3.4.1)
Requirement already satisfied: click>=4.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from Fiona==1.8.21) (8.0.3)
Requirement already satisfied: munch in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from Fiona==1.8.21) (2.5.0)
Requirement already satisfied: setuptools in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from Fiona==1.8.21) (57.4.0)
Requirement already satisfied: attrs>=17 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from Fiona==1.8.21) (21.4.0)
Requirement already satisfied: colorama in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from click>=4.0->Fiona==1.8.21) (0.4.4)
Installing collected packages: Fiona
Successfully installed Fiona-1.8.21
C:\Windows\system32>pipwin install rasterio
Package `rasterio` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/x6hvwk7i/rasterio-1.2.10-cp39-cp39-win_amd64.whl
rasterio-1.2.10-cp39-cp39-win_amd64.whl
[*] 1.1 MB / 1.1 MB @ 514 kB/s [##################] [100%, 0s left]
Processing c:\users\bhyu\pipwin\rasterio-1.2.10-cp39-cp39-win_amd64.whl
Requirement already satisfied: attrs in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio==1.2.10) (21.4.0)
Collecting numpy
Using cached numpy-1.22.2-cp39-cp39-win_amd64.whl (14.7 MB)
Requirement already satisfied: gdal~=3.4.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio==1.2.10) (3.4.1)
Requirement already satisfied: cligj>=0.5 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio==1.2.10) (0.7.2)
Requirement already satisfied: click>=4.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio==1.2.10) (8.0.3)
Requirement already satisfied: certifi in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio==1.2.10) (2021.10.8)
Requirement already satisfied: click-plugins in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio==1.2.10) (1.1.1)
Requirement already satisfied: affine in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio==1.2.10) (2.3.0)
Requirement already satisfied: snuggs>=1.4.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio==1.2.10) (1.4.7)
Requirement already satisfied: setuptools in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio==1.2.10) (57.4.0)
Requirement already satisfied: colorama in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from click>=4.0->rasterio==1.2.10) (0.4.4)
Requirement already satisfied: pyparsing>=2.1.6 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from snuggs>=1.4.1->rasterio==1.2.10) (3.0.6)
Installing collected packages: numpy, rasterio
Successfully installed numpy-1.22.2 rasterio-1.2.10
C:\Windows\system32>pipwin install pandas
Package `pandas` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/x6hvwk7i/pandas-1.4.1-cp39-cp39-win_amd64.whl
pandas-1.4.1-cp39-cp39-win_amd64.whl
[*] 9.7 MB / 9.7 MB @ 1.8 MB/s [##################] [100%, 0s left]
Processing c:\users\bhyu\pipwin\pandas-1.4.1-cp39-cp39-win_amd64.whl
Requirement already satisfied: python-dateutil>=2.8.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pandas==1.4.1) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pandas==1.4.1) (2021.3)
Requirement already satisfied: numpy>=1.18.5 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pandas==1.4.1) (1.22.2)
Requirement already satisfied: six>=1.5 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from python-dateutil>=2.8.1->pandas==1.4.1) (1.16.0)
Installing collected packages: pandas
Successfully installed pandas-1.4.1
C:\Windows\system32>pipwin install geopandas
Package `geopandas` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/x6hvwk7i/cp27/geopandas-0.6.2-py2.py3-none-any.whl
geopandas-0.6.2-py2.py3-none-any.whl
File C:\Users\bhyu\pipwin\geopandas-0.6.2-py2.py3-none-any.whl already exists
Processing c:\users\bhyu\pipwin\geopandas-0.6.2-py2.py3-none-any.whl
Requirement already satisfied: pyproj in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from geopandas==0.6.2) (3.3.0)
Requirement already satisfied: shapely in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from geopandas==0.6.2) (1.8.1.post1)
Requirement already satisfied: pandas>=0.23.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from geopandas==0.6.2) (1.4.1)
Requirement already satisfied: fiona in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from geopandas==0.6.2) (1.8.21)
Requirement already satisfied: numpy>=1.18.5 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pandas>=0.23.0->geopandas==0.6.2) (1.22.2)
Requirement already satisfied: pytz>=2020.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pandas>=0.23.0->geopandas==0.6.2) (2021.3)
Requirement already satisfied: python-dateutil>=2.8.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pandas>=0.23.0->geopandas==0.6.2) (2.8.2)
Requirement already satisfied: attrs>=17 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from fiona->geopandas==0.6.2) (21.4.0)
Requirement already satisfied: gdal~=3.4.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from fiona->geopandas==0.6.2) (3.4.1)
Requirement already satisfied: six>=1.7 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from fiona->geopandas==0.6.2) (1.16.0)
Requirement already satisfied: certifi in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from fiona->geopandas==0.6.2) (2021.10.8)
Requirement already satisfied: cligj>=0.5 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from fiona->geopandas==0.6.2) (0.7.2)
Requirement already satisfied: setuptools in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from fiona->geopandas==0.6.2) (57.4.0)
Requirement already satisfied: munch in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from fiona->geopandas==0.6.2) (2.5.0)
Requirement already satisfied: click>=4.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from fiona->geopandas==0.6.2) (8.0.3)
Requirement already satisfied: click-plugins>=1.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from fiona->geopandas==0.6.2) (1.1.1)
Requirement already satisfied: colorama in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from click>=4.0->fiona->geopandas==0.6.2) (0.4.4)
Installing collected packages: geopandas
Successfully installed geopandas-0.6.2
C:\Windows\system32>pipwin install numpy
Package `numpy` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/x6hvwk7i/numpy-1.22.2+mkl-cp39-cp39-win_amd64.whl
numpy-1.22.2+mkl-cp39-cp39-win_amd64.whl
[*] 244.8 MB / 244.8 MB @ 1.6 MB/s [##################] [100%, 0s left]
Processing c:\users\bhyu\pipwin\numpy-1.22.2+mkl-cp39-cp39-win_amd64.whl
Installing collected packages: numpy
Attempting uninstall: numpy
Found existing installation: numpy 1.22.2
Uninstalling numpy-1.22.2:
Successfully uninstalled numpy-1.22.2
ERROR: Could not install packages due to an OSError: [WinError 5] 액세스가 거부되었습니다: 'C:\\Users\\bhyu\\AppData\\Local\\Programs\\Python\\Python39\\Lib\\site-packages\\~.mpy\\.libs\\libopenblas.EL2C6PLE4ZYW3ECEVIV3OXXGRN2NRFM2.gfortran-win_amd64.dll'
Consider using the `--user` option or check the permissions.
Traceback (most recent call last):
File "C:\Users\bhyu\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\bhyu\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\bhyu\AppData\Local\Programs\Python\Python39\Scripts\pipwin.exe\__main__.py", line 7, in <module>
File "C:\Users\bhyu\AppData\Local\Programs\Python\Python39\lib\site-packages\pipwin\command.py", line 103, in main
cache.install(package)
File "C:\Users\bhyu\AppData\Local\Programs\Python\Python39\lib\site-packages\pipwin\pipwin.py", line 301, in install
subprocess.check_call([executable, "-m", "pip", "install", wheel_file])
File "C:\Users\bhyu\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Users\\bhyu\\AppData\\Local\\Programs\\Python\\Python39\\python.exe', '-m', 'pip', 'install', 'C:\\Users\\bhyu\\pipwin\\numpy-1.22.2+mkl-cp39-cp39-win_amd64.whl']' returned non-zero exit status 1.
C:\Windows\system32>pipwin install numpy
Package `numpy` found in cache
Downloading package . . .
https://download.lfd.uci.edu/pythonlibs/x6hvwk7i/numpy-1.22.2+mkl-cp39-cp39-win_amd64.whl
numpy-1.22.2+mkl-cp39-cp39-win_amd64.whl
File C:\Users\bhyu\pipwin\numpy-1.22.2+mkl-cp39-cp39-win_amd64.whl already exists
Processing c:\users\bhyu\pipwin\numpy-1.22.2+mkl-cp39-cp39-win_amd64.whl
numpy is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
C:\Windows\system32>pip install matplotlib
Collecting matplotlib
Using cached matplotlib-3.5.1-cp39-cp39-win_amd64.whl (7.2 MB)
Requirement already satisfied: pillow>=6.2.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (9.0.0)
Requirement already satisfied: fonttools>=4.22.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (4.28.5)
Requirement already satisfied: pyparsing>=2.2.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (3.0.6)
Requirement already satisfied: numpy>=1.17 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (1.22.2+mkl)
Requirement already satisfied: packaging>=20.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (21.3)
Requirement already satisfied: cycler>=0.10 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (0.11.0)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (2.8.2)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from matplotlib) (1.3.2)
Requirement already satisfied: six>=1.5 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from python-dateutil>=2.7->matplotlib) (1.16.0)
Installing collected packages: matplotlib
Successfully installed matplotlib-3.5.1
C:\Windows\system32>pip install xgboost
Collecting xgboost
Using cached xgboost-1.5.2-py3-none-win_amd64.whl (106.6 MB)
Requirement already satisfied: scipy in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from xgboost) (1.7.3)
Requirement already satisfied: numpy in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from xgboost) (1.22.2+mkl)
Installing collected packages: xgboost
Successfully installed xgboost-1.5.2
C:\Windows\system32>pip install lightgbm
Collecting lightgbm
Using cached lightgbm-3.3.2-py3-none-win_amd64.whl (1.0 MB)
Requirement already satisfied: numpy in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from lightgbm) (1.22.2+mkl)
Requirement already satisfied: scikit-learn!=0.22.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from lightgbm) (1.0.2)
Requirement already satisfied: wheel in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from lightgbm) (0.37.1)
Requirement already satisfied: scipy in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from lightgbm) (1.7.3)
Requirement already satisfied: joblib>=0.11 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from scikit-learn!=0.22.0->lightgbm) (1.1.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from scikit-learn!=0.22.0->lightgbm) (3.0.0)
Installing collected packages: lightgbm
Successfully installed lightgbm-3.3.2
C:\Windows\system32>pip install pyimpute
Collecting pyimpute
Downloading pyimpute-0.3.tar.gz (7.7 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: scikit-learn in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pyimpute) (1.0.2)
Requirement already satisfied: scipy in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pyimpute) (1.7.3)
Requirement already satisfied: numpy in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pyimpute) (1.22.2+mkl)
Collecting rasterstats
Using cached rasterstats-0.16.0-py3-none-any.whl (16 kB)
Requirement already satisfied: rasterio in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from pyimpute) (1.2.10)
Requirement already satisfied: click-plugins in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio->pyimpute) (1.1.1)
Requirement already satisfied: snuggs>=1.4.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio->pyimpute) (1.4.7)
Requirement already satisfied: attrs in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio->pyimpute) (21.4.0)
Requirement already satisfied: certifi in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio->pyimpute) (2021.10.8)
Requirement already satisfied: gdal~=3.4.1 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio->pyimpute) (3.4.1)
Requirement already satisfied: setuptools in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio->pyimpute) (57.4.0)
Requirement already satisfied: cligj>=0.5 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio->pyimpute) (0.7.2)
Requirement already satisfied: affine in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio->pyimpute) (2.3.0)
Requirement already satisfied: click>=4.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterio->pyimpute) (8.0.3)
Requirement already satisfied: simplejson in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterstats->pyimpute) (3.17.6)
Requirement already satisfied: fiona in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterstats->pyimpute) (1.8.21)
Requirement already satisfied: shapely in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from rasterstats->pyimpute) (1.8.1.post1)
Requirement already satisfied: joblib>=0.11 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from scikit-learn->pyimpute) (1.1.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from scikit-learn->pyimpute) (3.0.0)
Requirement already satisfied: colorama in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from click>=4.0->rasterio->pyimpute) (0.4.4)
Requirement already satisfied: pyparsing>=2.1.6 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from snuggs>=1.4.1->rasterio->pyimpute) (3.0.6)
Requirement already satisfied: six>=1.7 in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from fiona->rasterstats->pyimpute) (1.16.0)
Requirement already satisfied: munch in c:\users\bhyu\appdata\local\programs\python\python39\lib\site-packages (from fiona->rasterstats->pyimpute) (2.5.0)
Building wheels for collected packages: pyimpute
Building wheel for pyimpute (setup.py) ... done
Created wheel for pyimpute: filename=pyimpute-0.3-py3-none-any.whl size=6044 sha256=bcac955c3e9330544ed9afd6f2941723b34bc4da7feb39973b0715eed466b886
Stored in directory: c:\users\bhyu\appdata\local\pip\cache\wheels\aa\e7\4b\0b0c4efeb3767ae2cd7a6b3c5ff503cccb82c437fb40cb8f67
Successfully built pyimpute
Installing collected packages: rasterstats, pyimpute
Successfully installed pyimpute-0.3 rasterstats-0.16.0
C:\Windows\system32>