question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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® Core™ 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® Core™ 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® Core™ 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

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
RoadToDreamcommented, May 3, 2022

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.

1reaction
RoadToDreamcommented, Apr 5, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python can't find packages in Virtual Environment
venv \Scripts\Python executable. I've seen this strange behaviour where even after the environment is activated using the activate.bat file in ...
Read more >
User Guide — virtualenv 16.7.11 documentation
ENV/lib/ and ENV/include/ are created, containing supporting library files for a new virtualenv python. · ENV/bin is created, where executables ...
Read more >
Virtual environments for absolute beginners — what is it and ...
Install virtualenv package using pip: We simply install it by calling pip install virtualenv · Virtualenv is correctly install if you can execute...
Read more >
Why Can't Python Find My Modules? - Real Python
The problem is that it's very common to have multiple Python interpreters installed (and by extension, multiple pip executables.) Depending on ...
Read more >
Pipenv & Virtual Environments
While pip can install Python packages, Pipenv is recommended as it's a ... Now that Requests is installed you can create a simple...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found