. Advertisement .
..3..
. Advertisement .
..4..
I get the “could not open requirements file: [errno 2] no such file or directory: ‘requirements.txt’” issue when trying to run the command pip install -r requirements.txt in my Django project directory.
Here is the detail of the error I got the error message:
[Errno 2] No such file or directory: 'requirements.txt'
Please give me some advice to solve this problem.
The cause: I think the cause is that you didn’t update your Docker file.
Solution: To fix this error, simply insert the following line in your Dockerfile before “RUN pip install —no-cache-dir -r requirements.txt” to create the requirements.txt file.
Use the following line if you’re using a virtual environment.
pip freeze > requirements.txt
It asks to first create the requirements file.
Or in dockerfile,
RUN pip freeze > requirements.txt
.