Closed suyons closed 3 months ago
app/main.py
실행 시 다음과 같은 오류가 발생
ImportError: cannot import name 'triu' from 'scipy.linalg' (/usr/local/lib/python3.12/site-packages/scipy/linalg/init.py)
gensim에서 요구하는 scipy.linalg 내의 triu 함수가 없다는 의미로, 아래의 scipy 공식 문서를 찾아 해당 함수가 없는 원인을 파악함.
https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.triu.html
다음 부분에 주목.
Deprecated since version 1.11.0: triu is deprecated in favour of numpy.triu and will be removed in SciPy 1.13.0.
SciPy 현재 최신 버전은 1.13.0 이후라서 triu() 함수가 삭제된 것으로 판단하였다.
https://pypi.org/project/scipy/#history
위의 링크를 참고하여 삭제되지 않고 deprecated 상태로 쓸 수 있는 1.11.1 버전으로 별도 설치 진행.
docker exec -it data /bin/bash
pip uninstall scipy
pip install scipy=1.11.1
scipy를 설치하는 과정에서 컴파일러를 찾을 수 없다는 오류가 표시되었다.
root@62c241ca5337:/data# pip install scipy==1.11.1
Collecting scipy==1.11.1
Downloading scipy-1.11.1.tar.gz (56.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.0/56.0 MB 476.4 kB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [43 lines of output]
...
../../meson.build:82:0: ERROR: Unknown compiler(s): [['gfortran'], ['flang'], ['nvfortran'], ['pgfortran'], ['ifort'], ['ifx'], ['g95']]
gfortran 이라는 컴파일러가 없어서 발생한 문제로 판단하여 gfortran 설치 시도
root@62c241ca5337:/data# apt update
root@62c241ca5337:/data# apt install gfortran
root@62c241ca5337:/data# pip install scipy==1.11.1
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [43 lines of output]
../../scipy/meson.build:159:9: ERROR: Dependency "OpenBLAS" not found, tried pkgconfig
openblas 패키지 설치 시도
root@62c241ca5337:/data# apt install python3-pkgconfig libopenblas-dev
root@62c241ca5337:/data# pip install scipy==1.11.1
...
reparing metadata (pyproject.toml) ... done
...
Successfully installed scipy-1.11.1
이후 main.py 실행에 성공하였다.
Close #56
concurrent.futures
를 이용한 병렬 작업 처리 참조 문서