가끔 poetry install 하면
Writing lock file
Installing the current project: cogvideo (0.1.0)
Error: The current project could not be installed: No file/folder found for package cogvideo
If you do not want to install the current project use --no-root.
If you want to use Poetry only for dependency management but not for packaging, you can disable package mode by setting package-mode = false in your pyproject.toml file.
If you did intend to install the current project, you may need to set `packages` in your pyproject.toml file.
이런 문제가 발생한다.
현재 프로젝트는 설치하지 않는다는 말은 Poetry가 pyproject.toml이 있는 이 디렉토리 자체를 Python 패키지처럼 설치하지 않는다는 뜻
보통 poetry install을 하면 두 가지를 시도해:
pyproject.toml에 정의된 의존성 패키지들 설치
→ 예: transformers, torch 등.
이 프로젝트 자체도 패키지로 인식해서 설치
→ 예: pip install .처럼 프로젝트를 site-packages에 넣음.
그런데 지금처럼 이 프로젝트(예: cogvideo)가 어떤 Python 패키지 디렉토리인지 명시되지 않으면, Poetry가 설치할 대상 패키지를 못 찾고 에러를 발생.
만약 다음과 같은 디렉토리 구조가 있다고 가정:
project-root/
├── mypackage/
│ ├── __init__.py
│ └── module.py
├── pyproject.toml
pyproject.toml에 이렇게 적혀 있다면:
[tool.poetry]
name = "mypackage"
version = "0.1.0"
packages = [{ include = "mypackage" }]
poetry install 시 다음이 발생함:
✅ pip install ./mypackage처럼 내 소스 코드도 패키지로 설치됨
✅ import mypackage가 어디서든 가능
너의 경우엔 packages 설정이 없고, 설치 대상 디렉토리(finetune, sat 등)도 명시 안 했으니, Poetry는 프로젝트를 패키지로 설치할 수 없음 → 그래서 "No file/folder found for package" 에러 발생.
--no-root 옵션을 쓰면?poetry install --no-root
이렇게 하면:
cogvideo 프로젝트)는 pip install 대상에서 제외즉, Poetry가 "얘는 패키지로 안 쓸게요, 그냥 폴더일 뿐이에요" 라고 이해
| 용어 | 의미 |
|---|---|
| "현재 프로젝트 설치" | 현재 디렉토리를 pip 패키지로 설치 (예: pip install .) |
| "현재 프로젝트 설치 안함" | Poetry가 현재 프로젝트는 패키지로 취급하지 않음 (import 불가) |
--no-root | 현재 프로젝트는 설치하지 않고, 의존성만 설치함 |