Skip to content

"<module_name>" is not accessed Pylance warning when using Conda #5143

Closed Answered by rchiodo
Ritesh313 asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah that's the root cause, your virtual env folder is in the workspace. So we treat it as user source because we can't tell that it's actually a virtual env directory.

You can workaround this a number of ways:

  1. Don't add your virtual env folder under your workspace. Put it somewhere else. You can still set it as the interpreter in use, but then Pylance won't parse it.
  2. Add an explicit python.analysis.exclude setting for that directory
  3. Add a bin/activate script to the venv directories. It doesn't actually have to do anything.

Replies: 3 comments 18 replies

Comment options

You must be logged in to vote
3 replies
@rchiodo
Comment options

rchiodo Dec 1, 2023
Collaborator

@EricYoung37
Comment options

@rchiodo
Comment options

rchiodo Dec 1, 2023
Collaborator

Comment options

You must be logged in to vote
15 replies
@rchiodo
Comment options

rchiodo Dec 1, 2023
Collaborator

@rchiodo
Comment options

rchiodo Dec 1, 2023
Collaborator

@Ritesh313
Comment options

@rchiodo
Comment options

rchiodo Dec 1, 2023
Collaborator

Answer selected by Ritesh313
@Ritesh313
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants