6

I'm following the tutorial to deploy Django applications on Heroku.

In the 5th line of the code, it says pip freeze > requirements.txt but when I run it (from the venv), the requirements.txt file is empty! It produced 6-7 dependencies with the same code before.

How can I fix this?

1
  • what do you see when just run this command? you could see something? Commented Oct 22, 2016 at 14:24

3 Answers 3

6

That probably means the dependencies are installed on your global environment.

Switch to the virtual environment, and install the dependencies manually using pip install <dependency> and then running pip freeze should output the dependencies.

Sign up to request clarification or add additional context in comments.

2 Comments

I was using venv (activating it too) but I never thought of installing the dependencies myself beforehand. I will try that. Thanks,
I faced such an issue after Python 3 upgrade. My old way of doing pip freezewas not working anymore (empty list) . I suppose a path issue (surely need to update python (or PIP) path after its upgrade ; I have to document myself because I'm not sure how to do it) but after doing python3 -m pip freeze > requirements.txt, I could see again the list of all my dependencies.
1

This answer is for posterity

  • This could be because of pip being deprecated.So upgrade pip by using
python -m pip install -–upgrade pip 

Then run pip freeze > requirements.txt as usually.This should do the job.

Comments

0

I get the same error but I figured it out now. I had my virtual environment set up using PowerShell (preferred for sys commands) that has the dependencies installed but I was running the Python shell with the command "pip freeze > requuiremnts.txt". When I ran the same command on PowerShell then I got requirements.txt populated with dependencies.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.