11

In Python 2.7.11 under Windows I have installed sqlalchemy into a virtual environment. Now, when I try to uninstall it via

pip uninstall sqlalchemy

pip hangs when listing the following lines:

.
.
.
c:\venv\lib\site-packages\sqlalchemy\util\langhelpers.py
c:\venv\lib\site-packages\sqlalchemy\util\langhelpers.pyc
c:\venv\lib\site-packages\sqlalchemy\util\queue.py
c:\venv\lib\site-packages\sqlalchemy\util\queue.pyc
c:\venv\lib\site-packages\sqlalchemy\util\topological.py
c:\venv\lib\site-packages\sqlalchemy\util\topological.pyc

This happens repeatedly, when I cancel the uninstall command and issue it again, even after system restart.

What can I do to make pip continue?

halloleo
  • 9,216
  • 13
  • 64
  • 122

4 Answers4

30

Looks like pip uninstall prompts you with "Do you want to continue (Y/N)?", but that is not visible in cygwin or git bash for some reason.

Typing "y" and pressing enter makes the pip uninstall proceed.

  • Sounds like a great explanation! Will test it next time I come across this issue on uninstall on Windows. – halloleo Jan 27 '17 at 02:35
  • Checked on uninstalling ansible via pip. It really works, thanks :) – Dmitry Feb 23 '17 at 17:36
  • 1
    i was able to confirm that this fixed it, it is after pressing the 'y' that the prompt "Do you want to continue (Y/N)?" appears, im using git bash – ianace Jul 10 '17 at 04:03
  • Well done for understanding this, do you know how to fix the environment of git bash to show these prints? – e271p314 Jul 17 '17 at 17:07
  • 1
    In Git Bash you can prefix the command with 'winpty ' to make the prompt show up properly. – Krenair Feb 14 '18 at 17:14
22

If you don't want to type "y" (or you want to run it in a script), use

pip uninstall sqlalchemy --yes

David Espart
  • 11,520
  • 7
  • 36
  • 50
0

I was not able to solve why pip hung on uninstall; however through another stackoverflow answer I realised that I can remove the package manually with:

del C:\venv\Lib\site-packages\sqlalchemy
del C:\venv\Lib\site-packages\SQLAlchemy-1.0.14.dist-info

I checked for mentions of sqlalchemy in any *.pth file too, but there were no occurrences.

In any case, pip freeze revealed that the package was properly gone.

Community
  • 1
  • 1
halloleo
  • 9,216
  • 13
  • 64
  • 122
-1

I tried all steps but finally this works for me:

pip install --ignore-installed ${PACKAGE_NAME}
pushkin
  • 9,575
  • 15
  • 51
  • 95
DAA
  • 13
  • 1
  • 4