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

Create enviroment fails when there's a .venv file in the workspace #22842

Open
luabud opened this issue Feb 2, 2024 · 4 comments · Fixed by #22954
Open

Create enviroment fails when there's a .venv file in the workspace #22842

luabud opened this issue Feb 2, 2024 · 4 comments · Fixed by #22954
Assignees
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug needs PR Ready to be worked on

Comments

@luabud
Copy link
Member

luabud commented Feb 2, 2024

Type: Bug

Behaviour

Expected vs. Actual

When there's a .venv file in the workspace, the create environment command shows the option to either recreate or use the existing .venv in the workspace. However, it's just a file for fish support, and not an actual environment. Since we don't support naming, it fails to select or create a new environment.

Steps to reproduce:

  1. Clone https://github.com/thumbor/thumbor
  2. Run "Create environment" command

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.0
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
  • Value of the python.languageServer setting: Pylance
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

User Settings


venvFolders: "<placeholder>"

languageServer: "Pylance"

experiments
• optInto: ["pythonTestAdapter","regionCommentDiagnostics"]

Extension version: 2023.22.1
VS Code version: Code - Insiders 1.87.0-insider (2af613979f646fc4dcebfeaedc7d14f138c7b072, 2024-02-01T23:51:02.394Z)
OS version: Windows_NT x64 10.0.22621
Modes:

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 2995)
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.71GB (10.39GB free)
Process Argv --log trace --log ms-python.autopep8=debug --crash-reporter-id 11494669-52ca-4f2c-aa0e-29172189cc8e
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vsc_aa:30263845
vscod805:30301674
vsaa593:30376534
py29gd2263:30784851
c4g48928:30535728
2i9eh265:30646982
962ge761:30841072
pythongtdpath:30726887
welcomedialog:30812478
pythonidxpt:30768918
pythonnoceb:30776497
asynctok:30898717
dsvsc013:30777762
dsvsc014:30777825
dsvsc015:30821418
pythontestfixt:30866404
pythonregdiag2:30926734
pyreplss1:30879911
pythonmypyd1:30859725
pythoncet0:30859736
pythontbext0:30879054
accentitlementst:30870582
dsvsc016:30879898
dsvsc017:30880771
dsvsc018:30880772
8082a590:30953407
edj9j583:30943796
fegfb526:30952798
7j2b6412:30951517
bg6jg535:30946824

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 2, 2024
@karthiknadig karthiknadig self-assigned this Feb 5, 2024
@karthiknadig karthiknadig added the bug Issue identified by VS Code Team member as probable bug label Feb 5, 2024
@karthiknadig karthiknadig added this to the April 2024 milestone Apr 3, 2024
@karthiknadig karthiknadig added area-environments Features relating to handling interpreter environments needs PR Ready to be worked on author-verification-requested Issues potentially verifiable by issue author and removed triage-needed Needs assignment to the proper sub-team labels Apr 3, 2024
@rzhao271
Copy link

The command still fails for me

2024-04-24 14:29:22.772 [info] Running: C:\Users\raymondzhao\AppData\Local\Programs\Python\Python311\python.exe -m venv .venv
2024-04-24 14:29:22.986 [info] Error: Unable to create directory 'c:\\Users\\raymondzhao\\work\\endgame\\thumbor\\.venv'

@rzhao271 rzhao271 reopened this Apr 24, 2024
@rzhao271 rzhao271 added the verification-found Issue verification failed label Apr 24, 2024
@lramos15 lramos15 modified the milestones: April 2024, May 2024 Apr 26, 2024
@karthiknadig karthiknadig modified the milestones: May 2024, June 2024 May 24, 2024
@karthiknadig karthiknadig modified the milestones: June 2024, July 2024 Jun 20, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2024
@DonJayamanne
Copy link

DonJayamanne commented Jul 25, 2024

@karthiknadig Not sure how I marked this as completed.
Also it doesn't work for me, i.e. creating a venv with a .venv file still fails in latest pre-release


2024-07-25 11:50:08.636 [info] > /opt/homebrew/bin/python3 ~/.vscode-insiders/extensions/ms-python.python-2024.11.2024072402-darwin-arm64/python_files/create_venv.py --git-ignore
2024-07-25 11:50:08.636 [info] cwd: .
2024-07-25 11:50:09.400 [info] Running: /opt/homebrew/opt/python@3.12/bin/python3.12 -m venv .venv
2024-07-25 11:50:09.532 [info] Error: Unable to create directory '/Users/donjayamanne/demo/testlinks/.venv'
2024-07-25 11:50:09.538 [info] Traceback (most recent call last):
  File "/Users/donjayamanne/.vscode-insiders/extensions/ms-python.python-2024.11.2024072402-darwin-arm64/python_files/create_venv.py", line 92, in run_process
2024-07-25 11:50:09.538 [info]     subprocess.run(args, cwd=os.getcwd(), check=True)  # noqa: PTH109
2024-07-25 11:50:09.538 [info]     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 571, in run
2024-07-25 11:50:09.546 [info]     raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/opt/homebrew/opt/python@3.12/bin/python3.12', '-m', 'venv', '.venv']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
2024-07-25 11:50:09.546 [info]   File "/Users/donjayamanne/.vscode-insiders/extensions/ms-python.python-2024.11.2024072402-darwin-arm64/python_files/create_venv.py", line 254, in <module>
    main(sys.argv[1:])
  File "/Users/donjayamanne/.vscode-insiders/extensions/ms-python.python-2024.11.2024072402-darwin-arm64/python_files/create_venv.py", line 223, in main
2024-07-25 11:50:09.546 [info]     run_process(
  File "/Users/donjayamanne/.vscode-insiders/extensions/ms-python.python-2024.11.2024072402-darwin-arm64/python_files/create_venv.py", line 94, in run_process
2024-07-25 11:50:09.546 [info]     raise VenvError(error_message) from exc
VenvError
2024-07-25 11:50:09.546 [info] : CREATE_VENV.VENV_FAILED_CREATION
2024-07-25 11:50:09.554 [error] Error while running venv creation script:  CREATE_VENV.VENV_FAILED_CREATION
2024-07-25 11:50:09.554 [error] CREATE_VENV.VENV_FAILED_CREATION
2024-07-25 11:50:14.679 [info] Pylance extension is not installed.

@DonJayamanne DonJayamanne removed the author-verification-requested Issues potentially verifiable by issue author label Jul 25, 2024
@DonJayamanne DonJayamanne reopened this Jul 25, 2024
@DonJayamanne
Copy link

Also not sure why this is marked as me fixing tihs

Image

@karthiknadig
Copy link
Member

This doesn't work yet. We need a way to specifically handle that case.

@karthiknadig karthiknadig removed the verification-found Issue verification failed label Jul 25, 2024
@karthiknadig karthiknadig removed this from the July 2024 milestone Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug needs PR Ready to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants