Skip to content

venv creation fails on network share #2578

Open
@Tikkoneus

Description

@Tikkoneus

Issue

venv fails when run on a mounted drive (Windows host / SMB file share)

Environment

Provide at least:

  • OS: Windows (tested on Win10 and Win11, same behavior)
  • Python: 3.11.3
  • pip list of the host python where virtualenv is installed:
python -m pip list
Package      Version
------------ -------
distlib      0.3.6
filelock     3.12.0
pip          22.3.1
platformdirs 3.5.1
setuptools   65.5.0
virtualenv   20.23.0

Output of the virtual environment creation

Make sure to run the creation with -vvv --with-traceback:

python -m venv venv
Actual environment location may have moved due to redirects, links or junctions.
  Requested location: "X:\path\to\venv\Scripts\python.exe"
  Actual location:    "\\fileshare\path\to\venv\Scripts\python.exe"

note: it hangs here forever until I press Ctrl-C, then:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Program Files\Python311\Lib\venv\__main__.py", line 6, in <module>
    main()
  File "C:\Program Files\Python311\Lib\venv\__init__.py", line 546, in main
    builder.create(d)
  File "C:\Program Files\Python311\Lib\venv\__init__.py", line 76, in create
    self._setup_pip(context)
  File "C:\Program Files\Python311\Lib\venv\__init__.py", line 358, in _setup_pip
    self._call_new_python(context, '-m', 'ensurepip', '--upgrade',
  File "C:\Program Files\Python311\Lib\venv\__init__.py", line 354, in _call_new_python
    subprocess.check_output(args, **kwargs)
  File "C:\Program Files\Python311\Lib\subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\subprocess.py", line 550, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\subprocess.py", line 1194, in communicate
    stdout = self.stdout.read()
             ^^^^^^^^^^^^^^^^^^

also note

python -m venv venv -vvv --with-traceback
usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear] [--upgrade] [--without-pip]
            [--prompt PROMPT] [--upgrade-deps]
            ENV_DIR [ENV_DIR ...]
venv: error: unrecognized arguments: -vvv --with-traceback

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions