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

venv creation fails on network share #2578

Open
Tikkoneus opened this issue May 24, 2023 · 1 comment
Open

venv creation fails on network share #2578

Tikkoneus opened this issue May 24, 2023 · 1 comment

Comments

@Tikkoneus
Copy link

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
@TheRealBillSiegler
Copy link

TheRealBillSiegler commented Jan 3, 2024

I also encountered this issue; however, I found it only hanging because it was still writing to the network. Eventually, the process terminates, and the command line is restored. While I am used to this process happening within a second, it takes much longer to write to the network share. In the end, the error was displayed due to my Ctrl-C.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@gaborbernat @Tikkoneus @TheRealBillSiegler and others