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

hatch is not discovered in shell or default Python (OS=Windows) #23819

Closed
arlowhite opened this issue Jul 16, 2024 · 4 comments
Closed

hatch is not discovered in shell or default Python (OS=Windows) #23819

arlowhite opened this issue Jul 16, 2024 · 4 comments
Assignees
Labels
info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@arlowhite
Copy link

arlowhite commented Jul 16, 2024

Type: Bug

Behaviour

On Windows, VSCode only finds hatch when it's installed with the hatch installer https://hatch.pypa.io/1.12/install/#gui-installer_1
This could be a barrier as it requires admin privileges.

Other methods of installing hatch are not discovered by VSCode and prevent VSCode from suggesting Hatch environments.
https://code.visualstudio.com/updates/v1_88#_hatch-environment-discovery

Steps to reproduce:

  1. pip install --user hatch
    hatch should work in PowerShell.
    if not, user may need to code $profile and add:
$env:PATH += ";C:\Users\MYUSER\AppData\Roaming\Python\Python312\Scripts"

I would expect VSCode to use hatch installations in this order

  1. hatch in PowerShell PATH
  2. hatch in the default Python installation

Alternatively, there should be Setting to specify path to hatch. Currently, search Settings for "hatch" shows nothing.


Extension version: 2024.10.0
VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:06:49.809Z)
OS version: Windows_NT x64 10.0.19045
Modes:

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


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
Dev Containers ms-vscode-remote.remote-containers 0.375.1
Docker ms-azuretools.vscode-docker 1.29.1
Emacs Friendly Keymap lfs.vscode-emacs-friendly 0.9.0
Even Better TOML tamasfe.even-better-toml 0.19.2
GitHub Actions github.vscode-github-actions 0.26.3
GitLens — Git supercharged eamodio.gitlens 15.2.0
JavaScript Debugger ms-vscode.js-debug 1.91.0
JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.2
Julia julialang.language-julia 1.83.2
Jupyter ms-toolsai.jupyter 2024.6.0
Jupyter Cell Tags ms-toolsai.vscode-jupyter-cell-tags 0.1.9
Jupyter Keymap ms-toolsai.jupyter-keymap 1.1.2
Jupyter Notebook Renderers ms-toolsai.jupyter-renderers 1.0.18
Jupyter Slide Show ms-toolsai.vscode-jupyter-slideshow 0.1.6
Pylance ms-python.vscode-pylance 2024.7.1
Python ms-python.python 2024.10.0
Python Debugger ms-python.debugpy 2024.8.0
Rainbow CSV mechatroner.rainbow-csv 3.12.0
Remote - SSH ms-vscode-remote.remote-ssh 0.112.0
Remote - SSH: Editing Configuration Files ms-vscode-remote.remote-ssh-edit 0.86.0
Remote Explorer ms-vscode.remote-explorer 0.4.3
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.9
Test Adapter Converter ms-vscode.test-adapter-converter 0.1.9
WSL ms-vscode-remote.remote-wsl 0.88.2
XML redhat.vscode-xml 0.27.1
System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i7-1355U (12 x 2611)
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
Load (avg) undefined
Memory (System) 31.66GB (16.51GB free)
Process Argv --folder-uri file:///c%3A/Users/awhite/code/sbe_ctd_proc --crash-reporter-id 98aa3f3e-a8ba-4853-a376-6bdbbfabe6df
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
chatpanelt:31048053
dsvsc021:30996838
f3je6385:31013174
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
impr_priority:31094925
4930e709:31092288

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jul 16, 2024
@arlowhite arlowhite changed the title hatch is not discovered from shell or default Python hatch is not discovered in shell or default Python Jul 16, 2024
@arlowhite arlowhite changed the title hatch is not discovered in shell or default Python hatch is not discovered in shell or default Python (OS=Windows) Jul 16, 2024
@karthiknadig karthiknadig self-assigned this Jul 16, 2024
@karthiknadig
Copy link
Member

/cc @ofek @flying-sheep Would you be able to take a look at this since this is hatch related?

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jul 17, 2024
@flying-sheep
Copy link

Your shell’s environment differs from the environment GUI applications are started in.

To expand on that: VS Code doesn’t run in Powershell, it runs straight from the GUI, so adding to your $env:PATH in your Powershell profile doesn’t affect VS Code.

You need to have Hatch in a path seen by GUI software directly, e.g. by using the system settings or installing Hatch with a GUI installer (I think that works, but I didn‘t test it since I don’t have access to a windows system)

Copy link

Hey @karthiknadig, this issue might need further attention.

@arlowhite, you can help us out by closing this issue if the problem no longer exists, or adding more information.

@karthiknadig
Copy link
Member

An alternate option is to open power shell first, add hatch to PATH, then launch code from that powershell terminal use VS Code CLI code ..

@karthiknadig karthiknadig closed this as not planned Won't fix, can't repro, duplicate, stale Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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

3 participants