python
config_error
ai_generated
true
ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
ID: python/pip-req-file-not-found
80%Fix Rate
90%Confidence
0Evidence
2024-03-05First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
Root Cause
pip is invoked from a directory that does not contain the requirements file, or the filename is misspelled (e.g. requirements-dev.txt).
generic中文
pip 是从不包含 requirements 文件的目录调用的,或文件名拼写错误(例如 requirements-dev.txt)。
Workarounds
-
98% success
pwd ls requirements*.txt pip install -r "$(pwd)/requirements.txt"
-
90% success
pip freeze > requirements.txt pip install -r requirements.txt
Dead Ends
Common approaches that don't work:
-
95% fail
The error is a missing file, not a pip bug; upgrading does not create the file.
-
95% fail
--no-cache-dir affects the HTTP cache, not file lookup; the same FileNotFoundError occurs.