Skip to content

gh-149879: Fix test_venv on Cygwin - #150426

Closed
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:venv_cygwin
Closed

vstinner wants to merge 1 commit into
python:mainfrom
vstinner:venv_cygwin

Conversation

@vstinner

@vstinner vstinner commented May 25, 2026 •

Copy link
Copy Markdown
Member

venv now uses symlinks by default on Cygwin.

Fix test_zippath_from_non_installed_posix(): copy also the cygpython DLL.

venv now uses symlinks by default on Cygwin.

Fix test_zippath_from_non_installed_posix(): copy also the cygpython
DLL.
@bedevere-app bedevere-app Bot mentioned this pull request May 25, 2026
@vstinner
vstinner marked this pull request as ready for review May 25, 2026 20:39
@vstinner
vstinner requested review from FFY00 and vsajip as code owners May 25, 2026 20:39
@vstinner

Copy link
Copy Markdown
Member Author

@vsajip @FFY00: Are you ok with this change? It uses symlinks by default on Cygwin when using the Python API (venv module). The python -m venv command line interface already uses symlinks by default on Unix:

    if os.name == 'nt':
        use_symlinks = False
    else:
        use_symlinks = True
    group = parser.add_mutually_exclusive_group()
    group.add_argument('--symlinks', default=use_symlinks,
                       action='store_true', dest='symlinks',
                       help='Try to use symlinks rather than copies, '
                            'when symlinks are not the default for '
                            'the platform.')
@vstinner

Copy link
Copy Markdown
Member Author

venv created with --copies doesn't work on Cygwin:

vstinner@win ~/cpython
$ ./python.exe -m venv ../env --without-pip --copies

vstinner@win ~/cpython
$ cd ../

vstinner@win ~
$ env/bin/python.exe -V
C:/cygwin64/home/vstinner/env/bin/python.exe: error while loading shared libraries: cygpython3.16d.dll: cannot open shared object file: No such file or directory

venv created with symlinks just works well:

vstinner@win ~/cpython
$ ./python.exe -m venv ../env --without-pip

vstinner@win ~/cpython
$ cd ..

vstinner@win ~
$ env/bin/python.exe -V
Python 3.16.0a0
@vstinner

Copy link
Copy Markdown
Member Author

With this change, venv cannot be used in copy mode: running the venv python programs fails to locate the libpython DLL.

I wrote a different approach, copy the libpython DLL in the venv: PR gh-150483.

@vstinner vstinner closed this May 26, 2026
@vstinner
vstinner deleted the venv_cygwin branch July 10, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant