Discord.py: Broken aiohttp version in rewrite

Created on 11 May 2018  路  4Comments  路  Source: Rapptz/discord.py

I think that the aiohttp dependency version is broken in rewrite.

The following Dockerfile produces the following traceback when the container is run (src/app.py simply import discord):

FROM python:3.6-alpine3.7

RUN wget 'https://github.com/Rapptz/discord.py/archive/rewrite.tar.gz' -O /tmp/discord.py.tar.gz

RUN pip install /tmp/discord.py.tar.gz

#RUN pip install --upgrade aiohttp

COPY src src

CMD python /src/app.py
Traceback (most recent call last):
  File "/src/app.py", line 1, in <module>
    import discord
  File "/usr/local/lib/python3.6/site-packages/discord/__init__.py", line 20, in <module>
    from .client import Client, AppInfo
  File "/usr/local/lib/python3.6/site-packages/discord/client.py", line 30, in <module>
    from .guild import Guild
  File "/usr/local/lib/python3.6/site-packages/discord/guild.py", line 39, in <module>
    from .channel import *
  File "/usr/local/lib/python3.6/site-packages/discord/channel.py", line 31, in <module>
    from .webhook import Webhook
  File "/usr/local/lib/python3.6/site-packages/discord/webhook.py", line 27, in <module>
    import aiohttp
  File "/usr/local/lib/python3.6/site-packages/aiohttp/__init__.py", line 6, in <module>
    from .client import *  # noqa
  File "/usr/local/lib/python3.6/site-packages/aiohttp/client.py", line 15, in <module>
    from . import connector as connector_mod
  File "/usr/local/lib/python3.6/site-packages/aiohttp/connector.py", line 17, in <module>
    from .client_proto import ResponseHandler
  File "/usr/local/lib/python3.6/site-packages/aiohttp/client_proto.py", line 6, in <module>
    from .http import HttpResponseParser, StreamWriter
  File "/usr/local/lib/python3.6/site-packages/aiohttp/http.py", line 8, in <module>
    from .http_parser import (HttpParser, HttpRequestParser, HttpResponseParser,
  File "/usr/local/lib/python3.6/site-packages/aiohttp/http_parser.py", line 15, in <module>
    from .http_writer import HttpVersion, HttpVersion10
  File "/usr/local/lib/python3.6/site-packages/aiohttp/http_writer.py", line 304, in <module>
    class URL(yarl.URL):
  File "/usr/local/lib/python3.6/site-packages/yarl/__init__.py", line 232, in __init_subclass__
    "is forbidden".format(cls))
TypeError: Inheritance a class <class 'aiohttp.http_writer.URL'> from URL is forbidden

Upgrading aiohttp after the install to the most recent version resolves the issue, but the build warns that discord-py 1.0.0a0 has requirement aiohttp<2.3.0,>=2.0.0, but you'll have aiohttp 3.2.1 which is incompatible.

Most helpful comment

Getting this error?

TypeError: Inheritance a class <class 'aiohttp.http_writer.URL'> from URL is forbidden

This is due to yarl 1.2 having a breaking change that breaks aiohttp. Downgrade your yarl using pip install -U "yarl<1.2"

All 4 comments

Getting this error?

TypeError: Inheritance a class <class 'aiohttp.http_writer.URL'> from URL is forbidden

This is due to yarl 1.2 having a breaking change that breaks aiohttp. Downgrade your yarl using pip install -U "yarl<1.2"

In relation to fourjr's answer above, it may be necessary to downgrade even further pip install "yarl<1" otherwise you'll encounter a different error.

Reference: https://github.com/aio-libs/aiohttp/issues/2662

It may also be worth noting that you can reinstall aiohttp to the most recent version with zero issues instead.

Been running three bots on rewrite for the past month and have yet to come across a problem with this.

892 seems to suggest the author is against updating, however.

Fixed by bumping.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JackL0 picture JackL0  路  3Comments

danshat picture danshat  路  3Comments

superloach picture superloach  路  3Comments

MrBrahm picture MrBrahm  路  3Comments

PicklesJars picture PicklesJars  路  3Comments