Skip to content

Incorrect requirements.txt generated when --python=<path> switxh used. #5503

@rgammans

Description

@rgammans

Issue description

When running a command such as pipenv --python=/usr/bin/python3 requirements , pipenv creates a virtual environment.

However since 2022.11.23 (bug is still present in 2022.11.25) this now sends the status message ✔ Successfully created virtual environment! to stdout, but stdout must only contain valid requirements.txt lines when pipenv requirements subcommand is used as the output is normally set (eventually) to pip.

Expected result

When Running pipenv --python=/usr/bin/python3 requirements I would expect to get a valid requirements.txt looking something like below

-i https://mypkgs.org/mypypi/pypi/simple/
adal==1.2.7
aenum==3.1.11
aiohttp==3.8.3 ; python_version >= '3.6'
aiosignal==1.3.1 ; python_version >= '3.7'
...

Actual result

However the output (stdout) for redirecting to requirements.txt I get is:-

✔ Successfully created virtual environment!
-i https://mypkgs.org/mypypi/pypi/simple/
adal==1.2.7
aenum==3.1.11
aiohttp==3.8.3 ; python_version >= '3.6'

The first line above I would expect to only go to the console or stderr.

Steps to replicate

pipenv install asgiref
pipenv --rm
pipenv --python=/usr/bin/python3 requirements  > requirements.txt

Support summary from a clean box used to verify this for reporting.

$ pipenv --support

Pipenv version: '2022.11.23'

Pipenv location: '/home/vagrant/.local/lib/python3.9/site-packages/pipenv'

Python location: '/usr/bin/python3'

OS Name: 'posix'

User pip version: '22.3'

user Python installations found:

  • 3.9.2: /usr/bin/python3.9
  • 3.9.2: /usr/bin/python3
  • 3.9.2: /bin/python3.9
  • 3.9.2: /bin/python3

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.9.2',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.10.0-19-amd64',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP Debian 5.10.149-2 (2022-10-21)',
 'python_full_version': '3.9.2',
 'python_version': '3.9',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • PWD
  • LOGNAME
  • XDG_SESSION_TYPE
  • MOTD_SHOWN
  • HOME
  • LANG
  • LS_COLORS
  • SSH_CONNECTION
  • XDG_SESSION_CLASS
  • TERM
  • USER
  • SHLVL
  • XDG_SESSION_ID
  • XDG_RUNTIME_DIR
  • SSH_CLIENT
  • LC_ALL
  • GCC_COLORS
  • PATH
  • SSH_TTY
  • OLDPWD
  • _
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PIP_PYTHON_PATH
  • PYTHONDONTWRITEBYTECODE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/vagrant/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /home/vagrant/project2

Contents of Pipfile ('/home/vagrant/project2/Pipfile'):

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

[packages]
asgiref = "*"

[dev-packages]

[requires]
python_version = "3.9"

Contents of Pipfile.lock ('/home/vagrant/project2/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "c4372c6397b3d15070c7c2f8267dd39a426be27f5f5af564078bfdc6bc45fbce"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.9"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "asgiref": {
            "hashes": [
                "sha256:1d2880b792ae8757289136f1db2b7b99100ce959b2aa57fd69dab783d05afac4",
                "sha256:4a29362a6acebe09bf1d6640db38c1dc3d9217c68e6f9f6204d72667fc19a424"
            ],
            "index": "pypi",
            "version": "==3.5.2"
        }
    },
    "develop": {}
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions