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.

PkgResourcesDeprecationWarning for every command executed with pipenv

See original GitHub issue

Issue description

I installed pipenv using pip install pipenv in my conda base environment. The installation was successful, but every command I run shows a weird warning at the start:

Anaconda3\lib\site-packages\pkg_resources\__init__.py:116: PkgResourcesDeprecationWarning: -PKG-VERSION is an invalid version and will not be supported in a future release
  warnings.warn(

This was from the simple command pipenv -h, but every command emits this warning before proceeding. The commands seem to work correctly, however. For pipenv -h, for example, the program displays the help message correctly after the warning. Another thing I should note is that it looks like the warning slows down pipenv. When I run pipenv -h, for example, it takes about a second or two to display the warning, and after that, it takes additional 1~2 seconds to display the actual help message, or run the specified command for this matter.

Expected result

The commands executed by pipenv should not display this weird warning which seems out of nowhere. The commands shouldn’t be slowed down because of this as well.

Actual result

Every command executed by pipenv displays this warning and executes around 1~2 seconds after that.

Steps to replicate

Just run any command like pipenv -h and see the warning. I am using Anaconda with Python 3.9.9 on Windows 11. I am not sure if any of these factors are related to the problem. As mentioned before, I installed pipenv into my (base) conda environment by running pip install pipenv.

$ pipenv --support result (Notice this command also printed the warning)

D:\Programs\Anaconda3\lib\site-packages\pkg_resources\__init__.py:116: PkgResourcesDeprecationWarning: -PKG-VERSION is an invalid version and will not be supported in a future release
  warnings.warn(
<details><summary>$ pipenv --support</summary>

Pipenv version: '2022.1.8'

Pipenv location: 'D:\\Programs\\Anaconda3\\lib\\site-packages\\pipenv'

Python location: 'D:\\Programs\\Anaconda3\\python.exe'

Python installations found:

  • 3.9.9: D:\Programs\Anaconda3\python.exe
  • 3.9.9: D:\Programs\Anaconda3\python.exe

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.9.9',
 'os_name': 'nt',
 'platform_machine': 'AMD64',
 'platform_python_implementation': 'CPython',
 'platform_release': '10',
 'platform_system': 'Windows',
 'platform_version': '10.0.22000',
 'python_full_version': '3.9.9',
 'python_version': '3.9',
 'sys_platform': 'win32'}

System environment variables:

  • ALLUSERSPROFILE
  • APPDATA
  • AZ_ENABLED
  • COMMONPROGRAMFILES
  • COMMONPROGRAMFILES(X86)
  • COMMONPROGRAMW6432
  • COMPUTERNAME
  • COMSPEC
  • CONDA_DEFAULT_ENV
  • CONDA_EXE
  • CONDA_PREFIX
  • CONDA_PROMPT_MODIFIER
  • CONDA_PYTHON_EXE
  • CONDA_SHLVL
  • DRIVERDATA
  • GOPATH
  • HOMEDRIVE
  • HOMEPATH
  • INTELLIJ IDEA COMMUNITY EDITION
  • JAVA_HOME
  • LOCALAPPDATA
  • LOGONSERVER
  • MOREPATHS
  • NUMBER_OF_PROCESSORS
  • ONEDRIVE
  • ONEDRIVECOMMERCIAL
  • ONEDRIVECONSUMER
  • OS
  • PATH
  • PATHEXT
  • PIPENV_VENV_IN_PROJECT
  • POSH_GIT_ENABLED
  • POWERLINE_COMMAND
  • POWERSHELL_DISTRIBUTION_CHANNEL
  • PROCESSOR_ARCHITECTURE
  • PROCESSOR_IDENTIFIER
  • PROCESSOR_LEVEL
  • PROCESSOR_REVISION
  • PROGRAMDATA
  • PROGRAMFILES
  • PROGRAMFILES(X86)
  • PROGRAMW6432
  • PSMODULEPATH
  • PUBLIC
  • PYCHARM COMMUNITY EDITION
  • SYSTEMDRIVE
  • SYSTEMROOT
  • TEMP
  • TMP
  • USERDOMAIN
  • USERDOMAIN_ROAMINGPROFILE
  • USERNAME
  • USERPROFILE
  • WINDIR
  • WORKON_HOME
  • WSLENV
  • WT_PROFILE_ID
  • WT_SESSION
  • _CONDA_EXE
  • _CONDA_ROOT
  • PIP_SHIMS_BASE_MODULE
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

  • PIPENV_VENV_IN_PROJECT: 1

Debug–specific environment variables:

  • PATH: D:\Programs\Anaconda3;D:\Programs\Anaconda3\Library\mingw-w64\bin;D:\Programs\Anaconda3\Library\usr\bin;D:\Programs\Anaconda3\Library\bin;D:\Programs\Anaconda3\Scripts;D:\Programs\Anaconda3\bin;D:\Programs\Anaconda3\condabin;C:\Program Files\PowerShell\7;D:\Programs\Anaconda3;D:\Programs\Anaconda3\Library\mingw-w64\bin;D:\Programs\Anaconda3\Library\usr\bin;D:\Programs\Anaconda3\Library\bin;D:\Programs\Anaconda3\Scripts;D:\Portable_Programs\geckodriver;D:\Portable_Programs\Go\bin;D:\dev\go-workspace\bin;D:\Programs\NASM;.;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\bin;d:\portable_programs\kotlin\kotlinc\bin;c:\program files (x86)\razer chroma sdk\bin;c:\program files\razer chroma sdk\bin;c:\program files (x86)\intel\intel(r) management engine components\icls;c:\program files\intel\intel(r) management engine components\icls;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0;c:\windows\system32\openssh;c:\program files (x86)\intel\intel(r) management engine components\dal;c:\program files\intel\intel(r) management engine components\dal;c:\program files (x86)\intel\intel(r) management engine components\ipt;c:\program files\intel\intel(r) management engine components\ipt;c:\windows\system32\config\systemprofile\appdata\local\microsoft\windowsapps;d:\programs\cmake\bin;c:\program files\nvidia corporation\nvidia nvdlisr;C:\Program Files\dotnet;D:\nodejs\npm;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Users\shai\AppData\Local\Microsoft\WindowsApps;C:\Users\shai\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\shai\AppData\Roaming\npm;D:\Programs\Git\cmd;C:\Users\shai\.dotnet\tools;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;D:\Programs\Calibre2;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;D:\Portable_Programs\Gradle\gradle-7.0.2\bin;D:\.jdks\openjdk-15.0.2\bin;D:\Programs (x86)\texlive\2021\bin\win32;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;D:\Programs\nodejs;C:\Program Files\PowerShell\7;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Users\shai\.cargo\bin;D:\Programs\JetBrains\IntelliJ IDEA Community Edition 2018.3\bin;D:\Programs\JetBrains\PyCharm Community Edition 2019.2\bin;C:\Users\shai\AppData\Local\GitHubDesktop\bin;C:\Users\shai\AppData\Local\Programs\oh-my-posh\bin;C:\Users\shai\AppData\Local\Programs\oh-my-posh\themes

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
ShaiAvrcommented, Feb 21, 2022

@matteius

Another Update:

I just checked on my MacBook Pro with Anaconda installed and it seemed to work. I didn’t get any warnings. This probably means the problem is happening in Windows or in Anaconda in Windows.

0reactions
ytokucommented, Aug 4, 2022

workaround for unix-like system users Replace your pipenv command file with following warning filtered version

#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
import warnings
from pkg_resources import PkgResourcesDeprecationWarning
warnings.simplefilter("ignore", category=PkgResourcesDeprecationWarning)
from pipenv import cli
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(cli())
Read more comments on GitHub >

github_iconTop Results From Across the Web

python3 - What is the meaning of this ... - Ask Ubuntu
I am getting the exact same warning. It happens when you run pipenv --version . – scribe. May 7 at 3:49.
Read more >
FileNotFoundError: [Errno 2] using Pipenv - Stack Overflow
I'm trying to install dependencies in django using pipenv install . Then it responded error message like this in Ubuntu 22.04 LTS.
Read more >
pipenv Documentation - manpages.ubuntu!
Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, ... run will run a given command from...
Read more >
Install Python 3.8, Virtual Environments using Pipenv, Django ...
Pipenv allows you to install any Python library (aka Python-related ... Powershell (or Command Prompt if you don't have Windows Powershell ).
Read more >
A Python Web Application for your Kubernetes Cluster
Pipenv allows us to package our python project in its own environment. ... This is so that any commands we execute should only...
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