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

Python: Create Environment resulted in an error #21882

Closed
aeschli opened this issue Aug 29, 2023 · 3 comments
Closed

Python: Create Environment resulted in an error #21882

aeschli opened this issue Aug 29, 2023 · 3 comments
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@aeschli
Copy link

aeschli commented Aug 29, 2023

Testing #21878

Python extension v2023.15.12411005
Version: 1.82.0-insider
Commit: ebd67244fb2da33ab078bb2baa96106fda29f336
Date: 2023-08-29T05:32:43.083Z
Electron: 25.5.0
ElectronBuildId: 23084831
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 5.14.0-1048-oem

  • create a new folder with a hellp.py file
  • on the command line in that folder create a virtual environment with python3 -m venv .venv
  • open the hello.py file in VS Code
  • click on the Python version picker in status bar and select .venv/bin/python
  • Run Python: Create environment, pick Venv and Recreate
  • Select Python 2.7

Image

Image

Note that this shows a modal dialog as well as a notification

2023-08-29 15:20:49.391 [info] Selected interpreter /bin/python for creating virtual environment.
2023-08-29 15:20:49.513 [info] Deleted venv dir: /home/aeschli/workspaces/testing/test-python/.venv
2023-08-29 15:20:49.531 [info] Running Env creation script:  [
  '/bin/python',
  '/home/aeschli/.vscode-insiders/extensions/ms-python.python-2023.15.12411005/pythonFiles/create_venv.py',
  '--git-ignore'
]
2023-08-29 15:20:49.542 [info]   File "/home/aeschli/.vscode-insiders/extensions/ms-python.python-2023.15.12411005/pythonFiles/create_venv.py", line 22
    def parse_args(argv: Sequence[str]) -> argparse.Namespace:
                       ^
SyntaxError: invalid syntax

2023-08-29 15:20:49.544 [error] Error while running venv creation script:  undefined
2023-08-29 15:20:49.545 [error] undefined

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Aug 29, 2023
@aeschli
Copy link
Author

aeschli commented Aug 29, 2023

Trying this again, but now switching from a 3.10 environment to a 3.8 env gives the following error:

2023-08-29 15:28:50.079 [info] Selected workspace /home/aeschli/workspaces/testing/test-python for creating virtual environment.
2023-08-29 15:28:51.828 [info] Selected interpreter /home/aeschli/workspaces/testing/test-python/.venv/bin/python for creating virtual environment.
2023-08-29 15:28:56.612 [info] Selected workspace /home/aeschli/workspaces/testing/test-python for creating virtual environment.
2023-08-29 15:29:01.230 [info] Selected interpreter /bin/python3.8 for creating virtual environment.
2023-08-29 15:29:01.362 [info] Deleted venv dir: /home/aeschli/workspaces/testing/test-python/.venv
2023-08-29 15:29:01.383 [info] Running Env creation script:  [
  '/bin/python3.8',
  '/home/aeschli/.vscode-insiders/extensions/ms-python.python-2023.15.12411005/pythonFiles/create_venv.py',
  '--git-ignore'
]
2023-08-29 15:29:01.471 [info] Running: /bin/python3.8 -m venv --without-pip .venv

2023-08-29 15:29:01.532 [info] CREATED_VENV:/home/aeschli/workspaces/testing/test-python/.venv/bin/python
Creating: /home/aeschli/workspaces/testing/test-python/.venv/.gitignore

2023-08-29 15:29:01.534 [info] CREATE_VENV.DOWNLOADING_PIP

2023-08-29 15:29:01.921 [info] CREATE_VENV.INSTALLING_PIP
Running: /home/aeschli/workspaces/testing/test-python/.venv/bin/python /home/aeschli/workspaces/testing/test-python/.venv/pip.pyz install pip

2023-08-29 15:29:02.685 [info] Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main

2023-08-29 15:29:02.686 [info]     return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/aeschli/workspaces/testing/test-python/.venv/pip.pyz/__main__.py", line 26, in <module>
  File "/usr/lib/python3.8/runpy.py", line 210, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/aeschli/workspaces/testing/test-python/.venv/pip.pyz/pip/__main__.py", line 22, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/home/aeschli/workspaces/testing/test-python/.venv/pip.pyz/pip/_internal/cli/main.py", line 10, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/home/aeschli/workspaces/testing/test-python/.venv/pip.pyz/pip/_internal/cli/autocompletion.py", line 10, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/home/aeschli/workspaces/testing/test-python/.venv/pip.pyz/pip/_internal/cli/main_parser.py", line 9, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/home/aeschli/workspaces/testing/test-python/.venv/pip.pyz/pip/_internal/build_env.py", line 19, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/home/aeschli/workspaces/testing/test-python/.venv/pip.pyz/pip/_internal/cli/spinners.py", line 9, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/home/aeschli/workspaces/testing/test-python/.venv/pip.pyz/pip/_internal/utils/logging.py", line 29, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/home/aeschli/workspaces/testing/test-python/.venv/pip.pyz/pip/_internal/utils/misc.py", line 41, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/home/aeschli/workspaces/testing/test-python/.venv/pip.pyz/pip/_internal/locations/__init__.py", line 66, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/home/aeschli/workspaces/testing/test-python/.venv/pip.pyz/pip/_internal/locations/_distutils.py", line 20, in <module>
ModuleNotFoundError: No module named 'distutils.cmd'

2023-08-29 15:29:02.724 [info] Traceback (most recent call last):
  File "/home/aeschli/.vscode-insiders/extensions/ms-python.python-2023.15.12411005/pythonFiles/create_venv.py", line 77, in run_process

2023-08-29 15:29:02.724 [info]     subprocess.run(args, cwd=os.getcwd(), check=True)
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,

2023-08-29 15:29:02.725 [info] subprocess.CalledProcessError: Command '['/home/aeschli/workspaces/testing/test-python/.venv/bin/python', '/home/aeschli/workspaces/testing/test-python/.venv/pip.pyz', 'install', 'pip']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/aeschli/.vscode-insiders/extensions/ms-python.python-2023.15.12411005/pythonFiles/create_venv.py", line 232, in <module>
    main(sys.argv[1:])
  File "/home/aeschli/.vscode-insiders/extensions/ms-python.python-2023.15.12411005/pythonFiles/create_venv.py", line 220, in main

2023-08-29 15:29:02.727 [info]     install_pip(args.name)
  File "/home/aeschli/.vscode-insiders/extensions/ms-python.python-2023.15.12411005/pythonFiles/create_venv.py", line 149, in install_pip
    run_process(
  File "/home/aeschli/.vscode-insiders/extensions/ms-python.python-2023.15.12411005/pythonFiles/create_venv.py", line 79, in run_process
    raise VenvError(error_message)
__main__.VenvError: CREATE_VENV.INSTALL_PIP_FAILED

2023-08-29 15:29:02.746 [error] Error while running venv creation script:  CREATE_VENV.INSTALL_PIP_FAILED
2023-08-29 15:29:02.747 [error] CREATE_VENV.INSTALL_PIP_FAILED

@karthiknadig
Copy link
Member

The first error is due to you using python 2.7 which is not supported.
The second one happens if your distribution of linux does not ship with distutils.

Both are not supported scenarios. But I will investigate the two errors.

@karthiknadig
Copy link
Member

Filed pypa/pip#12249 on pip for this issue.

Created #21889 to investigate the modal/notification problem.

@karthiknadig karthiknadig closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants