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

Manually deleted /.venv/ path in project folder breaks startup permanently without providing a guide #24600

Open
thadguidry opened this issue Dec 13, 2024 · 0 comments
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@thadguidry
Copy link

thadguidry commented Dec 13, 2024

Type: Bug

  1. I previously had a .venv folder that was made in the root of my project.
  2. I deleted that .venv folder from my project root, after realizing that I needed to use the real Python local environment in my particular case for concurrency testing of a project (which needed native libs and local environment for concurrency performance testing with locust and psycopg).
  3. After deleting the .venv folder, I now get an error starting the extension I think whenever I open the project and click on a .py file:

Sorry, something went wrong activating IntelliCode support for Python. Please check the "Python" and "VS IntelliCode" output windows for details.


and when inspecting the Python output window as requested, I can see the following error:

2024-12-14 08:24:55.669 [info] Experiment 'pythonaacf' is active
2024-12-14 08:24:55.669 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-12-14 08:24:55.669 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-12-14 08:24:55.669 [info] Experiment 'pythonTestAdapter' is active
2024-12-14 08:24:55.669 [info] Native locator: Refresh started
2024-12-14 08:24:55.669 [info] Native locator: Refresh started
2024-12-14 08:24:55.669 [info] > pyenv which python
2024-12-14 08:24:55.669 [info] cwd: .
2024-12-14 08:24:56.185 [info] Native locator: Refresh finished in 1131 ms
2024-12-14 08:24:56.190 [error] [
  'getActivatedEnvironmentVariables, Class name = M, completed in 120ms, has a falsy return value, Arg 1: <Uri:f:\\GitHubRepos\\various-text-projects>, Arg 2: undefined, Arg 3: undefined, Arg 4: "C:\\\\Program Files\\\\PowerShell\\\\7\\\\pwsh.exe"',
  [l [Error]: Failed to resolve env "f:\\GitHubRepos\\various-text-projects\\.venv\\Scripts\\python.exe"

Upon inspecting further this morning, I looked into my Code - Insiders/User/globalStorage/ms-python.python/pythonLocator folder and saw the latest JSON still having the setting for the \.venv\ folder that I had manually deleted:

{
  "environment": {
    "executable": "F:\\GitHubRepos\\various-text-projects\\.venv\\Scripts\\python.exe",
    "prefix": "F:\\GitHubRepos\\various-text-projects\\.venv",
    "version": "3.13.0.final.0",
    "is64Bit": true,
    "symlinks": [
      "F:\\GitHubRepos\\various-text-projects\\.venv\\Scripts\\python.exe"
    ]
  },
  "symlinks": [
    [
      "F:\\GitHubRepos\\various-text-projects\\.venv\\Scripts\\python.exe",
      {
        "secs_since_epoch": 1728268046,
        "nanos_since_epoch": 0
      },
      {
        "secs_since_epoch": 1734064003,
        "nanos_since_epoch": 347269600
      }
    ]
  ]
}

Expected Handling

Rather than having the "Reactivating Terminals..." notification stay in a busy loop, I would have expected that upon starting the extension, that I would get a WARNING notification that would say something like:


Could not find Python in the environment prefix F:\\GitHubRepos\\various-text-projects\\.venv. Perhaps the environment was relocated, or you have deleted it? Click to choose the new environment path where your Python executable is located to update your user/workspace setting.


It seems like there should be more done under

or perhaps earlier directly inside getActivatedEnvironmentVariables ?

I would not expect the Python extension to automatically change to PYTHONHOME if found, but it would be nice perhaps for it to offer that as a further suggestion:


Could not find Python in the environment prefix F:\\GitHubRepos\\various-text-projects\\.venv. Perhaps the environment was relocated, or you have deleted it? Click to choose the new environment path where Python executable is located or Choose to use existing PYTHONHOME that was found.


Extension version: 2024.23.2024121201
VS Code version: Code - Insiders 1.97.0-insider (b425f4802fcbcccb11ad991208fa262c06255be3, 2024-12-13T05:04:19.453Z)
OS version: Windows_NT x64 10.0.26100
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz (8 x 3600)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 63.93GB (48.00GB free)
Process Argv --crash-reporter-id 96284b49-7b08-4321-89ff-d2d541197ff3
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
vsaa593cf:30376535
py29gd2263:31024238
c4g48928:30535728
2i9eh265:30646982
962ge761:30841072
pythonnoceb:30776497
dsvsc014:30777825
dsvsc015:30821418
pythonmypyd1:30859725
h48ei257:31000450
pythontbext0:30879054
cppperfnew:30980852
pythonait:30973460
dvdeprecation:31040973
dwnewjupytercf:31046870
nativerepl1:31134653
pythonrstrctxt:31093868
nativeloc1:31118317
cf971741:31144450
e80f6927:31120813
iacca1:31150324
notype1:31143044
dwcopilot:31158714
h409b430:31177054
cf1a2727:31183122
5b1c1929:31184661

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Dec 13, 2024
@thadguidry thadguidry changed the title [error] sendStartupTelemetry() failed. [Error]: Failed to resolve env .venv\\Scripts\\python.exe Manually deleted /.venv/ path in project folder breaks startup permanently without providing a guide Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

1 participant