dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
717 stars 163 forks source link

ImportError: cannot import name 'create_settings_activity' from 'discord.activity' #164

Closed TheOnlyWayUp closed 2 years ago

TheOnlyWayUp commented 2 years ago

Summary

Whenever I try to import discord, it errors and which prevents me from finishing what I'm currently working on.

Reproduction Steps

import discord

Code

import discord
from discord.ext import commands

Expected Results

It's supposed to import discord without any errors.

Actual Results

It errors while importing discord.

System Information

Can't run it because discord.py-self errors, I also get an error when I run that command in my venv.

Normal Discord.py -

I'm currently using the discord.py-self@rebase version (discord.py-self-2.0.0a1).

Checklist

Additional Information

When installing the library, I'm using the same version of python and such too.

Collecting git+https://github.com/dolfies/discord.py-self@rebase
  Cloning https://github.com/dolfies/discord.py-self (to revision rebase) to /tmp/pip-req-build-cvo3zsw3
  Running command git clone -q https://github.com/dolfies/discord.py-self /tmp/pip-req-build-cvo3zsw3
  Running command git checkout -b rebase --track origin/rebase
  Switched to a new branch 'rebase'
  Branch 'rebase' set up to track remote branch 'rebase' from 'origin'.
Requirement already satisfied: aiohttp<3.8.0,>=3.6.0 in ./venv/lib/python3.9/site-packages (from discord.py-self==2.0.0a1) (3.7.4.post0)
Requirement already satisfied: multidict<7.0,>=4.5 in ./venv/lib/python3.9/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py-self==2.0.0a1) (5.2.0)
Requirement already satisfied: typing-extensions>=3.6.5 in ./venv/lib/python3.9/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py-self==2.0.0a1) (4.0.1)
Requirement already satisfied: chardet<5.0,>=2.0 in ./venv/lib/python3.9/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py-self==2.0.0a1) (4.0.0)
Requirement already satisfied: attrs>=17.3.0 in ./venv/lib/python3.9/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py-self==2.0.0a1) (21.2.0)
Requirement already satisfied: yarl<2.0,>=1.0 in ./venv/lib/python3.9/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py-self==2.0.0a1) (1.7.2)
Requirement already satisfied: async-timeout<4.0,>=3.0 in ./venv/lib/python3.9/site-packages (from aiohttp<3.8.0,>=3.6.0->discord.py-self==2.0.0a1) (3.0.1)
Requirement already satisfied: idna>=2.0 in ./venv/lib/python3.9/site-packages (from yarl<2.0,>=1.0->aiohttp<3.8.0,>=3.6.0->discord.py-self==2.0.0a1) (3.3)
Building wheels for collected packages: discord.py-self
  Building wheel for discord.py-self (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /root/code/mSelfbot/venv/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-cvo3zsw3/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-cvo3zsw3/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-rni4t31q
       cwd: /tmp/pip-req-build-cvo3zsw3/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help

  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for discord.py-self
  Running setup.py clean for discord.py-self
Failed to build discord.py-self
Installing collected packages: discord.py-self
    Running setup.py install for discord.py-self ... done
Successfully installed discord.py-self-2.0.0a1
TheOnlyWayUp commented 2 years ago

To fix the error: invalid command 'bdist_wheel' error during pip install, I did python3.9 -m pip install wheel and that error is no longer, but discord.py-self-2.0.0a1 still errors on import.

dolfies commented 2 years ago

This is a problem caused by me having to revert a commit that caused issues related to sessions. This left the branch in a broken state. A new commit will be pushed soon.

TheOnlyWayUp commented 2 years ago

@dolfies Hey, any updates?

TheOnlyWayUp commented 2 years ago

Seems to also be present in commit 56226fbbab34669fafbb17f57a0cf5e791308ca8, 887e83de90146b6e73230bb34f6ef0e66da910d0, I'm testing previous commits.

dolfies commented 2 years ago

I've been busy the past few days, so haven't been able to touch code. Will be fixed soon.

dolfies commented 2 years ago

Should be good now.

TheOnlyWayUp commented 2 years ago

image

image

Downloadeded the new version after uninstall discord.py-self and discord.

image

Issue still persists image

It's still an issue with importing discord, as when I do it in terminal -

image

Traceback -

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/root/code/MCStalker/gungyDataStealer/discord/__init__.py", line 23, in <module>
    from .client import *
  File "/root/code/MCStalker/gungyDataStealer/discord/client.py", line 36, in <module>
    from .user import User, ClientUser, Note
  File "/root/code/MCStalker/gungyDataStealer/discord/user.py", line 29, in <module>
    import discord.abc
  File "/root/code/MCStalker/gungyDataStealer/discord/abc.py", line 58, in <module>
    from .settings import ChannelSettings
  File "/root/code/MCStalker/gungyDataStealer/discord/settings.py", line 30, in <module>
    from .activity import create_settings_activity
ImportError: cannot import name 'create_settings_activity' from 'discord.activity' (/root/code/MCStalker/gungyDataStealer/discord/activity.py)

Please ignore the name, MCStalker is a website I develop for, and gungyDataStealer is a selfbot for chat logs, hence the name data stealer.

TheOnlyWayUp commented 2 years ago

@dolfies Please re-open this issue

dolfies commented 2 years ago

Cannot reproduce locally.

Python 3.10.1 (main, Dec 19 2021, 23:36:08) [GCC 11.1.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.30.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import discord

In [2]: from discord.activity import create_settings_activity
TheOnlyWayUp commented 2 years ago

Fixed, looks like it was something with my pip cache as git clone and pip install git+ worked on other devices, thanks!