I had the same issue. The solution is to change the Python Interpreter. You can do it by Ctrl+Shift+P and choose "Python: Select Interpreter" in visual studio code.

Answer from KKK on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 73367884 › import-discord-could-not-be-resolved-error
python - Import "discord" could not be resolved error - Stack Overflow
Run VS Code as administrator > Navigate to your project path in the Terminal (CMD) in VS Code > Then Run the command py -3 -m pip install -U discord.py
🌐
GitHub
github.com › microsoft › vscode-python › discussions › 19538
I can't import Discord module for Python 3.10 · microsoft/vscode-python · Discussion #19538
After that, in my code, just type "import discord" and everything should run perfectly. Beta Was this translation helpful?
Author   microsoft
Discussions

python - i have download discord package but its not working in vscode - Stack Overflow
I have download discord in command prompt but when I type import discord in vscode it cant find the file. I have tried uninstalling and reinstalling it. What do i do? If i run a code this pops up No More on stackoverflow.com
🌐 stackoverflow.com
python - Discord.py not being detected in vscode - Stack Overflow
I had installed discord.py in cmd like so, pip install discord.py, but whenever I type import discord in vscode, It doesnt seem to detect it and gives the error "Import "discord" could not be resolved". I also made a new terminal in vscode and typed in pip install discord.py, and it said that ... More on stackoverflow.com
🌐 stackoverflow.com
Discord Bot Problems
Have you restarted VSCode?Have you Installed it in the right version of python ie. if you did python pip install or python3 pip install.At the bottom of your VSCode make sure youre using the version of python you installed it into. If those don't work, feel free to message me on discord: LeMoN107 Edit: Is your import Discord, capital D? Im pretty sure its meant to be lower case More on reddit.com
🌐 r/discordbots
1
1
August 20, 2023
python 3.x - Pip install discord not working in Vs code - Stack Overflow
I've tried everything I know to do but every time I add "import discord" it says "Import "discord" could not be resolved". I've tried python3 -m pip install discord, pip More on stackoverflow.com
🌐 stackoverflow.com
🌐
Bobby Hadz
bobbyhadz.com › blog › python-no-module-named-discord
ModuleNotFoundError: No module named 'discord' in Python | bobbyhadz
April 9, 2024 - To solve the error, install the module by running the pip install discord.py command. Open your terminal in your project's root directory and install the discord.py module. ... Copied!# 👇️ In a virtual environment or using Python 2 pip ...
🌐
Stack Overflow
stackoverflow.com › questions › 65911378 › i-have-download-discord-package-but-its-not-working-in-vscode
python - i have download discord package but its not working in vscode - Stack Overflow
above, in the environment select the python version you will be using (in the existing environment tab) if your issue was with you not adding python to the path, after doing so, you have to run pip install discord again.
🌐
Stack Overflow
stackoverflow.com › questions › 65033103 › discord-py-not-being-detected-in-vscode
python - Discord.py not being detected in vscode - Stack Overflow
How can I import and use discord in vscode?? ... Please install the required modules in the currently selected environment: (You could use the shortcut key Ctrl+Shift+` to open a new VSCode terminal, it will automatically enter the current Python environment)
🌐
Reddit
reddit.com › r/discordbots › discord bot problems
r/discordbots on Reddit: Discord Bot Problems
August 20, 2023 -

Hello! I've been having problems recently with VS Code. I've been trying to make a discord bot for my discord server and I don't know if it's a VS Code problem or maybe the terminal downloaded the files wrong. This is the code i have typed out:

import Discord
import random
Token = "yourtokenhere"
client = Discord.Client()
*client.event
async def on_ready():
print("We have logged in as (0.user)".format(client))
client.run(Token)

The * is supposed to be an At sign but reddit seems to hate At signs.

When I run the code I get this message:

line 1: 'Import discord'

ModuleNotFoundError: no module named 'discord'

I have already downloaded discord.py into VS code. Also Discord on line 1 has a red line under it. if I hover over it with my mouse you get this: Import "Discord" could not be resolved Pylance(reportMissingImports)

Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 74346818 › pip-install-discord-not-working-in-vs-code
python 3.x - Pip install discord not working in Vs code - Stack Overflow
# Linux/macOS python3 -m pip install -U discord.py # Windows py -3 -m pip install -U discord.py Otherwise to get voice support you should run the following command: # Linux/macOS python3 -m pip install -U "discord.py[voice]" # Windows py -3 -m pip install -U discord.py[voice] To install the development version, do the following: $ git clone https://github.com/Rapptz/discord.py $ cd discord.py $ python3 -m pip install -U .[voice]
🌐
GitHub
github.com › microsoft › pylance-release › issues › 1448
Missing imports -> discord.py; python-dotenv · Issue #1448 · microsoft/pylance-release
June 14, 2021 - No.1 Module: discord.py import discord Response: Import "discord" could not be resolved No.2 Module: python-dotenv from dotenv import load_dotenv Response: Import "dotenv" could not be resolved ### Tasks
Author   prithvi2k2
🌐
Stack Overflow
stackoverflow.com › questions › 72799188 › import-discord-could-not-be-resolved-all-module-importing-already-done
python - Import "discord" could not be resolved, all module importing already done - Stack Overflow
June 29, 2022 - I've even done the pip module importing like: pip install discord. If anyone has some ideas of what I can do please post them in the answers. ... The library you used is probably discord.py? Then the appropriate pip command would be python3 -m pip install -U discord.py. Did VSCode pick up your virtual environment properly?
🌐
Finxter
blog.finxter.com › modulenotfounderror-no-module-named-discord-in-python
ModuleNotFoundError: No Module Named ‘discord’ in Python – Be on the Right Side of Change
May 14, 2023 - Quick Fix: Python raises the ImportError: No module named 'discord' when it cannot find the library discord.py. The most likely reason is that you haven’t installed discord explicitly with pip install discord.py.
🌐
Stack Overflow
stackoverflow.com › questions › 79565543 › vs-code-cannot-find-discord-py-module
python - VS Code cannot find discord.py module - Stack Overflow
An issue that I've searched and searched for a solution to with no avail. I've installed the discord.py module through the cmd prompt using the command py -3 -m pip install -U discord.py Running it
🌐
Reddit
reddit.com › r/learnpython › what the actual!?
r/learnpython on Reddit: What the Actual!?
January 21, 2024 -

Once again my excitement has turned to frustration doing what probably is very fcking simple.

I thought it looked like a fun project to make a discord bot.

I make a new directory, create a virtual environment, activate the virtual environment, install the packages. Should be good yeah?

.env is present in the main directory complete with the discord token.

  • I open VScode I even activate the virtual environment in the VSCode terminal.

  • When I get to the part where I import discord & from dotenv import load_dotenv it will not work.

  • VSCode claims that 'Import "discord" could not be resolved'

Both packages definitely installed successfully and can be found in the .venv/Lib/site-packages

This is the same method I would use to set up a django project which is something I have a little more experience with.

Can anyone tell me where I've gone wrong or explain what is happening so I can avoid it next time?

Thanks.

edit: I should also mention that I'm 99.99% it's not a typo, I've tried typing it out myself and copying it straight from the GitHub repo that was provided with the tutorial.

🌐
YouTube
youtube.com › codestack
import discord python not working - YouTube
AboutPressCopyrightContact usCreatorsAdvertiseDevelopersTermsPrivacyPolicy & SafetyHow YouTube worksTest new featuresNFL Sunday Ticket · © 2024 Google LLC
Published   February 1, 2024
Views   113
🌐
Replit
ask.replit.com › t › import-discord-problems › 30930
Import discord problems - Python
May 13, 2023 - Everything you need to know about the Replit Community.
🌐
Stack Overflow
stackoverflow.com › questions › 69476434 › how-to-solve-reportmissingimports-from-discord-in-vscode
python 3.10 - How to solve reportMissingImports from discord in vscode - Stack Overflow
October 7, 2021 - My Python is 3.10.0 64-bit and I just install Microsoft Visual C++ Build Tools to solve problem about wheel.Now I can install discord package but when I building a discord bot I got this this is my problem picture ... 'Import "Path.to.own.script" could not be resolved Pylance (reportMissingImports)' in VS Code using Python 3.x on Ubuntu 20.04 LTS
🌐
GitHub
github.com › Rapptz › discord.py › issues › 228
ImportError: No module named 'discord' · Issue #228 · Rapptz/discord.py
May 27, 2016 - I have installed the module for discord properly, using python3.5 but when I compile my file, i get the above error. What do I do to fix it
Published   May 27, 2016
Author   TomOrth
🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 1093387 › import-could-not-be-resolved-in-vs-code
Import could not be resolved in VS Code - Microsoft Q&A
November 17, 2022 - @Krishnamohan Nadimpalli As per the error the module encodings couldn't be found. Further when I looked into the python packages here I couldn't find any package with the module name as encodings.