-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pipenv clean does not clean packages from the virtual env, but some packages from the global env #2849
Comments
Just thought of adding verbose to clean:
Doesn't help all that much. |
I assume you have global packages enabled in the virtualenv. Pipenv uses pip for removal, and pip just ignores non-local packages when you try to uninstall them, so my guess is nothing is not actually removed, those are just no-op. Where are those packages actually installed at? Try printing their |
Those packages are not in the local venv:
After "exit", going back to global python:
As expected The fact that they're not in the local venv is further shown by the experiment described above, where I install virtualenv in the local venv using pip, then run pipenv clean. This now succeeds in uninstalling virtualenv (and only virtual env, even if it prints the same 4 as always) from the local venv. |
The output of "pipenv run pip list" doesn't show any of those 4. There are lots of packages in the venv, whereas my Pipfile is empty. I've tried with a non-empty pipfile, to check it's not caused by that. |
- Fixes #2849 Signed-off-by: Dan Ryan <dan@danryan.co>
Just another data point:
Apart from the confusing lines mentioning global packages (which seem to be no-ops), it acutally uninstalls In a nutshell: |
Everything that svenpanne described is consistent with my understanding of the bug. |
This bug makes using |
This is exactly our scenario here, too: Do a |
For sure. No fix has been merged yet but I would like to get one in. In the mean time you might want to try https://GitHub.com/sarugaku/mork or https://nox.readthedocs.io/en/stable/ depending on your needs. Nox has a nicer API but I’m guessing uses subprocess calls |
OK, using the current master of I'm a bit confused by now: Is the naming confusion bug a |
Ah yes please, open it here with output included @svenpanne — thanks and sorry for the trouble! |
I just reinstalled pipenv from master (8212a21), and Can we get a new |
Issue description
I am trying to run
pipenv clean
after removing a package from Pipfile and runningpipfile lock
Expected result
That the removed packaged is uninstalled by pipenv clean.
Actual result
Pipenv actually tries to remove 4 packages from the global env: pipenv, virtualenv, virtualenv-clone and certifi. It doesn't actually remove them. Maybe it's actually removing them from another virtualenv ?
Steps to replicate
Create a project, add a package with pipenv install.
Remove it by editing the Pipfile.
Run pipfile lock to update Pipfile.lock
Run pipfile clean to remove the package you edited out of Pipfile.
Pipenv clean --dry-run just lists the names of the 4 packages it tries to remove: pipenv, virtualenv, virtualenv-clone, certifi
I then run pip list and the package I removed from Pipfile is still there in the venv. The 4 packages it tried to remove are not even installed in the venv.
I have tested this on both the latest pip release and pipenv master, on Windows. I've tested on both cmd.exe and git bash. Yeah I know bash is not officially supported, that's why I reproed on cmd.exe
This happens in the venv shell or not, and by running 'pipenv run pipenv clean' too.
Update:
Amusingly, if I do install one of the four packages in the venv, it does uninstall it, which points to the code that gets that list as being faulty. The code that tries to uninstall the packages from that list is at fault for failing silently, though.
I can try to repro on Mac OS later tonight
$ pipenv --support
Pipenv version:
'2018.7.1.dev0'
Pipenv location:
'C:\\Users\\safco106950\\AppData\\Roaming\\Python\\Python37\\site-packages\\pipenv'
Python location:
'c:\\users\\safco106950\\appdata\\local\\programs\\python\\python37\\python.exe'
Python installations found:
3.7.0
:C:\Users\safco106950\AppData\Local\Programs\Python\Python37\python.exe
3.6.5
:C:\Users\safco106950\AppData\Local\Programs\Python\Python36-32\python.exe
3.5
:C:\Users\safco106950\AppData\Local\Programs\Python\Python35\python.exe
PEP 508 Information:
System environment variables:
ALLUSERSPROFILE
APPDATA
CLASSPATH
COMMONPROGRAMFILES
COMMONPROGRAMFILES(X86)
COMMONPROGRAMW6432
COMPUTERNAME
COMSPEC
DADIR
DEFLOGDIR
FP_NO_HOST_CHECK
HOMEDRIVE
HOMEPATH
LOCALAPPDATA
LOGONSERVER
NUMBER_OF_PROCESSORS
OS
PATH
PATHEXT
PIPENV_ACTIVE
PIP_PYTHON_PATH
PROCESSOR_ARCHITECTURE
PROCESSOR_IDENTIFIER
PROCESSOR_LEVEL
PROCESSOR_REVISION
PROGRAMDATA
PROGRAMFILES
PROGRAMFILES(X86)
PROGRAMW6432
PROMPT
PSMODULEPATH
PUBLIC
PYTHONDONTWRITEBYTECODE
QTJAVA
SAPLOGON_INI_FILE
SESSIONNAME
SYSTEMDRIVE
SYSTEMROOT
TEMP
TMP
UATDATA
USERDNSDOMAIN
USERDOMAIN
USERDOMAIN_ROAMINGPROFILE
USERNAME
USERPROFILE
VIRTUAL_ENV
VSEDEFLOGDIR
WINDIR
WINDOWS_TRACING_FLAGS
WINDOWS_TRACING_LOGFILE
Pipenvûspecific environment variables:
PIPENV_ACTIVE
:1
Debugûspecific environment variables:
PATH
:C:\Users\safco106950\.virtualenvs\jupyter_test-UM4uSYuv\Scripts;C:\Users\safco106950\AppData\Roaming\Python\Python37\Scripts;C:\Users\safco106950\AppData\Local\Programs\Python\Python37\Scripts;C:\users-apps\Oracle\ora1123\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Hitachi ID;C:\Program Files (x86)\Microsoft Application Virtualization Client;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Enterprise Vault\EVClient\;C:\Program Files (x86)\CheckPoint\Endpoint Security\Endpoint Common\bin;C:\Users\safco106950\AppData\Local\Programs\Python\Launcher\;C:\Users\safco106950\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\safco106950\AppData\Local\Programs\Python\Python36-32\;C:\Users\safco106950\AppData\Local\atom\bin;C:\Users\safco106950\AppData\Local\Pandoc\
VIRTUAL_ENV
:C:\Users\safco106950\.virtualenvs\jupyter_test-UM4uSYuv
Contents of
Pipfile
('C:\Users\safco106950\work\jupyter_test\Pipfile'):Contents of
Pipfile.lock
('C:\Users\safco106950\work\jupyter_test\Pipfile.lock'):The text was updated successfully, but these errors were encountered: