Pipenv: during a regular `pipenv install` pipenv writes "info" statements to standard error stream

Created on 8 Oct 2018  路  5Comments  路  Source: pypa/pipenv

OS: Windows 10 x64
python --version : Python 3.7.0
pip --version : pip 18.0 from c:\program files\python37\lib\site-packagespip (python 3.7)
pipenv --version : pipenv, version 2018.7.1

Issue description

Create a new directory.
cd to that directory.
run pipenv install 1>out 2>err
I don't expect any errors so file out should contains some data and err shoudl be empty

Expected result

out file should contains pipenv install output.
err should be empty

Actual result

out content :

Installing dependencies from Pipfile.lock (a65489)...
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

err output:

pipenv : Creating a virtualenv for this project...
At line:1 char:1
+ pipenv install 1>out 2>err
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Creating a virt...this project...:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Pipfile: C:\aceprocessors\testp2\Pipfile

Using c:\program files\python37\python.exe (3.7.0) to create virtualenv...

Already using interpreter c:\program files\python37\python.exe
Using base prefix 'c:\\program files\\python37'
c:\program files\python37\lib\site-packages\virtualenv.py:1041: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
New python executable in C:\aceprocessors\testp2\.venv\Scripts\python.exe
Installing setuptools, pip, wheel...done.


Virtualenv location: C:\aceprocessors\testp2\.venv

Creating a Pipfile for this project...

Pipfile.lock not found, creating...

Locking [dev-packages] dependencies...

Locking [packages] dependencies...

Updated Pipfile.lock (a65489)!

Steps to replicate

mkdir testp
cd testp
pipenv install 1>out 2>err
(tested in cmd and powershell)


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.7.1'

Pipenv location: 'c:\\program files\\python37\\lib\\site-packages\\pipenv'

Python location: 'c:\\program files\\python37\\python.exe'

Other Python installations in PATH:

  • 3.7: C:\Program Files\Python37\python.exe

  • 3.7.0: C:\Program Files\Python37\python.exe

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.0',
 'os_name': 'nt',
 'platform_machine': 'AMD64',
 'platform_python_implementation': 'CPython',
 'platform_release': '10',
 'platform_system': 'Windows',
 'platform_version': '10.0.17134',
 'python_full_version': '3.7.0',
 'python_version': '3.7',
 'sys_platform': 'win32'}

System environment variables:

  • ALLUSERSPROFILE
  • ANSICON
  • ANSICON_DEF
  • APPDATA
  • CHOCOLATEYPATH
  • COMMONPROGRAMFILES
  • COMMONPROGRAMFILES(X86)
  • COMMONPROGRAMW6432
  • COMPUTERNAME
  • COMSPEC
  • CONEMUANSI
  • CONEMUANSILOG
  • CONEMUARGS
  • CONEMUARGS2
  • CONEMUBACKHWND
  • CONEMUBASEDIR
  • CONEMUBASEDIRSHORT
  • CONEMUBUILD
  • CONEMUCFGDIR
  • CONEMUCONFIG
  • CONEMUDIR
  • CONEMUDRAWHWND
  • CONEMUDRIVE
  • CONEMUHOOKS
  • CONEMUHWND
  • CONEMUPALETTE
  • CONEMUPID
  • CONEMUSERVERPID
  • CONEMUTASK
  • CONEMUWORKDIR
  • CONEMUWORKDRIVE
  • DRIVERDATA
  • ERLANG_HOME
  • FSHARPINSTALLDIR
  • HOME
  • HOMEDRIVE
  • HOMEPATH
  • JAVA_HOME
  • LOCALAPPDATA
  • LOGONSERVER
  • MOZ_PLUGIN_PATH
  • NUGGIEREPOPATH
  • NUMBER_OF_PROCESSORS
  • ONEDRIVE
  • OS
  • PATH
  • PATHEXT
  • PIPENV_VENV_IN_PROJECT
  • PROCESSOR_ARCHITECTURE
  • PROCESSOR_IDENTIFIER
  • PROCESSOR_LEVEL
  • PROCESSOR_REVISION
  • PROGRAMDATA
  • PROGRAMFILES
  • PROGRAMFILES(X86)
  • PROGRAMW6432
  • PSMODULEPATH
  • PUBLIC
  • SESSIONNAME
  • SYSTEMDRIVE
  • SYSTEMROOT
  • TELERIKWPFDIR
  • TEMP
  • TMP
  • TVT
  • UATDATA
  • USERDNSDOMAIN
  • USERDOMAIN
  • USERDOMAIN_ROAMINGPROFILE
  • USERNAME
  • USERPROFILE
  • VBOX_MSI_INSTALL_PATH
  • VS140COMNTOOLS
  • WINDIR
  • PYTHONDONTWRITEBYTECODE
  • PIP_PYTHON_PATH

