Skip to content

Virtualenv created includes copy of python exectuable #2108

@yrro

Description

@yrro

Be sure to check the existing issues (both open and closed!).

The virtualev created by pipenv includes a copy of the python executable rather than a symlink. This means that I'll end up running out-of-date copies of the python interpreter, which will not include security updates; and since the virtualenv does include symlinks to the standard library, the two will diverge and I'll end up with an unsupported combination of old python interpreter and newer standard library.

$ python -m pipenv.help output

Pipenv version: '11.10.1'

Pipenv location: '/home/sam/.local/lib/python3.6/site-packages/pipenv'

Python location: '/usr/bin/python3'

Other Python installations in PATH:

  • 2.7: /usr/bin/python2.7

  • 2.7: /usr/bin/python2.7

  • 3.6: /usr/bin/python3.6m

  • 3.6: /usr/bin/python3.6

  • 2.7.15: /usr/bin/python

  • 2.7.15: /usr/bin/python2

  • 3.6.5: /usr/bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.6.5c1',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.15.0-3-amd64',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP Debian 4.15.17-1 (2018-04-19)',
 'python_full_version': '3.6.5rc1',
 'python_version': '3.6',
 'sys_platform': 'linux'}

System environment variables:

  • LS_COLORS
  • LESSCLOSE
  • XDG_MENU_PREFIX
  • LANG
  • GDM_LANG
  • MALLOC_PERTURB_
  • DISPLAY
  • EDITOR
  • COLORTERM
  • DESKTOP_AUTOSTART_ID
  • USERNAME
  • XDG_VTNR
  • SSH_AUTH_SOCK
  • S_COLORS
  • LESS_TERMCAP_so
  • LESS_TERMCAP_se
  • XDG_SESSION_ID
  • USER
  • DESKTOP_SESSION
  • GNOME_TERMINAL_SCREEN
  • PWD
  • HOME
  • SSH_AGENT_PID
  • QT_ACCESSIBILITY
  • XDG_SESSION_TYPE
  • https_proxy
  • XDG_DATA_DIRS
  • http_proxy
  • XDG_SESSION_DESKTOP
  • LESS_TERMCAP_mb
  • LESS_TERMCAP_md
  • LESS_TERMCAP_me
  • ENV_TEST_SAM
  • no_proxy
  • ANSIBLE_NOCOWS
  • GTK_MODULES
  • NO_PROXY
  • VISUAL
  • WINDOWPATH
  • TERM
  • SHELL
  • VTE_VERSION
  • DEBNAME
  • XDG_CURRENT_DESKTOP
  • GPG_AGENT_INFO
  • GNOME_TERMINAL_SERVICE
  • PYTHONSTARTUP
  • COLORFGBG
  • SHLVL
  • XDG_SEAT
  • DEBEMAIL
  • GDMSESSION
  • GNOME_DESKTOP_SESSION_ID
  • LOGNAME
  • DBUS_SESSION_BUS_ADDRESS
  • XDG_RUNTIME_DIR
  • XAUTHORITY
  • LESS_TERMCAP_ue
  • LESS_TERMCAP_us
  • ANSIBLE_COW_SELECTION
  • PATH
  • SESSION_MANAGER
  • LESSOPEN
  • _
  • OLDPWD
  • PYTHONDONTWRITEBYTECODE
  • PIP_PYTHON_PATH

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/sam/bin:/home/sam/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
  • SHELL: /bin/bash
  • EDITOR: vim
  • LANG: en_GB.UTF-8
  • PWD: /home/sam/src/nexsan-exporter/nexsan-exporter


Expected result

A venv that uses symlinks as created by the standard python python3 -m venv /tmp/foo:

$ ls -l /tmp/foo/bin/python*
lrwxrwxrwx 1 sam sam  7 May  1 10:44 /tmp/foo/bin/python -> python3
lrwxrwxrwx 1 sam sam 16 May  1 10:44 /tmp/foo/bin/python3 -> /usr/bin/python3
Actual result

A venv that includes a copy of the python executable:

$ ls -l ~/.local/share/virtualenvs/nexsan-exporter-1-atX-z8/bin/python*
lrwxrwxrwx 1 sam sam       7 May  1 10:46 /home/sam/.local/share/virtualenvs/nexsan-exporter-1-atX-z8/bin/python -> python3
-rwxr-xr-x 1 sam sam 4576440 May  1 10:46 /home/sam/.local/share/virtualenvs/nexsan-exporter-1-atX-z8/bin/python3
lrwxrwxrwx 1 sam sam       7 May  1 10:46 /home/sam/.local/share/virtualenvs/nexsan-exporter-1-atX-z8/bin/python3.6 -> python3
-rwxr-xr-x 1 sam sam    2377 May  1 10:46 /home/sam/.local/share/virtualenvs/nexsan-exporter-1-atX-z8/bin/python-config
Steps to replicate
$ python3 -m pipenv install --verbose
Creating a virtualenv for this project…
Using /usr/bin/python3 (3.6.5) to create virtualenv…
⠋Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/sam/.local/share/virtualenvs/nexsan-exporter-1-atX-z8/bin/python3
Also creating executable in /home/sam/.local/share/virtualenvs/nexsan-exporter-1-atX-z8/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /home/sam/.local/share/virtualenvs/nexsan-exporter-1-atX-z8
Creating a Pipfile for this project…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Using pip: -i https://pypi.org/simple

                          ROUND 1                           
Current constraints:

Finding the best candidates:

Finding secondary dependencies:
------------------------------------------------------------
Result of round 1: stable, done

Locking [packages] dependencies…
Using pip: -i https://pypi.org/simple

                          ROUND 1                           
Current constraints:

Finding the best candidates:

Finding secondary dependencies:
------------------------------------------------------------
Result of round 1: stable, done

Updated Pipfile.lock (ca72e7)!
Installing dependencies from Pipfile.lock (ca72e7)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
To activate this project's virtualenv, run the following:
 $ pipenv shell

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions