Discord.py: Bump dependency versions to those with wheels for Python 3.9

Created on 29 Oct 2020  路  5Comments  路  Source: Rapptz/discord.py

The Problem

With the release of Python 3.9 came an interesting conundrum for Windows users. discord.py currently (as of 1.5.1) requires aiohttp>=3.6,<3.7, which in turn requires yarl>=1.0,<1.6.0 and multidict>=4.5,<5.0, neither of which has wheels for python 3.9. In addition, the voice extension to discord.py requires PyNaCl==1.3.0 which comes with the same limitation. Windows users need to install the MSVC++ 14.0 compilers and install discord.py in a Native Tools command prompt in order to get discord.py without voice; attempts to install PyNaCl may fail due to the make executable not being found on the system path (even when you're 100% sure it is on the path).

The Ideal Solution

aiohttp==3.7.2 is available on pypi, this relaxes the yarl version requirement to >=1.0,<2.0 and multidict to >=4.5,<7.0. yarl 1.6.2 and multidict 5.0.0 are the current versions of those packages and, in addition to PyNaCl 1.4.0, have wheels for Python 3.9 on Windows.

The Current Solution

Don't use Windows. Or, if you must, use wsl.

Summary

Bump the package requirements for aiohttp and PyNaCl. These may have some breaking changes with discord.py so will need to be tested thoroughly.

feature request

Most helpful comment

If you absolutely need to use 3.9 on Windows, I've created a pip repository index that has my personally-built versions of aiohttp, yarl, multidict, and PyNaCl for both the 32-bit and 64-bit versions of Python 3.9 on Windows.

You can use the index like this, for example with voice support:

py -3.9 -m pip install discord.py[voice] --extra-index-url https://gorialis.github.io/pip/

This should get you discord.py working on Python 3.9 without build tools in the mean time before the dependencies are likely bumped.

All 5 comments

Solution:

Simple, just download python 3.8, unless you have dependencies which need 3.9 or higher for your code just download version 3.8. If you do have 3.9 then uninstall that. I think that should be enough for this feature request

Feature request: Support Python 3.9 (on windows)
Solution: Simple, use Python 3.8

Maybe this should be marked as a workaround instead?

It's not a workaround since you're not using python 3.9

If you absolutely need to use 3.9 on Windows, I've created a pip repository index that has my personally-built versions of aiohttp, yarl, multidict, and PyNaCl for both the 32-bit and 64-bit versions of Python 3.9 on Windows.

You can use the index like this, for example with voice support:

py -3.9 -m pip install discord.py[voice] --extra-index-url https://gorialis.github.io/pip/

This should get you discord.py working on Python 3.9 without build tools in the mean time before the dependencies are likely bumped.

A test shows the following dependency combination seems to work:

python3.9 -m pip install --upgrade pip
python3.9 -m pip install --upgrade "aiohttp>=3.7.2" "numpy<=1.19.3" "PyNaCl>=1.4.0"
python3.9 -m pip install --upgrade --no-dep "discord.py[voice]"

At least I can confirm the voice functions work with no problem and I am already running discord-mic-bot with Python 3.9 on production environment.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xomien picture xomien  路  17Comments

Chicchi73930 picture Chicchi73930  路  17Comments

imayhaveborkedit picture imayhaveborkedit  路  58Comments

Yuvira picture Yuvira  路  18Comments

wolfclaws picture wolfclaws  路  17Comments