Search code examples
pythonherokudiscord.pyrequirements.txt

Heroku installing wrong python version


My application(discord bot - discord.py-v2) works fine locally. I have given python-3.10.4 in the runtime.txt file. When I try to push the changes to Heroku, it says Installing python-3.6.13. There are errors during the execution of the requirements.txt file. Another app with the same requirements.txt file and python3.10 works fine on SparkedHost.

requirements.txt

aiohttp>=3.7.4,<4
aiosignal==1.2.0
async-timeout
attrs==21.4.0
autopep8==1.6.0
discord-ext-bot==1.0.1
discord-py-interactions==4.2.1
discord-py-slash-command==4.2.1
discord.py @ git+https://github.com/Rapptz/discord.py@1ba290d8c6884daa8a8548ab203fb12bd736576d
import-expression==1.1.4
msgpack==1.0.3
multidict==6.0.2
python-dotenv==0.20.0
python-lsp-jsonrpc==1.0.0
python-lsp-server==1.4.1
pytz==2022.2.1
requests==2.27.1

Errors:

remote:        ERROR: Could not find a version that satisfies the requirement discord-ext-bot==1.0.1 (from versions: none)
remote:        ERROR: No matching distribution found for discord-ext-bot==1.0.1

If I remove discord-ext-bot==1.0.1, discord-py-interactions==4.2.1, and discord-py-slash-command from the file, it says error in discord.py version


Solution

  • You need a runtime.txt and specify the python version there.

    Edit: Heroku only supports certain python versions:

    python-3.10.6 on all supported stacks (recommended)
    python-3.9.13 on all supported stacks
    python-3.8.13 on Heroku-18 and Heroku-20 only
    python-3.7.13 on Heroku-18 and Heroku-20 only
    

    Try using python-3.10.6
    See here