Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skipping installed packages on install command breaks venv isolation #4299

Closed
tumido opened this issue May 31, 2020 · 1 comment
Closed

Skipping installed packages on install command breaks venv isolation #4299

tumido opened this issue May 31, 2020 · 1 comment
Labels
Type: Duplicate This issue is a duplicate of an already-existing issue. Type: Regression This issue is a regression of a previous behavior.

Comments

@tumido
Copy link

tumido commented May 31, 2020

Issue description

The new release 2020.5.28 introduced a regression in virtual env isolation. #3057 made pipenv to skip to install all reachable packages on pipenv install call. The problem surfaces when Pipenv is installed in one virtual env and used from a different (active) one.

Related to: sclorg/s2i-python-container#382

Expected result

Pipenv ensures that in currently active virtual environment all the packages prescribed by a Pipfile gets installed.

Actual result

Pipenv ensures that all packages prescribed by a Pipfile are either installed into the targed virtualevn or reachable to the current Pipenv runtime.

Steps to replicate

  1. Create two virtual envs, one for Pipenv and another one for the "app"

    $ python3.8 -m venv pipenv_venv
    
    $ python3.8 -m venv app_venv
    
  2. Install Pipenv into the pipenv_venv

    $ source pipenv_venv/bin/activate
    
    $ pip install pipenv
    
    $ deactivate
    
  3. Install packages into the app_venv using the Pipenv from pipenv_venv

    $ source app_venv/bin/activate
    
    $ cat << EOM > Pipfile
    [[source]]
    name = "pypi"
    url = "https://pypi.org/simple"
    verify_ssl = true
    
    [dev-packages]
    
    [packages]
    six = "*"
    certifi = "*"
    chardet = "*"
    EOM
    
    $ pipenv_venv/bin/pipenv install
    ...
    
    $ deactivate
    
  4. See packages that are present in each of the environments

    $ source pipenv_venv/bin/activate
    
    $ pip list
    Package          Version
    ---------------- ----------
    appdirs          1.4.4
    certifi          2020.4.5.1
    distlib          0.3.0
    filelock         3.0.12
    pip              19.2.3
    pipenv           2020.5.28
    setuptools       41.2.0
    six              1.15.0
    virtualenv       20.0.21
    virtualenv-clone 0.5.4
    
    $ deactivate
    
    $ source app_venv/bin/activate
    
    $ pip list
    Package    Version
    ---------- -------
    chardet    3.0.4
    pip        19.2.3
    setuptools 41.2.0
    
    $ deactivate
    

    As you can see the chardet package got installed into the target app_venv virtual env, however the certifi and six packages are missing. This is due to Pipenv being able to locate those packages in pipenv_venv during the pipenv install call.

Note: Named install of the packages using pipenv install <NAME> has a different result since the optimisation is not used:

$ source app_venv/bin/activate

$ pipenv_venv/bin/pipenv install certifi six chardet
...

$ pip list
Package    Version
---------- ----------
certifi    2020.4.5.1
chardet    3.0.4
pip        19.2.3
setuptools 41.2.0
six        1.15.

`pipenv --support` (executed in the Pipenv's `pipenv_venv` virtual env)

Pipenv version: '2020.5.28'

Pipenv location: '/home/tcoufal/pipenv_venv/lib/python3.8/site-packages/pipenv'

Python location: '/home/tcoufal/pipenv_venv/bin/python3.8'

Python installations found:

  • 3.8.3: /home/tcoufal/app_venv/bin/python3
  • 3.8.3: /home/tcoufal/app_venv/bin/python3.8
  • 3.8.3: /home/tcoufal/app_venv/bin/python3
  • 3.8.3: /home/tcoufal/app_venv/bin/python3.8
  • 3.8.3: /bin/python3
  • 3.8.3: /bin/python3.8
  • 3.8.3: /usr/bin/python3
  • 3.8.3: /usr/bin/python3.8
  • 3.6.10: /home/tcoufal/.pyenv/versions/3.6.10/bin/python3.6m
  • 2.7.18: /bin/python2
  • 2.7.18: /bin/python2.7
  • 2.7.18: /usr/bin/python2
  • 2.7.18: /usr/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.8.3',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.6.15-arch1-1',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP PREEMPT Wed, 27 May 2020 23:42:26 +0000',
 'python_full_version': '3.8.3',
 'python_version': '3.8',
 'sys_platform': 'linux'}