Pipenv?specific environment variables:

  • PIPENV_VENV_IN_PROJECT: 1

Debug?specific environment variables:

  • PATH: C:\Program Files\ConEmu\ConEmu\Scripts;C:\Program Files\Python37\Scripts\;C:\Program Files\Python37\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Python36\Scripts\;C:\Program Files\Python36\;C:\Program Files (x86)\Python36-32\Scripts\;C:\Program Files (x86)\Python36-32\;C:\Program Files\Docker\Docker\Resources\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\dotnet\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Gradle\gradle-4.1\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Calibre2\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Airtame;C:\Program Files\Microsoft VS Code\bin;c:\programs\Microsoft.Net.Compilers.2.3.1\tools;c:\Users\fku-ext\AppData\Local\Programs\Git\bin;c:\programs\Ruby193\bin\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\WINDOWS\System32\OpenSSH\;C:\Ruby23-x64\bin;C:\programs\Ruby25-x64\bin;C:\Program Files\ConEmu\ConEmu\Scripts;C:\Program Files\ConEmu;C:\Program Files\ConEmu\ConEmu;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Python36-32\Scripts\;C:\Program Files (x86)\Python36-32\;C:\Program Files\Docker\Docker\Resources\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\DTS\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\dotnet\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Gradle\gradle-4.1\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Calibre;C:\Users\fku-ext\AppData\Local\Microsoft\WindowsApps

Contents of Pipfile ('C:\aceprocessors\testp2\Pipfile'):

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

[packages]

[dev-packages]

[requires]
python_version = "3.7"

Contents of Pipfile.lock ('C:\aceprocessors\testp2\Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "7e7ef69da7248742e869378f8421880cf8f0017f96d94d086813baa518a65489"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.7"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {},
    "develop": {}
}

Most helpful comment

@techalchemy thank you for the explanation.
Do you maybe have any any hints on this scenario:
We run pipenv instal form our CI server, beaucse info statements written to std_err it's hard to tell if pipenv install was actuall successfull or not.
Currently I swallow all messages from std_err and std_out, if after running pipenv install the directoy .venv does not exists we print both captured streams as error.

All 5 comments

While I realize this is not normal behavior, there are a few reasons for doing this which involve some legacy decisions around where we are writing and how we are handling specific kinds of messaging. Basically if it's not important it is pushed to stderr by default to provide an easy way for CI and other automation tooling to discard extraneous output.

@techalchemy thank you for the explanation.
Do you maybe have any any hints on this scenario:
We run pipenv instal form our CI server, beaucse info statements written to std_err it's hard to tell if pipenv install was actuall successfull or not.
Currently I swallow all messages from std_err and std_out, if after running pipenv install the directoy .venv does not exists we print both captured streams as error.

to provide an easy way for CI and other automation tooling to discard extraneous output.

Is there a way to change this behavior on appveyor that anyone knows? running into a problem

https://help.appveyor.com/discussions/problems/24708-pipenv-fails-when-pipfilelock-is-updated

I ended up using this:

                Write-Host "        => Running 'pipenv install'"
                pipenv install --deploy 2>&1 |
                    % { $_ -split "`n" } |
                    ? { -not([String]::IsNullOrWhiteSpace($_)) } |
                    % { Write-Host "          => $_"}
                if ($LastExitCode -ne 0) {
                    Write-Host "        => Running 'pipenv install' did not complete successfully"
                    return $false
                }
                return $true;

Heres the appveyor config that worked for me. Hope someone finds it helpful!

  - ps: python -Wignore -m pip install pipenv
  - ps: rm Pipfile.lock
  - ps: $PIPENV_QUIET="true"
  - pipenv run conditional_install
Was this page helpful?
0 / 5 - 0 ratings

Related issues

AkiraSama picture AkiraSama  路  3Comments

marc-fez picture marc-fez  路  3Comments

xi picture xi  路  3Comments

bgjelstrup picture bgjelstrup  路  3Comments

fbender picture fbender  路  3Comments