Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Discord Bot
#1
Hi. I have tried to install discord.py, through pip install discord.py in command promp. After installing and writing simple python discord bot code I tried to run it and it says no module named discord. Any ideas how to fix this? I am running python 3.5 and I have already tried reinstalling python and discord.py. Thanks
Reply
#2
you probably installed to a different version of python
try pip -V
to find out which version is in your path.
After getting results,  Is this the version you wanted to install
Reply
#3
C:\Python35\Scripts
λ pip -V
pip 9.0.1 from c:\python35\lib\site-packages (python 3.5)

C:\Python35\Scripts
λ pip install -U discord.py
Collecting discord.py
  Downloading discord.py-0.16.12.tar.gz (414kB)
    100% |################################| 419kB 1.1MB/s
Collecting aiohttp<1.1.0,>=1.0.0 (from discord.py)
  Downloading aiohttp-1.0.5-cp35-cp35m-win32.whl (132kB)
    100% |################################| 133kB 1.9MB/s
Collecting websockets<4.0,>=3.1 (from discord.py)
  Downloading websockets-3.4-cp35-cp35m-win32.whl (50kB)
    100% |################################| 51kB 1.8MB/s
Requirement already up-to-date: chardet in c:\python35\lib\site-packages (from aiohttp<1.1.0,>=1.0.0->discord.py)
Collecting multidict>=2.0 (from aiohttp<1.1.0,>=1.0.0->discord.py)
  Downloading multidict-3.3.2-cp35-cp35m-win32.whl (170kB)
    100% |################################| 174kB 1.9MB/s
Collecting async-timeout (from aiohttp<1.1.0,>=1.0.0->discord.py)
  Downloading async_timeout-2.0.0-py3-none-any.whl
Building wheels for collected packages: discord.py
  Running setup.py bdist_wheel for discord.py ... done
  Stored in directory: C:\Users\Tom\AppData\Local\pip\Cache\wheels\64\75\26\d222074ecf19644df920bd43ad578156fcb00e515efd1cd164
Successfully built discord.py
Installing collected packages: multidict, async-timeout, aiohttp, websockets, discord.py
Successfully installed aiohttp-1.0.5 async-timeout-2.0.0 discord.py-0.16.12 multidict-3.3.2 websockets-3.4

C:\Python35\Scripts
λ cd ..

C:\Python35
λ python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import discord
>>> discord.__version__
'0.16.12'
So here i did go in Scripts folder of 35,to make sure that it install to 3.5.

If you follow Python 3.6 and pip installation under Windows.
Then 3.6 will be added to OS Path.
From anywhere in cmd,it will use python and pip of 3.6.
Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. Med enerett.

C:\Windows\System32>cd\

C:\>pip -V
pip 9.0.1 from c:\python36\lib\site-packages (python 3.6)

C:\>pip install -U discord.py
Collecting discord.py
  Using cached discord.py-0.16.12.tar.gz
Collecting aiohttp<1.1.0,>=1.0.0 (from discord.py)
  Downloading aiohttp-1.0.5.tar.gz (499kB)
    100% |████████████████████████████████| 501kB 1.4MB/s
Collecting websockets<4.0,>=3.1 (from discord.py)
  Downloading websockets-3.4-cp36-cp36m-win32.whl (50kB)
    100% |████████████████████████████████| 51kB 2.1MB/s
Requirement already up-to-date: chardet in c:\python36\lib\site-packages (from aiohttp<1.1.0,>=1.0.0->discord.py)
Collecting multidict>=2.0 (from aiohttp<1.1.0,>=1.0.0->discord.py)
  Downloading multidict-3.3.2-cp36-cp36m-win32.whl (171kB)
    100% |████████████████████████████████| 174kB 2.1MB/s
Collecting async_timeout (from aiohttp<1.1.0,>=1.0.0->discord.py)
  Using cached async_timeout-2.0.0-py3-none-any.whl
Building wheels for collected packages: discord.py, aiohttp
  Running setup.py bdist_wheel for discord.py ... done
  Stored in directory: C:\Users\Tom\AppData\Local\pip\Cache\wheels\64\75\26\d222074ecf19644df920bd43ad578156fcb00e515efd1cd164
  Running setup.py bdist_wheel for aiohttp ... done
  Stored in directory: C:\Users\Tom\AppData\Local\pip\Cache\wheels\3a\80\0c\1d14c58277f1badb06010f07e1fbf879d51c7ad31b37d8a743
Successfully built discord.py aiohttp
Installing collected packages: multidict, async-timeout, aiohttp, websockets, discord.py
Successfully installed aiohttp-1.0.5 async-timeout-2.0.0 discord.py-0.16.12 multidict-3.3.2 websockets-3.4

C:\>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import discord
>>> discord.__version__
'0.16.12'
>>>
Reply
#4
Well, i tried to reinstall, in command promp it says this:
Quote:>>> import discord
>>> discord.__version__
'0.16.12'
but when i open .py with "import discord" it still says:
>>> no module named 'discord'

and also:

Quote:C:\Users\Adam>pip -V
pip 9.0.1 from c:\python35\lib\site-packages (python 3.5)
Reply
#5
If you type python in cmd,dos Python 3.5 start?
If 3.5 start it's then is python my_script.py,and it will use 3.5.

What a editor use can be different,and sometime need to be setup to use right Python version.
Reply
#6
Yes, if I type python in cmd, python 3.5 starts. And I am working in Visual Studio 2017
Reply
#7
Selecting and installing Python interpreters in Visual Studio.
I would say VS code is better choice for Python,my quick review.
Reply
#8
Hi,
I have problem with;
ModuleNotFoundError: No module named 'discord'
Plz if anyone know tell me...
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help discord bot Edward 0 2,059 Sep-15-2022, 09:55 PM
Last Post: Edward
  Discord Bot Dark_Sovereign_193 0 32,323 Jun-03-2021, 03:24 PM
Last Post: Dark_Sovereign_193
  Discord Bot Help Oshadha 0 1,383 Jan-26-2021, 04:23 PM
Last Post: Oshadha
  Creating Discord Bot: Unused import statement 'import discord EyeballCandy 0 3,515 Feb-02-2020, 10:53 PM
Last Post: EyeballCandy
  discord bot lolteam 1 6,023 Aug-31-2017, 08:57 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020