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

pipenv install --system could be more usable #4086

Open
Alexander3 opened this issue Dec 31, 2019 · 1 comment
Open

pipenv install --system could be more usable #4086

Alexander3 opened this issue Dec 31, 2019 · 1 comment
Labels
--system flag Issues that related to the --system flag triage

Comments

@Alexander3
Copy link

TLDR; I want to use pipenv to manage package installed in system interpreter, because I'm using docker for local development.

Context

Using docker instead of virtualenv for local development is getting more popular. I want to use pipenv for managing dependencies in project, so in my Dockerfile I have a line:

RUN pipenv install --deploy --dev --system

which installs packages already listed in Pipfile/Pipfile.lock

Problem

Now let's say I want to install ipython in my project:

docker-compose exec backend bash
pipenv install ipython --system

And it throws an error:
ERROR:: --system is intended to be used for pre-existing Pipfile installation, not installation of specific packages. Aborting.

Describe the solution you'd like

I would like Pipenv to be able to manage packages in system interpreter.
Also an option to always use system interpreter when PIPENV_SYSTEM=True would be nice. It will still allow me to install project as virtualenv locally without docker and for docker setup only thing to add would be:

environment:
  - PIPENV_SYSTEM=True

in docker-compose.yml

Describe alternatives you've considered

I know I can allow Pipenv to create virtualenv and install new packages easily, but it adds complexity and then running every command will look like:
docker-compose exec backend pipenv run ./manage.py createsuperuser instead of just
docker-compose exec backend ./manage.py createsuperuser

Additional context

$ pipenv --support

Pipenv version: '2018.11.26'

Pipenv location: '/usr/local/lib/python3.8/site-packages/pipenv'

Python location: '/usr/local/bin/python'

Python installations found:

  • 3.8.0: /usr/local/bin/python
  • 3.7.3: /usr/bin/python3
  • 3.7.3: /usr/bin/python3.7m

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.8.0',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.3.0-24-generic',
 'platform_system': 'Linux',
 'platform_version': '#26-Ubuntu SMP Thu Nov 14 01:33:18 UTC 2019',
 'python_full_version': '3.8.0',
 'python_version': '3.8',
 'sys_platform': 'linux'}

System environment variables:

  • REDIS_URL
  • PYTHONUNBUFFERED
  • POSTGRES_HOST
  • HOSTNAME
  • PYTHON_VERSION
  • POSTGRES_PASSWORD
  • ALLOWED_HOSTS
  • DJANGO_SECRET_KEY
  • PWD
  • LINES
  • HOME
  • LANG
  • COLUMNS
  • GPG_KEY
  • DJANGO_SETTINGS_MODULE
  • TERM
  • SHLVL
  • POSTGRES_USER
  • PYTHON_PIP_VERSION
  • REACT_APP_API
  • PYTHON_GET_PIP_SHA256
  • PYTHON_GET_PIP_URL
  • PATH
  • DEBUG
  • POSTGRES_DB
  • _
  • 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: /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  • LANG: C.UTF-8
  • PWD: /app

Contents of Pipfile ('/app/Pipfile'):

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

[dev-packages]

[packages]
arrow = "*"

[requires]
python_version = "3.8"

Contents of Pipfile.lock ('/app/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "368b0f0e134c147e691b1ab6f46ed968016f6035543ac4486e52c00ac221b9f8"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.8"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "arrow": {
            "hashes": [
                "sha256:01a16d8a93eddf86a29237f32ae36b29c27f047e79312eb4df5d55fd5a2b3183",
                "sha256:e1a318a4c0b787833ae46302c02488b6eeef413c6a13324b3261ad320f21ec1e"
            ],
            "index": "pypi",
            "version": "==0.15.4"
        },
        "python-dateutil": {
            "hashes": [
                "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c",
                "sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a"
            ],
            "version": "==2.8.1"
        },
        "six": {
            "hashes": [
                "sha256:1f1b7d42e254082a9db6279deae68afb421ceba6158efa6131de7b3003ee93fd",
                "sha256:30f610279e8b2578cab6db20741130331735c781b56053c59c4076da27f06b66"
            ],
            "version": "==1.13.0"
        }
    },
    "develop": {}
}
@davetapley
Copy link

Additional confusion

If starting from scratch then I can do a regular pipenv install to get a Pipfile.lock,
but then when I pipenv install --system it doesn't install anything
(despite saying Installing dependencies from Pipfile.lock).

If I subsequently rm -r ~/.local/share/virtualenvs/ (I am in Python Codespace)
and then pipenv install --system again it will install,
albeit emitting:

Failed to load paths: /bin/sh: 1: /home/vscode/.local/share/virtualenvs/dataclasses-configobj-HheCbY6G/bin/python: not found

⬆️ is also discussed on this SO question.


Perhaps a separate bug for the Failed to load paths output is warranted?

@matteius matteius added the --system flag Issues that related to the --system flag label Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--system flag Issues that related to the --system flag triage
Projects
None yet
Development

No branches or pull requests

3 participants