[Bug 1962791] Re: python3 -m venv installs pip to incorrect path VENV_ROOT/local/bin/pip

Dan Halbert 1962791 at bugs.launchpad.net
Fri Mar 11 04:37:45 UTC 2022


For anyone looking for a workaround, thanks to andersk above. I edited
/usr/lib/python3.10/sysconfig.py per this diff:

usr/lib/python3.10$ diff -p sysconfig.py~ sysconfig.py
*** sysconfig.py~	2022-02-26 03:21:15.000000000 -0500
--- sysconfig.py	2022-03-10 21:09:02.572726493 -0500
*************** def _get_preferred_schemes():
*** 262,268 ****
              'user': 'osx_framework_user',
          }
  
!     if 'real_prefix' in sys.__dict__ or 'VIRTUAL_ENV' in os.environ:
          # virtual environments
          prefix_scheme = 'posix_prefix'
      else:
--- 262,270 ----
              'user': 'osx_framework_user',
          }
  
!     # https://bugs.launchpad.net/ubuntu/+source/python3.10/+bug/1962791/comments/4
!     if sys.base_prefix != sys.prefix:
!     #if 'real_prefix' in sys.__dict__ or 'VIRTUAL_ENV' in os.environ:
          # virtual environments
          prefix_scheme = 'posix_prefix'
      else:

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python3.10 in Ubuntu.
https://bugs.launchpad.net/bugs/1962791

Title:
  python3 -m venv installs pip to incorrect path VENV_ROOT/local/bin/pip

Status in python3.10 package in Ubuntu:
  Confirmed
Status in python3.10 package in Debian:
  New

Bug description:
  python3 -m venv worked correctly in Ubuntu 21.10:

  # apt update; apt install python3.10-venv
  # python3.10 -m venv /tmp/my-venv
  # . /tmp/my-venv/bin/activate
  # type pip
  pip is /tmp/my-venv/bin/pip
  # pip --version
  pip 20.3.4 from /tmp/my-venv/lib/python3.10/site-packages/pip (python 3.10)

  But in Ubuntu 22.04, it installs pip to the wrong path:

  # apt update; apt install python3.10-venv
  # python3.10 -m venv /tmp/my-venv
  # . /tmp/my-venv/bin/activate
  # type pip
  bash: type: pip: not found
  # pip --version
  bash: pip: command not found
  # echo $PATH
  /tmp/my-venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  # ls /tmp/my-venv/bin
  Activate.ps1  activate.csh   python   python3.10
  activate      activate.fish  python3
  # ls /tmp/my-venv/local/bin
  pip  pip3  pip3.10

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3.10/+bug/1962791/+subscriptions




More information about the foundations-bugs mailing list