pypa/pipenv

pipenv uninstall leaves entry in Pipfile [packages]

jtmoon79 opened this issue · 6 comments

tl;dr pipenv uninstall setuptools does not remove the entry from Pipfile section [packages].

Steps to replicate

  1. create a new project and install a virtual environment
$ mkdir proj1

$ cd proj1

$ pipenv --python 3.7
Creating a virtualenv for this project…
…
Successfully created virtual environment!
Virtualenv location: C:\Users\ulug\.virtualenvs\temp1-wqpe6Y-N
Creating a Pipfile for this project…

$ pipenv install setuptools
…

The generated Pipfile has contents

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

[dev-packages]

[packages]
setuptools = "*"

[requires]
python_version = "3.7"

Uninstall setuptools

$ pipenv uninstall setuptools

UNEXPECTED: Pipfile still has entry setuptools = "*" in section [packages] (the Pipfile has not changed).
EXPECTED: pipenv would remove entry setuptools = "*" in section [packages]. The --help output reads

$ pipenv --help
…
 uninstall  Un-installs a provided package and removes it from Pipfile.
…

$ pipenv --support

Pipenv version: '2018.11.26'

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

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

Python installations found:

  • 3.7.1: C:\Python\Python37\python.exe
  • 3.6.7: C:\Python\Python36\python.exe
  • 3.5: C:\Python\Python35\python.exe
  • 3.4: C:\Python\Python34\python.exe

PEP 508 Information:

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

Well spotted, I think setuptools is a particular case here. You'll get the same issue with 'distribute' and 'pip' packages.

If you do pipenv install setuptools, pipenv doesn't add it to the Pipfile.lock nor does it actually try to install it in the virtual env. So at least it should warn the user about that.

This might be related to #3523 , where pipenv will add stuff to Pipfile even if install doesn't actually do anything.

@geoffroy-noel-ddh Thanks for your explanation, close this issue now.

Same is happening with 'wheel' package. I can see entry in Piplock file as well when I install it. But is this not getting removed in case if pipenv uninstall

susca commented

This also happens with data-science-types.

also happens .... always?

happens with every package if you put version also
pipenv uninstall django==3.1.0

so you can install with version, but you cannot uninstall with version...