microsoft / python-environment-tools

MIT License
76 stars 4 forks source link

Unknown Python Environment in codespace/devcontainer #53

Open rebornix opened 1 week ago

rebornix commented 1 week ago

Testing microsoft/vscode-python#23675

2024-06-25 17:30:42.202 [info] Started Refreshing Environments
2024-06-25 17:30:42.202 [error] Invalid state, ex ("/usr/local/python/current/bin/python3") is not in any of /bin, /usr/bin, /usr/local/bin
2024-06-25 17:30:42.217 [warning] Unknown Env ("/usr/local/python/current/bin/python3") in Path resolved as ResolvedPythonEnv { executable: "/usr/local/python/current/bin/python3", prefix: "/usr/local/python/current", version: "3.10.13.final.0", is64_bit: true, symlink: None } and reported as Unknown
2024-06-25 17:30:42.220 [info] Discovered env: /usr/local/python/current/bin/python3
2024-06-25 17:30:42.358 [warning] Unknown Env ("/home/codespace/.python/current/bin/python3") in Path resolved as ResolvedPythonEnv { executable: "/home/codespace/.python/current/bin/python3", prefix: "/home/codespace/.python/current", version: "3.10.13.final.0", is64_bit: true, symlink: None } and reported as Unknown
2024-06-25 17:30:42.364 [info] Discovered env: /home/codespace/.python/current/bin/python3
2024-06-25 17:30:42.381 [error] Unable to find Conda Manager for the Conda env: CondaEnvironment { prefix: "/opt/conda", executable: Some("/opt/conda/bin/python"), version: Some("3.12.3"), conda_dir: None, arch: Some(X64) }
2024-06-25 17:30:42.382 [error] Unable to find Conda Manager for env: CondaEnvironment { prefix: "/opt/conda", executable: Some("/opt/conda/bin/python"), version: Some("3.12.3"), conda_dir: None, arch: Some(X64) }
2024-06-25 17:30:42.386 [error] Invalid state, ex ("/usr/local/python/current/bin/python") is not in any of /bin, /usr/bin, /usr/local/bin
2024-06-25 17:30:42.388 [warning] Unknown Env ("/usr/local/python/current/bin/python") in Path resolved as ResolvedPythonEnv { executable: "/usr/local/python/current/bin/python", prefix: "/usr/local/python/3.10.13", version: "3.10.13.final.0", is64_bit: true, symlink: None } and reported as Unknown
2024-06-25 17:30:42.388 [info] Discovered env: /usr/local/python/current/bin/python
2024-06-25 17:30:42.808 [info] Discovered env: /opt/conda/bin/python
2024-06-25 17:30:42.824 [error] Invalid state, ex ("/home/codespace/.python/current/bin/python") is not in any of /bin, /usr/bin, /usr/local/bin
2024-06-25 17:30:42.826 [warning] Unknown Env ("/home/codespace/.python/current/bin/python") in Path resolved as ResolvedPythonEnv { executable: "/home/codespace/.python/current/bin/python", prefix: "/usr/local/python/3.10.13", version: "3.10.13.final.0", is64_bit: true, symlink: None } and reported as Unknown
2024-06-25 17:30:42.827 [info] Discovered env: /home/codespace/.python/current/bin/python
2024-06-25 17:30:42.827 [error] Invalid state, ex ("/usr/local/python/current/bin/python3.10") is not in any of /bin, /usr/bin, /usr/local/bin
2024-06-25 17:30:42.828 [warning] Unknown Env ("/usr/local/python/current/bin/python3.10") in Path resolved as ResolvedPythonEnv { executable: "/usr/local/python/current/bin/python3.10", prefix: "/usr/local/python/current", version: "3.10.13.final.0", is64_bit: true, symlink: None } and reported as Unknown
2024-06-25 17:30:42.828 [info] Discovered env: /usr/local/python/current/bin/python3.10
2024-06-25 17:30:42.828 [warning] Unknown Env ("/home/codespace/.python/current/bin/python3.10") in Path resolved as ResolvedPythonEnv { executable: "/home/codespace/.python/current/bin/python3.10", prefix: "/home/codespace/.python/current", version: "3.10.13.final.0", is64_bit: true, symlink: None } and reported as Unknown
2024-06-25 17:30:42.828 [info] Discovered env: /home/codespace/.python/current/bin/python3.10
2024-06-25 17:30:42.829 [info] Discovered env: /bin/python3
2024-06-25 17:30:42.829 [info] Locator VirtualEnvWrapper took 7.474µs
2024-06-25 17:30:42.830 [info] Locator LinuxGlobalPython took 340ns
2024-06-25 17:30:42.830 [info] Locator VirtualEnv took 271ns
2024-06-25 17:30:42.830 [info] Locator PipEnv took 160ns
2024-06-25 17:30:42.830 [info] Locator PyEnv took 1.479827ms
2024-06-25 17:30:42.830 [info] Locator Conda took 100.675839ms
2024-06-25 17:30:42.831 [info] Locator Venv took 150ns
2024-06-25 17:30:42.831 [info] Locator Poetry took 3.905787ms
2024-06-25 17:30:42.831 [info] Locator Homebrew took 832.338µs
2024-06-25 17:30:42.831 [info] Environments found using locators in 102.61904ms
2024-06-25 17:30:42.831 [info] Environments in PATH found in 590.153623ms
2024-06-25 17:30:42.831 [info] Environments in global virtual env paths found in 481.598µs
2024-06-25 17:30:43.241 [info] Environments in custom search paths found in 4.646347ms
2024-06-25 17:30:43.249 [info] Refresh completed in 590ms
2024-06-25 17:31:27.877 [info] Unknown Python Environment category 'global-paths' from Native Locator.
2024-06-25 17:31:27.880 [info] Unknown Python Environment category 'linux-global' from Native Locator.

