question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"pipenv lock --requirements" leaks output from git, making the result invalid, only the first time

See original GitHub issue

Issue description

One of my dependencies is in the format "lib" = {ref = "branch-name", git = "https://url/to/repo.git"}.

I run pipenv lock --requirements > requirements.txt for the first time inside a docker container.

Expected result

I get a valid requirements.txt

Actual result

See below

Steps to replicate

docker run -it --rm python:3.6 bash

Inside container

pip install pipenv==2018.11.26

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

[dev-packages]

[packages]
"numpy" = {ref = "maintenance/1.15.x", git = "https://github.com/numpy/numpy.git"}
' > Pipfile

pipenv lock --requirements > requirements.txt

Resultant requirements.txt (yes really):

Switched to a new branch 'maintenance/1.15.x'
Branch maintenance/1.15.x set up to track remote branch maintenance/1.15.x from origin.
-i https://pypi.org/simple
git+https://github.com/numpy/numpy.git@3430d78c01a3b9a19adad75f1acb5ae18286da73#egg=numpy

And of course:

root@3f46e6fed2ba:/# pip install -r requirements.txt 
Invalid requirement: 'Switched to a new branch 'maintenance/1.15.x''
It looks like a path. File 'Switched to a new branch 'maintenance/1.15.x'' does not exist.

Workaround

I run pipenv lock --requirements > /dev/null 2>&1 once before running the actual command.


Please run $ pipenv --support, and paste the results here. Don’t put backticks (`) around it! The output already contains Markdown formatting.

$ pipenv --support

Pipenv version: '2018.11.26'

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

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

Python installations found:

  • 3.6.7: /usr/local/bin/python
  • 3.6.7: /usr/local/bin/python3.6m
  • 3.5.3: /usr/bin/python3
  • 3.5.3: /usr/bin/python3.5m
  • 2.7.13: /usr/bin/python2.7

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.6.7',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.15.0-39-generic',
 'platform_system': 'Linux',
 'platform_version': '#42~16.04.1-Ubuntu SMP Wed Oct 24 17:09:54 UTC 2018',
 'python_full_version': '3.6.7',
 'python_version': '3.6',
 'sys_platform': 'linux'}

System environment variables:

  • LANG
  • HOSTNAME
  • GPG_KEY
  • PWD
  • HOME
  • TERM
  • PYTHON_VERSION
  • SHLVL
  • PATH
  • PYTHON_PIP_VERSION
  • _
  • 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: /

Contents of Pipfile (‘/Pipfile’):


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

[dev-packages]

[packages]
"numpy" = {ref = "maintenance/1.15.x", git = "https://github.com/numpy/numpy.git"}


Contents of Pipfile.lock (‘/Pipfile.lock’):

{
    "_meta": {
        "hash": {
            "sha256": "e8d89524a159e6d44fa849ffd5e1bf02b13a73b773013996d77d5405776369eb"
        },
        "pipfile-spec": 6,
        "requires": {},
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "numpy": {
            "git": "https://github.com/numpy/numpy.git",
            "ref": "3430d78c01a3b9a19adad75f1acb5ae18286da73"
        }
    },
    "develop": {}
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jaggulicommented, Jan 23, 2020

still exists with version pipenv-2018.11.26

0reactions
techalchemycommented, Jan 22, 2019

Awesome, thanks @cjerdonek — I merged some changes to requirementslib to monkeypatch pip and capture stdout in the meantime

Read more comments on GitHub >

github_iconTop Results From Across the Web

pipenv Documentation - Read the Docs
Generates and checks file hashes for locked dependencies when installing from Pipfile.lock. • Automatically install required Python version when pyenv is ...
Read more >
Advanced Usage of Pipenv - Python Packaging Authority
This document covers some of Pipenv's more glorious and advanced features. ... The locked requirements are written to stdout, with shell output redirection ......
Read more >
Common Pipenv Errors and How to Solve Them: Why Won't it ...
The second most common reason locking fails is that we attempt to install a package that is a pre-release version. You can resolve...
Read more >
History | Poetry - Python dependency management and ...
Fixed packages with invalid metadata triggering an error instead of being skipped. Fixed the generation of invalid lock files in some cases. Git...
Read more >
Frequently Encountered Pipenv Problems - Read the Docs
This is usually a result of mixing Pipenv with system packages. We strongly recommend installing Pipenv in an isolated environment. Uninstall all existing ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found