Skip to content

macOS venv creation via copy fails #707

Closed as not planned
Closed as not planned

Description

@gaborbernat
❯ python3.13 -m venv --copies venv --clear
Error: Command '['/Users/bgabor8/git/github/virtualenv/venv/bin/python3.13', '-m', 'ensurepip', '--upgrade', '--default-pip']' died with <Signals.SIGABRT: 6>.

❯ venv/bin/python 
dyld[94922]: Library not loaded: @executable_path/../lib/libpython3.13.dylib
  Referenced from: <4C4C4407-5555-3144-A1FE-AA5FDFE2B24E> /Users/bgabor8/git/github/virtualenv/venv/bin/python
  Reason: tried: '/Users/bgabor8/git/github/virtualenv/venv/lib/libpython3.13.dylib' (no such file)
fish: Job 1, 'venv/bin/python' terminated by signal SIGABRT (Abort)

Only happens on macOS, not Linux and Windows. Works when using symlink mode, unclear if related to #381

(This breaks the virtualenv test suite at https://github.com/pypa/virtualenv/actions/runs/16404089042/job/46347551787?pr=2904)

Activity

  1. geofft commented on Jul 23, 2025

    @geofft
    Collaborator

    I think this is indeed the same as #381, we're currently linking libpython statically on Linux but not macOS (#636).

    But I think this is genuinely a bug in virtualenv and venv: if run against an interpreter that dynamically links libpython, --copies needs to copy libpython, or run patchelf/install_name_tool or equivalent, or not exist. Note that Apple chose the last option for their builds of Python.

  2. gaborbernat commented on Sep 23, 2026

    @gaborbernat
    Author

    Closing, as the fix belongs in virtualenv and venv rather than here. Thanks for tracking it down.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions