How do I detect and remove Python packages installed via pip?












64















I have accidently installed Python packages to my system using pip instead of apt-get. I did this in two ways:




  • using an older version of virtualenv, I forgot to append --no-site-packages when creating the virtualenv - after that when I called pip install, the Python packages where installed to the system rather than the virtualenv

  • in a correctly setup virtualenv, I typed sudo pip install somepackage - the sudo installed to the system rather than the virtualenv


I happened to notice this because I typed pip freeze outside a virtualenv, and spotted some Python packages listed that shouldn't be there. So now my question is:




  • how do I identify all Python packages that have been erroneously installed on the system (that is, Python packages that appear in the pip freeze list, but were not installed with apt-get)?

  • how do I remove them?










share|improve this question





























    64















    I have accidently installed Python packages to my system using pip instead of apt-get. I did this in two ways:




    • using an older version of virtualenv, I forgot to append --no-site-packages when creating the virtualenv - after that when I called pip install, the Python packages where installed to the system rather than the virtualenv

    • in a correctly setup virtualenv, I typed sudo pip install somepackage - the sudo installed to the system rather than the virtualenv


    I happened to notice this because I typed pip freeze outside a virtualenv, and spotted some Python packages listed that shouldn't be there. So now my question is:




    • how do I identify all Python packages that have been erroneously installed on the system (that is, Python packages that appear in the pip freeze list, but were not installed with apt-get)?

    • how do I remove them?










    share|improve this question



























      64












      64








      64


      36






      I have accidently installed Python packages to my system using pip instead of apt-get. I did this in two ways:




      • using an older version of virtualenv, I forgot to append --no-site-packages when creating the virtualenv - after that when I called pip install, the Python packages where installed to the system rather than the virtualenv

      • in a correctly setup virtualenv, I typed sudo pip install somepackage - the sudo installed to the system rather than the virtualenv


      I happened to notice this because I typed pip freeze outside a virtualenv, and spotted some Python packages listed that shouldn't be there. So now my question is:




      • how do I identify all Python packages that have been erroneously installed on the system (that is, Python packages that appear in the pip freeze list, but were not installed with apt-get)?

      • how do I remove them?










      share|improve this question
















      I have accidently installed Python packages to my system using pip instead of apt-get. I did this in two ways:




      • using an older version of virtualenv, I forgot to append --no-site-packages when creating the virtualenv - after that when I called pip install, the Python packages where installed to the system rather than the virtualenv

      • in a correctly setup virtualenv, I typed sudo pip install somepackage - the sudo installed to the system rather than the virtualenv


      I happened to notice this because I typed pip freeze outside a virtualenv, and spotted some Python packages listed that shouldn't be there. So now my question is:




      • how do I identify all Python packages that have been erroneously installed on the system (that is, Python packages that appear in the pip freeze list, but were not installed with apt-get)?

      • how do I remove them?







      python package-management pip






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 5 '14 at 20:40









      Christopher Kyle Horton

      10.5k1269143




      10.5k1269143










      asked Aug 8 '12 at 8:48









      d3vidd3vid

      7,8042177141




      7,8042177141






















          6 Answers
          6






          active

          oldest

          votes


















          55














          Ubuntu Oneiric (and I expect newer versions too) install pip packages to /usr/local/lib/python2.7/dist-packages, and apt packages to /usr/lib/python2.7/dist-packages. So just check the former directory and sudo pip uninstall every package you find there.






          share|improve this answer



















          • 11





            I went brutal and issued sudo rm -r /usr/local/lib/python2.7. So far so good.

            – Apteryx
            Sep 22 '16 at 0:49











          • @Apteryx, i did the same with /usr/local/lib/python3.5, and after a while an upgrade of update-notifier-common package failed because of missing Python 3 six package. I ended up installing six with sudo -H pip3 install six.

            – Alexey
            Apr 8 '17 at 8:54








          • 1





            @Apteryx god damn you man! I did the same and now my whole system is all fucked up! because almost everything in ubuntu relies on python!

            – yukashima huksay
            Dec 27 '17 at 12:47











          • I have noticed that i now have a bunch of broken executables in /usr/local/bin/ (a while ago i just removed /usr/local/lib/python3.5 and switched to conda).

            – Alexey
            Feb 28 '18 at 12:29



















          14














          Pip currently ignores uninstall commands that try to uninstall something owned by the OS. It doesn't error out, like it does with a missing package. So, now you can uninstall with the following process:



          pip freeze > dump.txt


          Edit the dumped file to remove any -e "editable install" lines, everything after the == sign (%s;==.*;;g in vim), swap the new lines for spaces (%s;n; ;g in vim). Then you can uninstall all un-owned packages with



          cat dump.txt | xargs sudo pip uninstall -y


          I had to do this procedure twice, because a few packages were installed in ~/.local/lib too.






          share|improve this answer



















          • 1





            This should be the accepted answer to me

            – Nam G VU
            Apr 19 '17 at 10:28






          • 2





            Should anyone want a vimless one-liner: sudo pip uninstall -y $(pip freeze | sed 's;==.*;;g' | tr 'n' ' ')

            – Benoit Duffez
            Apr 20 '17 at 7:34






          • 3





            Careful! This depends on whether your OS ships a special version of pip. On archlinux pip happily uninstalls system packages. On the other hand, pip on debian jessie complains and errors: Not uninstalling virtualenv at /usr/lib/python3/dist-packages, owned by OS

            – Thomas G.
            Apr 20 '17 at 14:37






          • 1





            do you need the sudo? -- this should definitely be the accepted answer

            – Jonathan
            Jul 11 '17 at 6:49





















          6














          AFAIK sudo pip install will install on /usr/local/lib/pythonVERSION/dist-packages. You need to run sudo pip uninstall to uninstall packages system wide. It seems that pip freeze looks for package metadata and will list anything installed i.e. both from pip as well as apt-get outside of virtualenvs. There is -l option inside virtual environment to list packages only applicable to that virtual environment but it seems to be default case as well inside virtual environment. I think you can just delete related packages on /usr/local/lib/pythonVERSION/dist-packages as well but not very convenient method I guess.






          share|improve this answer

































            5














            To removing a package installed via pip, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below.



            pip uninstall < package-name >


            To search for packages



            pip search <package you want to search for>


            To determine which Python packages were installed by pip, by the freeze command, which will give you a list of installed packages and their versions. I would suggest removing all instances, and re-installing using the sudo apt-get command



            sudo apt-get install python3





            share|improve this answer


























            • how do I determine which Python packages were installed by pip, and which by apt-get? can I still pip uninstall if I used sudo pip install in the first place?

              – d3vid
              Aug 8 '12 at 9:42











            • @d3vid pip freeze only shows packages it installed (AFAICS).

              – Oli
              Aug 8 '12 at 10:22








            • 1





              @oli pip freeze, in precise at least, also lists packages installed by apt, as other answers here describe.

              – nealmcb
              Oct 23 '13 at 20:37



















            0














            I needed to clean up disk space from Python packages safely. While this is a complete clean out of packages, I needed to move Python versions as well so I did not need old packages. I used the following to get all my package names, skip the first 2 lines and grab the first column, and uninstall without user interaction:



            pip list | awk 'NR>2 {print $1}' | xargs -I {} pip uninstall -y {}





            share|improve this answer































              -1














              This has something to do with Homebrew. I had no issues with pyodbc on my Mac Air until I installed Homebrew and used it for a few things. I found this thread on github that ends in a solution that worked for me.



              "If you have Homebrew, just install the ODBC headers:



              $ brew install unixodbc


              and run "pip install pyodbc" again."



              This 100% solved the problem for me and only took a moment. Give it a shot.






              share|improve this answer


























              • maybe you need to post this at Ask Different? apple.stackexchange.com

                – d3vid
                Jul 5 '17 at 11:58












              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f173323%2fhow-do-i-detect-and-remove-python-packages-installed-via-pip%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              6 Answers
              6






              active

              oldest

              votes








              6 Answers
              6






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              55














              Ubuntu Oneiric (and I expect newer versions too) install pip packages to /usr/local/lib/python2.7/dist-packages, and apt packages to /usr/lib/python2.7/dist-packages. So just check the former directory and sudo pip uninstall every package you find there.






              share|improve this answer



















              • 11





                I went brutal and issued sudo rm -r /usr/local/lib/python2.7. So far so good.

                – Apteryx
                Sep 22 '16 at 0:49











              • @Apteryx, i did the same with /usr/local/lib/python3.5, and after a while an upgrade of update-notifier-common package failed because of missing Python 3 six package. I ended up installing six with sudo -H pip3 install six.

                – Alexey
                Apr 8 '17 at 8:54








              • 1





                @Apteryx god damn you man! I did the same and now my whole system is all fucked up! because almost everything in ubuntu relies on python!

                – yukashima huksay
                Dec 27 '17 at 12:47











              • I have noticed that i now have a bunch of broken executables in /usr/local/bin/ (a while ago i just removed /usr/local/lib/python3.5 and switched to conda).

                – Alexey
                Feb 28 '18 at 12:29
















              55














              Ubuntu Oneiric (and I expect newer versions too) install pip packages to /usr/local/lib/python2.7/dist-packages, and apt packages to /usr/lib/python2.7/dist-packages. So just check the former directory and sudo pip uninstall every package you find there.






              share|improve this answer



















              • 11





                I went brutal and issued sudo rm -r /usr/local/lib/python2.7. So far so good.

                – Apteryx
                Sep 22 '16 at 0:49











              • @Apteryx, i did the same with /usr/local/lib/python3.5, and after a while an upgrade of update-notifier-common package failed because of missing Python 3 six package. I ended up installing six with sudo -H pip3 install six.

                – Alexey
                Apr 8 '17 at 8:54








              • 1





                @Apteryx god damn you man! I did the same and now my whole system is all fucked up! because almost everything in ubuntu relies on python!

                – yukashima huksay
                Dec 27 '17 at 12:47











              • I have noticed that i now have a bunch of broken executables in /usr/local/bin/ (a while ago i just removed /usr/local/lib/python3.5 and switched to conda).

                – Alexey
                Feb 28 '18 at 12:29














              55












              55








              55







              Ubuntu Oneiric (and I expect newer versions too) install pip packages to /usr/local/lib/python2.7/dist-packages, and apt packages to /usr/lib/python2.7/dist-packages. So just check the former directory and sudo pip uninstall every package you find there.






              share|improve this answer













              Ubuntu Oneiric (and I expect newer versions too) install pip packages to /usr/local/lib/python2.7/dist-packages, and apt packages to /usr/lib/python2.7/dist-packages. So just check the former directory and sudo pip uninstall every package you find there.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Feb 22 '13 at 12:48









              Capi EtherielCapi Etheriel

              1,38521623




              1,38521623








              • 11





                I went brutal and issued sudo rm -r /usr/local/lib/python2.7. So far so good.

                – Apteryx
                Sep 22 '16 at 0:49











              • @Apteryx, i did the same with /usr/local/lib/python3.5, and after a while an upgrade of update-notifier-common package failed because of missing Python 3 six package. I ended up installing six with sudo -H pip3 install six.

                – Alexey
                Apr 8 '17 at 8:54








              • 1





                @Apteryx god damn you man! I did the same and now my whole system is all fucked up! because almost everything in ubuntu relies on python!

                – yukashima huksay
                Dec 27 '17 at 12:47











              • I have noticed that i now have a bunch of broken executables in /usr/local/bin/ (a while ago i just removed /usr/local/lib/python3.5 and switched to conda).

                – Alexey
                Feb 28 '18 at 12:29














              • 11





                I went brutal and issued sudo rm -r /usr/local/lib/python2.7. So far so good.

                – Apteryx
                Sep 22 '16 at 0:49











              • @Apteryx, i did the same with /usr/local/lib/python3.5, and after a while an upgrade of update-notifier-common package failed because of missing Python 3 six package. I ended up installing six with sudo -H pip3 install six.

                – Alexey
                Apr 8 '17 at 8:54








              • 1





                @Apteryx god damn you man! I did the same and now my whole system is all fucked up! because almost everything in ubuntu relies on python!

                – yukashima huksay
                Dec 27 '17 at 12:47











              • I have noticed that i now have a bunch of broken executables in /usr/local/bin/ (a while ago i just removed /usr/local/lib/python3.5 and switched to conda).

                – Alexey
                Feb 28 '18 at 12:29








              11




              11





              I went brutal and issued sudo rm -r /usr/local/lib/python2.7. So far so good.

              – Apteryx
              Sep 22 '16 at 0:49





              I went brutal and issued sudo rm -r /usr/local/lib/python2.7. So far so good.

              – Apteryx
              Sep 22 '16 at 0:49













              @Apteryx, i did the same with /usr/local/lib/python3.5, and after a while an upgrade of update-notifier-common package failed because of missing Python 3 six package. I ended up installing six with sudo -H pip3 install six.

              – Alexey
              Apr 8 '17 at 8:54







              @Apteryx, i did the same with /usr/local/lib/python3.5, and after a while an upgrade of update-notifier-common package failed because of missing Python 3 six package. I ended up installing six with sudo -H pip3 install six.

              – Alexey
              Apr 8 '17 at 8:54






              1




              1





              @Apteryx god damn you man! I did the same and now my whole system is all fucked up! because almost everything in ubuntu relies on python!

              – yukashima huksay
              Dec 27 '17 at 12:47





              @Apteryx god damn you man! I did the same and now my whole system is all fucked up! because almost everything in ubuntu relies on python!

              – yukashima huksay
              Dec 27 '17 at 12:47













              I have noticed that i now have a bunch of broken executables in /usr/local/bin/ (a while ago i just removed /usr/local/lib/python3.5 and switched to conda).

              – Alexey
              Feb 28 '18 at 12:29





              I have noticed that i now have a bunch of broken executables in /usr/local/bin/ (a while ago i just removed /usr/local/lib/python3.5 and switched to conda).

              – Alexey
              Feb 28 '18 at 12:29













              14














              Pip currently ignores uninstall commands that try to uninstall something owned by the OS. It doesn't error out, like it does with a missing package. So, now you can uninstall with the following process:



              pip freeze > dump.txt


              Edit the dumped file to remove any -e "editable install" lines, everything after the == sign (%s;==.*;;g in vim), swap the new lines for spaces (%s;n; ;g in vim). Then you can uninstall all un-owned packages with



              cat dump.txt | xargs sudo pip uninstall -y


              I had to do this procedure twice, because a few packages were installed in ~/.local/lib too.






              share|improve this answer



















              • 1





                This should be the accepted answer to me

                – Nam G VU
                Apr 19 '17 at 10:28






              • 2





                Should anyone want a vimless one-liner: sudo pip uninstall -y $(pip freeze | sed 's;==.*;;g' | tr 'n' ' ')

                – Benoit Duffez
                Apr 20 '17 at 7:34






              • 3





                Careful! This depends on whether your OS ships a special version of pip. On archlinux pip happily uninstalls system packages. On the other hand, pip on debian jessie complains and errors: Not uninstalling virtualenv at /usr/lib/python3/dist-packages, owned by OS

                – Thomas G.
                Apr 20 '17 at 14:37






              • 1





                do you need the sudo? -- this should definitely be the accepted answer

                – Jonathan
                Jul 11 '17 at 6:49


















              14














              Pip currently ignores uninstall commands that try to uninstall something owned by the OS. It doesn't error out, like it does with a missing package. So, now you can uninstall with the following process:



              pip freeze > dump.txt


              Edit the dumped file to remove any -e "editable install" lines, everything after the == sign (%s;==.*;;g in vim), swap the new lines for spaces (%s;n; ;g in vim). Then you can uninstall all un-owned packages with



              cat dump.txt | xargs sudo pip uninstall -y


              I had to do this procedure twice, because a few packages were installed in ~/.local/lib too.






              share|improve this answer



















              • 1





                This should be the accepted answer to me

                – Nam G VU
                Apr 19 '17 at 10:28






              • 2





                Should anyone want a vimless one-liner: sudo pip uninstall -y $(pip freeze | sed 's;==.*;;g' | tr 'n' ' ')

                – Benoit Duffez
                Apr 20 '17 at 7:34






              • 3





                Careful! This depends on whether your OS ships a special version of pip. On archlinux pip happily uninstalls system packages. On the other hand, pip on debian jessie complains and errors: Not uninstalling virtualenv at /usr/lib/python3/dist-packages, owned by OS

                – Thomas G.
                Apr 20 '17 at 14:37






              • 1





                do you need the sudo? -- this should definitely be the accepted answer

                – Jonathan
                Jul 11 '17 at 6:49
















              14












              14








              14







              Pip currently ignores uninstall commands that try to uninstall something owned by the OS. It doesn't error out, like it does with a missing package. So, now you can uninstall with the following process:



              pip freeze > dump.txt


              Edit the dumped file to remove any -e "editable install" lines, everything after the == sign (%s;==.*;;g in vim), swap the new lines for spaces (%s;n; ;g in vim). Then you can uninstall all un-owned packages with



              cat dump.txt | xargs sudo pip uninstall -y


              I had to do this procedure twice, because a few packages were installed in ~/.local/lib too.






              share|improve this answer













              Pip currently ignores uninstall commands that try to uninstall something owned by the OS. It doesn't error out, like it does with a missing package. So, now you can uninstall with the following process:



              pip freeze > dump.txt


              Edit the dumped file to remove any -e "editable install" lines, everything after the == sign (%s;==.*;;g in vim), swap the new lines for spaces (%s;n; ;g in vim). Then you can uninstall all un-owned packages with



              cat dump.txt | xargs sudo pip uninstall -y


              I had to do this procedure twice, because a few packages were installed in ~/.local/lib too.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Oct 26 '15 at 14:54









              Henry SchreinerHenry Schreiner

              24123




              24123








              • 1





                This should be the accepted answer to me

                – Nam G VU
                Apr 19 '17 at 10:28






              • 2





                Should anyone want a vimless one-liner: sudo pip uninstall -y $(pip freeze | sed 's;==.*;;g' | tr 'n' ' ')

                – Benoit Duffez
                Apr 20 '17 at 7:34






              • 3





                Careful! This depends on whether your OS ships a special version of pip. On archlinux pip happily uninstalls system packages. On the other hand, pip on debian jessie complains and errors: Not uninstalling virtualenv at /usr/lib/python3/dist-packages, owned by OS

                – Thomas G.
                Apr 20 '17 at 14:37






              • 1





                do you need the sudo? -- this should definitely be the accepted answer

                – Jonathan
                Jul 11 '17 at 6:49
















              • 1





                This should be the accepted answer to me

                – Nam G VU
                Apr 19 '17 at 10:28






              • 2





                Should anyone want a vimless one-liner: sudo pip uninstall -y $(pip freeze | sed 's;==.*;;g' | tr 'n' ' ')

                – Benoit Duffez
                Apr 20 '17 at 7:34






              • 3





                Careful! This depends on whether your OS ships a special version of pip. On archlinux pip happily uninstalls system packages. On the other hand, pip on debian jessie complains and errors: Not uninstalling virtualenv at /usr/lib/python3/dist-packages, owned by OS

                – Thomas G.
                Apr 20 '17 at 14:37






              • 1





                do you need the sudo? -- this should definitely be the accepted answer

                – Jonathan
                Jul 11 '17 at 6:49










              1




              1





              This should be the accepted answer to me

              – Nam G VU
              Apr 19 '17 at 10:28





              This should be the accepted answer to me

              – Nam G VU
              Apr 19 '17 at 10:28




              2




              2





              Should anyone want a vimless one-liner: sudo pip uninstall -y $(pip freeze | sed 's;==.*;;g' | tr 'n' ' ')

              – Benoit Duffez
              Apr 20 '17 at 7:34





              Should anyone want a vimless one-liner: sudo pip uninstall -y $(pip freeze | sed 's;==.*;;g' | tr 'n' ' ')

              – Benoit Duffez
              Apr 20 '17 at 7:34




              3




              3





              Careful! This depends on whether your OS ships a special version of pip. On archlinux pip happily uninstalls system packages. On the other hand, pip on debian jessie complains and errors: Not uninstalling virtualenv at /usr/lib/python3/dist-packages, owned by OS

              – Thomas G.
              Apr 20 '17 at 14:37





              Careful! This depends on whether your OS ships a special version of pip. On archlinux pip happily uninstalls system packages. On the other hand, pip on debian jessie complains and errors: Not uninstalling virtualenv at /usr/lib/python3/dist-packages, owned by OS

              – Thomas G.
              Apr 20 '17 at 14:37




              1




              1





              do you need the sudo? -- this should definitely be the accepted answer

              – Jonathan
              Jul 11 '17 at 6:49







              do you need the sudo? -- this should definitely be the accepted answer

              – Jonathan
              Jul 11 '17 at 6:49













              6














              AFAIK sudo pip install will install on /usr/local/lib/pythonVERSION/dist-packages. You need to run sudo pip uninstall to uninstall packages system wide. It seems that pip freeze looks for package metadata and will list anything installed i.e. both from pip as well as apt-get outside of virtualenvs. There is -l option inside virtual environment to list packages only applicable to that virtual environment but it seems to be default case as well inside virtual environment. I think you can just delete related packages on /usr/local/lib/pythonVERSION/dist-packages as well but not very convenient method I guess.






              share|improve this answer






























                6














                AFAIK sudo pip install will install on /usr/local/lib/pythonVERSION/dist-packages. You need to run sudo pip uninstall to uninstall packages system wide. It seems that pip freeze looks for package metadata and will list anything installed i.e. both from pip as well as apt-get outside of virtualenvs. There is -l option inside virtual environment to list packages only applicable to that virtual environment but it seems to be default case as well inside virtual environment. I think you can just delete related packages on /usr/local/lib/pythonVERSION/dist-packages as well but not very convenient method I guess.






                share|improve this answer




























                  6












                  6








                  6







                  AFAIK sudo pip install will install on /usr/local/lib/pythonVERSION/dist-packages. You need to run sudo pip uninstall to uninstall packages system wide. It seems that pip freeze looks for package metadata and will list anything installed i.e. both from pip as well as apt-get outside of virtualenvs. There is -l option inside virtual environment to list packages only applicable to that virtual environment but it seems to be default case as well inside virtual environment. I think you can just delete related packages on /usr/local/lib/pythonVERSION/dist-packages as well but not very convenient method I guess.






                  share|improve this answer















                  AFAIK sudo pip install will install on /usr/local/lib/pythonVERSION/dist-packages. You need to run sudo pip uninstall to uninstall packages system wide. It seems that pip freeze looks for package metadata and will list anything installed i.e. both from pip as well as apt-get outside of virtualenvs. There is -l option inside virtual environment to list packages only applicable to that virtual environment but it seems to be default case as well inside virtual environment. I think you can just delete related packages on /usr/local/lib/pythonVERSION/dist-packages as well but not very convenient method I guess.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Aug 8 '12 at 11:18

























                  answered Aug 8 '12 at 11:01









                  sagarchalisesagarchalise

                  18.2k115974




                  18.2k115974























                      5














                      To removing a package installed via pip, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below.



                      pip uninstall < package-name >


                      To search for packages



                      pip search <package you want to search for>


                      To determine which Python packages were installed by pip, by the freeze command, which will give you a list of installed packages and their versions. I would suggest removing all instances, and re-installing using the sudo apt-get command



                      sudo apt-get install python3





                      share|improve this answer


























                      • how do I determine which Python packages were installed by pip, and which by apt-get? can I still pip uninstall if I used sudo pip install in the first place?

                        – d3vid
                        Aug 8 '12 at 9:42











                      • @d3vid pip freeze only shows packages it installed (AFAICS).

                        – Oli
                        Aug 8 '12 at 10:22








                      • 1





                        @oli pip freeze, in precise at least, also lists packages installed by apt, as other answers here describe.

                        – nealmcb
                        Oct 23 '13 at 20:37
















                      5














                      To removing a package installed via pip, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below.



                      pip uninstall < package-name >


                      To search for packages



                      pip search <package you want to search for>


                      To determine which Python packages were installed by pip, by the freeze command, which will give you a list of installed packages and their versions. I would suggest removing all instances, and re-installing using the sudo apt-get command



                      sudo apt-get install python3





                      share|improve this answer


























                      • how do I determine which Python packages were installed by pip, and which by apt-get? can I still pip uninstall if I used sudo pip install in the first place?

                        – d3vid
                        Aug 8 '12 at 9:42











                      • @d3vid pip freeze only shows packages it installed (AFAICS).

                        – Oli
                        Aug 8 '12 at 10:22








                      • 1





                        @oli pip freeze, in precise at least, also lists packages installed by apt, as other answers here describe.

                        – nealmcb
                        Oct 23 '13 at 20:37














                      5












                      5








                      5







                      To removing a package installed via pip, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below.



                      pip uninstall < package-name >


                      To search for packages



                      pip search <package you want to search for>


                      To determine which Python packages were installed by pip, by the freeze command, which will give you a list of installed packages and their versions. I would suggest removing all instances, and re-installing using the sudo apt-get command



                      sudo apt-get install python3





                      share|improve this answer















                      To removing a package installed via pip, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below.



                      pip uninstall < package-name >


                      To search for packages



                      pip search <package you want to search for>


                      To determine which Python packages were installed by pip, by the freeze command, which will give you a list of installed packages and their versions. I would suggest removing all instances, and re-installing using the sudo apt-get command



                      sudo apt-get install python3






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Aug 8 '12 at 10:30

























                      answered Aug 8 '12 at 9:13









                      MitchMitch

                      85.4k14174232




                      85.4k14174232













                      • how do I determine which Python packages were installed by pip, and which by apt-get? can I still pip uninstall if I used sudo pip install in the first place?

                        – d3vid
                        Aug 8 '12 at 9:42











                      • @d3vid pip freeze only shows packages it installed (AFAICS).

                        – Oli
                        Aug 8 '12 at 10:22








                      • 1





                        @oli pip freeze, in precise at least, also lists packages installed by apt, as other answers here describe.

                        – nealmcb
                        Oct 23 '13 at 20:37



















                      • how do I determine which Python packages were installed by pip, and which by apt-get? can I still pip uninstall if I used sudo pip install in the first place?

                        – d3vid
                        Aug 8 '12 at 9:42











                      • @d3vid pip freeze only shows packages it installed (AFAICS).

                        – Oli
                        Aug 8 '12 at 10:22








                      • 1





                        @oli pip freeze, in precise at least, also lists packages installed by apt, as other answers here describe.

                        – nealmcb
                        Oct 23 '13 at 20:37

















                      how do I determine which Python packages were installed by pip, and which by apt-get? can I still pip uninstall if I used sudo pip install in the first place?

                      – d3vid
                      Aug 8 '12 at 9:42





                      how do I determine which Python packages were installed by pip, and which by apt-get? can I still pip uninstall if I used sudo pip install in the first place?

                      – d3vid
                      Aug 8 '12 at 9:42













                      @d3vid pip freeze only shows packages it installed (AFAICS).

                      – Oli
                      Aug 8 '12 at 10:22







                      @d3vid pip freeze only shows packages it installed (AFAICS).

                      – Oli
                      Aug 8 '12 at 10:22






                      1




                      1





                      @oli pip freeze, in precise at least, also lists packages installed by apt, as other answers here describe.

                      – nealmcb
                      Oct 23 '13 at 20:37





                      @oli pip freeze, in precise at least, also lists packages installed by apt, as other answers here describe.

                      – nealmcb
                      Oct 23 '13 at 20:37











                      0














                      I needed to clean up disk space from Python packages safely. While this is a complete clean out of packages, I needed to move Python versions as well so I did not need old packages. I used the following to get all my package names, skip the first 2 lines and grab the first column, and uninstall without user interaction:



                      pip list | awk 'NR>2 {print $1}' | xargs -I {} pip uninstall -y {}





                      share|improve this answer




























                        0














                        I needed to clean up disk space from Python packages safely. While this is a complete clean out of packages, I needed to move Python versions as well so I did not need old packages. I used the following to get all my package names, skip the first 2 lines and grab the first column, and uninstall without user interaction:



                        pip list | awk 'NR>2 {print $1}' | xargs -I {} pip uninstall -y {}





                        share|improve this answer


























                          0












                          0








                          0







                          I needed to clean up disk space from Python packages safely. While this is a complete clean out of packages, I needed to move Python versions as well so I did not need old packages. I used the following to get all my package names, skip the first 2 lines and grab the first column, and uninstall without user interaction:



                          pip list | awk 'NR>2 {print $1}' | xargs -I {} pip uninstall -y {}





                          share|improve this answer













                          I needed to clean up disk space from Python packages safely. While this is a complete clean out of packages, I needed to move Python versions as well so I did not need old packages. I used the following to get all my package names, skip the first 2 lines and grab the first column, and uninstall without user interaction:



                          pip list | awk 'NR>2 {print $1}' | xargs -I {} pip uninstall -y {}






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Feb 4 at 0:12









                          m1st0m1st0

                          992




                          992























                              -1














                              This has something to do with Homebrew. I had no issues with pyodbc on my Mac Air until I installed Homebrew and used it for a few things. I found this thread on github that ends in a solution that worked for me.



                              "If you have Homebrew, just install the ODBC headers:



                              $ brew install unixodbc


                              and run "pip install pyodbc" again."



                              This 100% solved the problem for me and only took a moment. Give it a shot.






                              share|improve this answer


























                              • maybe you need to post this at Ask Different? apple.stackexchange.com

                                – d3vid
                                Jul 5 '17 at 11:58
















                              -1














                              This has something to do with Homebrew. I had no issues with pyodbc on my Mac Air until I installed Homebrew and used it for a few things. I found this thread on github that ends in a solution that worked for me.



                              "If you have Homebrew, just install the ODBC headers:



                              $ brew install unixodbc


                              and run "pip install pyodbc" again."



                              This 100% solved the problem for me and only took a moment. Give it a shot.






                              share|improve this answer


























                              • maybe you need to post this at Ask Different? apple.stackexchange.com

                                – d3vid
                                Jul 5 '17 at 11:58














                              -1












                              -1








                              -1







                              This has something to do with Homebrew. I had no issues with pyodbc on my Mac Air until I installed Homebrew and used it for a few things. I found this thread on github that ends in a solution that worked for me.



                              "If you have Homebrew, just install the ODBC headers:



                              $ brew install unixodbc


                              and run "pip install pyodbc" again."



                              This 100% solved the problem for me and only took a moment. Give it a shot.






                              share|improve this answer















                              This has something to do with Homebrew. I had no issues with pyodbc on my Mac Air until I installed Homebrew and used it for a few things. I found this thread on github that ends in a solution that worked for me.



                              "If you have Homebrew, just install the ODBC headers:



                              $ brew install unixodbc


                              and run "pip install pyodbc" again."



                              This 100% solved the problem for me and only took a moment. Give it a shot.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Jul 19 '17 at 12:55









                              Tshilidzi Mudau

                              3,67431727




                              3,67431727










                              answered Jul 4 '17 at 16:15









                              PogoPogo

                              1




                              1













                              • maybe you need to post this at Ask Different? apple.stackexchange.com

                                – d3vid
                                Jul 5 '17 at 11:58



















                              • maybe you need to post this at Ask Different? apple.stackexchange.com

                                – d3vid
                                Jul 5 '17 at 11:58

















                              maybe you need to post this at Ask Different? apple.stackexchange.com

                              – d3vid
                              Jul 5 '17 at 11:58





                              maybe you need to post this at Ask Different? apple.stackexchange.com

                              – d3vid
                              Jul 5 '17 at 11:58


















                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f173323%2fhow-do-i-detect-and-remove-python-packages-installed-via-pip%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              How to change which sound is reproduced for terminal bell?

                              Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                              Can I use Tabulator js library in my java Spring + Thymeleaf project?