GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — venv does not respect `PYTHONDONTWRITEBYTECODE` setting · Issue #98251 · python/cpython

venv does not respect PYTHONDONTWRITEBYTECODE setting #98251

New issue
Copy link
New issue
Copy link
Closed
Closed
venv does not respect PYTHONDONTWRITEBYTECODE setting#98251
Copy link
Assignees
zooba
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@zooba
zooba
opened on Oct 13, 2022
Issue body actions

When we invoke pip, we use -I to avoid interference from other variables. However, this also means that we ignore legitimate user preferences that ought to be retained. We probably want PYTHONDONTWRITEBYTECODE, PYTHONUTF8, PYTHONIOENCODING, PYTHONMALLOC, PYTHONCOERCECLOCALE, PYTHONPYCACHEPREFIX at least, and maybe more (I just went through the help output of 3.10).

Interestingly, we don't use isolated mode later on when we upgrade the packages, so maybe we don't need it at all? Or perhaps we should be in some middle ground where we override PYTHONPATH and PYTHONHOME to point at the venv/be empty but leave everything else in place?

Ping @vsajip

(Discovered in a system where attempting to write .pyc files would break.)

Activity

  1. zooba
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    3.11only security fixesonly security fixes
    3.10 (EOL)end of lifeend of life
    3.12only security fixesonly security fixes
    on Oct 13, 2022
  2. vsajip commented on Oct 14, 2022

    @vsajip
    vsajip
    on Oct 14, 2022
    Member
    More actions

    so maybe we don't need it [python -I] at all?

    Perhaps not - IIUC the python -Im ensurepip was added by @ncoghlan originally, and I don't know what the logic was for the decision to use -I. From my perspective, a venv should only change the active sys.path (so overriding PYTHONHOME and PYTHONPATH seems necessary) but I can't see any reason not to respect the other PYTHON* environment variables.

    Reacted by Steve Dower
  3. zooba
    self-assigned this
    on Oct 14, 2022
  4. zooba
    added 2 commits that reference this issue on Oct 14, 2022

    pythongh-98251: Allow venv to pass along PYTHON* variables to pip whe…

    9b77c39

    gh-98251: Allow venv to pass along PYTHON* variables to pip and ensur…

    2fe44f7
  5. miss-islington
    added 2 commits that reference this issue on Oct 14, 2022

    pythongh-98251: Allow venv to pass along PYTHON* variables to pip and…

    009b8c4

    pythongh-98251: Allow venv to pass along PYTHON* variables to pip and…

    63a6905
  6. zooba
    closed this as completedon Oct 14, 2022
  7. miss-islington
    added 2 commits that reference this issue on Oct 14, 2022

    gh-98251: Allow venv to pass along PYTHON* variables to pip and ensur…

    c9da063

    gh-98251: Allow venv to pass along PYTHON* variables to pip and ensur…

    22ad9e5
  8. carljm
    added 2 commits that reference this issue on Oct 14, 2022

    Merge branch 'main' into typewatch

    6e53514

    Merge branch 'main' into cached_property

    0bb0c69
  9. zackw
    added 2 commits that reference this issue on Oct 15, 2024

    various fixes

    cc75a03

    backport the fix for python/cpython#98251 _correctly_

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

Metadata

Metadata

Assignees

  • @zooba
    zooba

Labels

3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixestype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.