python / python/cpython

venv can't figure out that it's isolated

未關閉
#127,025 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

topic-venv type-bug
主要語言
Python
星號
77.2k
分支
36k
PR 合併指標
PR 指標待擷取

描述

Bug report

Bug description:

I installed python3.13 on my Macbook Pro M1 using Homebrew.

I create venv, activate it and trying to install package. But I'm getting this error:
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

I figured out that I can force pip to think that it's isolated. I just added following line in venv/bin/pip3:

#...
if __name__ == '__main__':
    sys.argv.append("--isolated") # i added this line

It worked.

I don't know exactly where is problem: in pip or in venv. But in latest pip version there is the same error, so maybe it's not pip, idk. Or maybe I did something wrong, or maybe homebrew package is broken, idk.

As I remember, in python3.12 that I also installed using Homebrew there was no such error, everything worked out of box perfectly.

CPython versions tested on:

3.13

Operating systems tested on:

macOS

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

使用虛擬環境和套件安裝,重現已回報的 macOS Homebrew Python 3.13 設定,然後檢查產生的 venv/bin/pip3 進入點,以及 --user 與 --isolated 之間的互動。判定此行為屬於 venv 還是 pip;當負責的元件已識別,且回歸或預期行為已由適當的測試涵蓋時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
tooling
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。