System environment variables:

  • COLORFGBG
  • COLORTERM
  • DBUS_SESSION_BUS_ADDRESS
  • DESKTOP_SESSION
  • DISPLAY
  • GTK_IM_MODULE
  • GTK_MODULES
  • HOME
  • KDED_STARTED_BY_KDEINIT
  • KDE_FULL_SESSION
  • KDE_SESSION_UID
  • KDE_SESSION_VERSION
  • KONSOLE_DBUS_SERVICE
  • KONSOLE_DBUS_SESSION
  • KONSOLE_DBUS_WINDOW
  • KONSOLE_VERSION
  • LANG
  • LANGUAGE
  • LC_COLLATE
  • LC_MEASUREMENT
  • LC_MONETARY
  • LC_NUMERIC
  • LC_TIME
  • LOGNAME
  • MAIL
  • MOZ_PLUGIN_PATH
  • OLDPWD
  • PAM_KWALLET5_LOGIN
  • PATH
  • PROFILEHOME
  • PWD
  • QT_AUTO_SCREEN_SCALE_FACTOR
  • SESSION_MANAGER
  • SHELL
  • SHELL_SESSION_ID
  • SHLVL
  • SSH_ASKPASS
  • SSH_AUTH_SOCK
  • TERM
  • USER
  • WINDOWID
  • XAUTHORITY
  • XCURSOR_SIZE
  • XCURSOR_THEME
  • XDG_CURRENT_DESKTOP
  • XDG_RUNTIME_DIR
  • XDG_SEAT
  • XDG_SEAT_PATH
  • XDG_SESSION_CLASS
  • XDG_SESSION_DESKTOP
  • XDG_SESSION_ID
  • XDG_SESSION_PATH
  • XDG_SESSION_TYPE
  • XDG_VTNR
  • _
  • LS_COLORS
  • NVM_DIR
  • NVM_SOURCE
  • NVM_CD_FLAGS
  • NVM_RC_VERSION
  • PYENV_ROOT
  • PYENV_SHELL
  • GOPATH
  • VISUAL
  • EDITOR
  • SUDO_PROMPT
  • PAGER
  • LESS
  • LSCOLORS
  • SPACESHIP_VERSION
  • SPACESHIP_ROOT
  • VIRTUAL_ENV
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/tcoufal/app_venv/bin:/home/tcoufal/.go/bin:/home/tcoufal/.poetry/bin:/home/tcoufal/.pyenv/shims:/home/tcoufal/.pyenv/bin:/home/tcoufal/.local/bin:/home/tcoufal/.npm-global/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
  • SHELL: /bin/zsh
  • EDITOR: vim
  • LANG: en_US.UTF-8
  • PWD: /home/tcoufal
  • VIRTUAL_ENV: /home/tcoufal/app_venv

Contents of Pipfile ('/home/tcoufal/Pipfile'):

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
certifi = "*"
chardet = "*"

[requires]
python_version = "3.8"

Contents of Pipfile.lock ('/home/tcoufal/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "0c12e4b7c1f9f77cb2bc3dc52e5a5c167e520730e51064de30abe15c7534b75f"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.8"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "certifi": {
            "hashes": [
                "sha256:1d987a998c75633c40847cc966fcf5904906c920a7f17ef374f5aa4282abd304",
                "sha256:51fcb31174be6e6664c5f69e3e1691a2d72a1a12e90f872cbdb1567eb47b6519"
            ],
            "index": "pypi",
            "version": "==2020.4.5.1"
        },
        "chardet": {
            "hashes": [
                "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
                "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
            ],
            "index": "pypi",
            "version": "==3.0.4"
        }
    },
    "develop": {}
}
@frostming
Copy link
Contributor

Seems duplicate with #4276 , stay tuned for the coming release.

@frostming frostming added Type: Duplicate This issue is a duplicate of an already-existing issue. Type: Regression This issue is a regression of a previous behavior. labels Jun 1, 2020
@triage-new-issues triage-new-issues bot removed the triage label Jun 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Duplicate This issue is a duplicate of an already-existing issue. Type: Regression This issue is a regression of a previous behavior.
Projects
None yet
Development

No branches or pull requests

2 participants