what I got from the legacy locator

image
Yoyokrazy commented 1 week ago

From WSL:

image

2024-06-25 10:45:32.156 [info] Starting Python Locator /home/milively/.vscode-server-insiders/extensions/ms-python.python-2024.9.2024062506-linux-x64/python-env-tools/bin/pet server
2024-06-25 10:45:32.156 [info] Started Refreshing Environments
2024-06-25 10:45:32.167 [info] Discovered env: /bin/python3
2024-06-25 10:45:32.235 [info] Locator Conda took 236.514147ms
2024-06-25 10:45:32.240 [info] Locator Venv took 1.155µs
2024-06-25 10:45:32.249 [info] Locator VirtualEnv took 27.768µs
2024-06-25 10:45:32.250 [info] Locator LinuxGlobalPython took 1.71µs
2024-06-25 10:45:32.251 [info] Locator PipEnv took 10.325µs
2024-06-25 10:45:32.251 [info] Locator VirtualEnvWrapper took 999ns
2024-06-25 10:45:32.252 [info] Locator Homebrew took 13.048232ms
2024-06-25 10:45:32.252 [info] Locator PyEnv took 361.67816ms
2024-06-25 10:45:32.253 [info] Locator Poetry took 342.617128ms
2024-06-25 10:45:32.254 [info] Environments found using locators in 362.14889ms
2024-06-25 10:45:32.254 [info] Environments in PATH found in 2.024988348s
2024-06-25 10:45:32.254 [info] Environments in global virtual env paths found in 4.323241ms
2024-06-25 10:45:32.257 [info] Environments in custom search paths found in 48.099382ms
2024-06-25 10:45:32.258 [info] Refresh completed in 2028ms
DonJayamanne commented 1 week ago

~in the case of @Yoyokrazy Python extension today is displaying /bin/python3 and /usr/bin/python3, however they are the same. Thats why the new locator will only list one of them. @karthiknadig /cc (in fact the above is documented on a few websites as well, the only one that is specific to the user is /usr/local/bin/python3).~

Will update code to not collapse them into one, I think that will be confusing, also makes it easier to reason in telemetry and the like. I.e. will ensure both are listed.

DonJayamanne commented 1 week ago

@karthiknadig @rebornix The only issue here is that Native Locator is reporting them as unknown I'll need to have a look and see how and why the TS is reporting them as Global and update Native Locator accordingly. Its probably in path.

DonJayamanne commented 1 week ago

Couple of issues here

DonJayamanne commented 1 week ago

@Yoyokrazy @rebornix Please can you test again with the latest Python pre-release Please run and share the output once again.

Yoyokrazy commented 1 week ago

re-testing with WSL & latest pre-release:

2024-06-26 14:14:11.576 [info] Starting Python Locator /home/milively/.vscode-server-insiders/extensions/ms-python.python-2024.9.2024062602-linux-x64/python-env-tools/bin/pet server
2024-06-26 14:14:14.787 [info] Started Refreshing Environments
2024-06-26 14:14:15.217 [info] Discovered env: /usr/bin/python3
2024-06-26 14:14:15.318 [info] Discovered env: /bin/python3
2024-06-26 14:14:15.727 [info] Locator Conda took 361.890217ms
2024-06-26 14:14:15.728 [info] Locator Homebrew took 497.501µs
2024-06-26 14:14:15.734 [info] Locator LinuxGlobalPython took 336.530646ms
2024-06-26 14:14:15.743 [info] Locator PipEnv took 887ns
2024-06-26 14:14:15.749 [info] Locator Poetry took 377.919477ms
2024-06-26 14:14:15.752 [info] Locator PyEnv took 363.993851ms
2024-06-26 14:14:15.754 [info] Locator Venv took 1.009µs
2024-06-26 14:14:15.759 [info] Locator VirtualEnv took 982ns
2024-06-26 14:14:15.761 [info] Locator VirtualEnvWrapper took 891ns
2024-06-26 14:14:15.768 [info] Environments found using locators in 381.063782ms
2024-06-26 14:14:15.770 [info] Environments in PATH found in 2.340880629s
2024-06-26 14:14:15.775 [info] Environments in global virtual env paths found in 1.391656ms
2024-06-26 14:14:15.776 [info] Environments in custom search paths found in 65.778666ms
2024-06-26 14:14:15.781 [info] Refresh completed in 2341ms

image

Looks good on my end! @DonJayamanne