Okay so I want to host my discord bot in Heroku but for the requirements.txt when I use the command pip freeze > requirements.txt in the Cmd it creates the file but with no text in it
1 Answer
You were likely on your global environment, so your virtual environment has no dependencies installed. To fix:
Start your virtual environment (on Mac/Linux)
- Navigate to the folder containing your .py files in the Terminal
- python3 -m venv venv
- source venv/bin/activate
This isn't ideal, but 1-by-1 install your dependencies using "pip install <dependency_name>". You can find your dependency names usually by looking at your "import " statement at the top of your python file. Alternatively, you can find them using:
python3 <app_name.py>
The error message that results in the Terminal will show you the missing dependency.
If "pip3 install <dependency_name>" doesn't work, search on PyPi for the correct name to install. Sometimes they vary.
pip freezegive as output? Also, if you're usingpython3, I recommend tryingpip3 freeze > requirements.txtpip3 freezeorpip freeze?