Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file can't find package in venv even it's already enabled #18861

Closed
RoadToDream opened this issue Apr 5, 2022 · 13 comments
Closed

file can't find package in venv even it's already enabled #18861

RoadToDream opened this issue Apr 5, 2022 · 13 comments
Labels
info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@RoadToDream
Copy link

RoadToDream commented Apr 5, 2022

Issue Type: Bug

Behaviour

Expected vs. Actual

Python extension should look for packages installed in venv, but doesn't.
Which causes the intellisense and debug failed to run due to "package not found" error.

Steps to reproduce:

  1. connect to remote host
  2. set up and enable one venv with pandas package.
  3. pandas package can't be located so intellisense will report can't find package error, and debug on python file failed to run also due to package error.

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.10
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Default
User Settings


defaultLS: {"defaultLSType":"Pylance"}

downloadLanguageServer: true

envFile: "<placeholder>"

venvPath: "<placeholder>"

venvFolders: "<placeholder>"

condaPath: "<placeholder>"

pipenvPath: "<placeholder>"

poetryPath: "<placeholder>"

languageServer: "Pylance"

linting
• enabled: true
• cwd: "<placeholder>"
• Flake8Args: "<placeholder>"
• flake8Enabled: false
• flake8Path: "<placeholder>"
• lintOnSave: true
• banditArgs: "<placeholder>"
• banditEnabled: false
• banditPath: "<placeholder>"
• mypyArgs: "<placeholder>"
• mypyEnabled: false
• mypyPath: "<placeholder>"
• pycodestyleArgs: "<placeholder>"
• pycodestyleEnabled: false
• pycodestylePath: "<placeholder>"
• prospectorArgs: "<placeholder>"
• prospectorEnabled: false
• prospectorPath: "<placeholder>"
• pydocstyleArgs: "<placeholder>"
• pydocstyleEnabled: false
• pydocstylePath: "<placeholder>"
• pylamaArgs: "<placeholder>"
• pylamaEnabled: false
• pylamaPath: "<placeholder>"
• pylintArgs: "<placeholder>"
• pylintPath: "<placeholder>"

sortImports
• args: "<placeholder>"
• path: "<placeholder>"

formatting
• autopep8Args: "<placeholder>"
• autopep8Path: "<placeholder>"
• provider: "autopep8"
• blackArgs: "<placeholder>"
• blackPath: "<placeholder>"
• yapfArgs: "<placeholder>"
• yapfPath: "<placeholder>"

testing
• cwd: "<placeholder>"
• debugPort: 3000
• nosetestArgs: "<placeholder>"
• nosetestsEnabled: undefined
• nosetestPath: "<placeholder>"
• promptToConfigure: true
• pytestArgs: "<placeholder>"
• pytestEnabled: false
• pytestPath: "<placeholder>"
• unittestArgs: "<placeholder>"
• unittestEnabled: false
• autoTestDiscoverOnSaveEnabled: true

terminal
• activateEnvironment: true
• executeInFileDir: "<placeholder>"
• launchArgs: "<placeholder>"

experiments
• enabled: true
• optInto: []
• optOutFrom: []

tensorBoard
• logDirectory: "<placeholder>"

Extension version: 2022.4.0
VS Code version: Code 1.66.0 (e18005f0f1b33c29e81d732535d8c0e47cafb0b5, 2022-03-30T05:50:14.623Z)
OS version: Windows_NT x64 10.0.22000
Restricted Mode: No
Remote OS version: Linux x64 5.13.0-39-generic
Remote OS version: Linux x64 5.13.0-39-generic

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i9-12900H (20 x 2918)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: unavailable_off
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.67GB (19.37GB free)
Process Argv --crash-reporter-id 3016292f-22c4-4da5-a8cd-6e1f94c25bf6
Screen Reader no
VM 0%
Item Value
Remote SSH:
OS Linux x64 5.13.0-39-generic
CPUs 11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz (16 x 3223)
Memory (System) 31.03GB (22.05GB free)
VM 0%
Item Value
Remote SSH:
OS Linux x64 5.13.0-39-generic
CPUs 11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz (16 x 3223)
Memory (System) 31.03GB (22.05GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30443607
pythontb:30283811
pythonvspyt551cf:30345471
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263cf:30335440
vscorecescf:30445987
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
pythonvsnew555:30457759
vscscmwlcmt:30465135
pynewfile477:30463512

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Apr 5, 2022
@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. triage and removed triage-needed Needs assignment to the proper sub-team labels Apr 5, 2022
@kimadeline
Copy link

Hi @RoadToDream, thank you for reaching out.

Is the interpreter selected in VS Code the same as the one from your virtual environment?

@kimadeline kimadeline added the info-needed Issue requires more information from poster label Apr 5, 2022
@RoadToDream
Copy link
Author

Hi @kimadeline, hope you are doing well!
Yes, I select the correct venv for vscode interpreter.
I have attached a screenshot of my configuration. As shown in the picture below, I have selected the python interpreter, and pandas is installed in the venv, but intellisense will report "could not be resolved from source" error, debug failed to run also due to the same error.
image

@kimadeline
Copy link

Hi there, sorry for the delay!

Could you try resetting the path to the environment in the extension (select it again), and reinstalling pandas using path/to/your/ffs/bin/python -m pip install pandas==1.4.1?

Is pandas the only package that cannot be found, or does it happen for other packages you've installed as well?

How do you connect to the remote machine?

@huahua7608
Copy link

Hi, @kimadeline , I also met the same problem.
I tried resetting the path and reinstalling pandas but useless.
Other package like 'torch' also cannot be found.
(T^T)

@kimadeline
Copy link

Hi @huahua7608, how do you connect to the remote machine?

@RoadToDream
Copy link
Author

Hi @kimadeline , sorry for the delay. I found that the issue can be fixed by reenable the venv and reopen the file together. I guess there might be somewhere needs a refresh after packages are installed after enabling the venv in VS code. But I can take the workaround for now.

@kimadeline
Copy link

Glad to hear you found a workaround! What do you mean by reenabling the venv?

@RoadToDream
Copy link
Author

Glad to hear you found a workaround! What do you mean by reenabling the venv?

For reenabling the vnev, I mean select a python interpreter other than the one used in the current venv and then select back.

@kimadeline kimadeline added needs spike Label for issues that need investigation before they can be worked on. and removed info-needed Issue requires more information from poster triage labels May 3, 2022
@kimadeline kimadeline removed their assignment May 3, 2022
@kimadeline
Copy link

Sounds good! We'll have to dig a little bit further to see what's causing this issue.

@JerrodP
Copy link

JerrodP commented Jun 30, 2023

I'm also experiencing this issue. It's mind-numbing

@eleanorjboyd
Copy link
Member

@karrtikr any thoughts?

Are people still experiencing this issue?

@karrtikr
Copy link

Sounds like a Pylance issue if packages are not found, we should probably transfer.

@eleanorjboyd eleanorjboyd added triage-needed Needs assignment to the proper sub-team and removed bug Issue identified by VS Code Team member as probable bug area-intellisense LSP-related functionality: auto-complete, docstrings, navigation, refactoring, etc. needs spike Label for issues that need investigation before they can be worked on. triage-needed Needs assignment to the proper sub-team labels Dec 14, 2023
@anthonykim1
Copy link

There were several changes that we made regarding venv. Please file an issue if you keep experiencing the problem.

@anthonykim1 anthonykim1 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 18, 2023
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Dec 18, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

8 participants