Python setup.py install - remove previous version while updating2019 Community Moderator Electionpython setup.py uninstallHow can I remove a trailing newline in Python?How do I remove an element from a list by index in Python?How can I get a list of locally installed Python modules?Use different Python version with virtualenvpython setup.py uninstallpip install mysql-python fails with EnvironmentError: mysql_config not foundInstalling specific package versions with pipFind which version of package is installed with pipHow to remove a key from a Python dictionary?setup.py how NOT to keep multiple version of packages

Specifying a starting column with colortbl package and xcolor

Source permutation

MySQL importing CSV files really slow

What sort of fish is this

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

Expressing logarithmic equations without logs

Professor forcing me to attend a conference, I can't afford even with 50% funding

Are all players supposed to be able to see each others' character sheets?

This Alpine town?

Does a difference of tense count as a difference of meaning in a minimal pair?

Doubts in understanding some concepts of potential energy

ER diagram relationship node size adjustment

The meaning of ‘otherwise’

How exactly does an Ethernet collision happen in the cable, since nodes use different circuits for Tx and Rx?

What is this diamond of every day?

What are some noteworthy "mic-drop" moments in math?

Ballot RPC message

How many characters using PHB rules does it take to be able to have access to any PHB spell at the start of an adventuring day?

Confusion about Complex Continued Fraction

What will be the sign of work done?

In the late 1940’s to early 1950’s what technology was available that could melt ice?

What is the generally accepted pronunciation of “topoi”?

Is it possible that a question has only two answers?

Shifting between bemols and diesis in the key signature



Python setup.py install - remove previous version while updating



2019 Community Moderator Electionpython setup.py uninstallHow can I remove a trailing newline in Python?How do I remove an element from a list by index in Python?How can I get a list of locally installed Python modules?Use different Python version with virtualenvpython setup.py uninstallpip install mysql-python fails with EnvironmentError: mysql_config not foundInstalling specific package versions with pipFind which version of package is installed with pipHow to remove a key from a Python dictionary?setup.py how NOT to keep multiple version of packages










1















I have a setup.py script for my package which I install using
python ./setup.py install



What seems to happen is every time I increase the version, the old version is not removed in /usr/local/lib/python2.7/dist-packages so I see multiple versions.



Is there a way to set this up in a way that when a person updates, the old version gets removed?



There is a similar (but not quite) question on SO that asks how to uninstall a package in setup.py but I'm not really looking to uninstall as a separate option. I am looking for a clean 'update' process that removes old versions before installing new ones.



The other option is if I could just cleanly remove the version number from the installed package name, in which case I suppose it would overwrite, but I haven't been successful in doing that. If I remove version, it creates the package name with "0.0" which looks weird.



My setup script:



import io
import os
import sys

from setuptools import setup

#Package meta-data.
NAME = 'my_package'
DESCRIPTION = 'My description'
URL = 'https://github.com/myurl'
EMAIL = 'myemail@gmail.com'
AUTHOR = 'Me'
VERSION = '3.1.12'

setup(name = NAME,
version=VERSION,
py_modules = ['dir.mod1',
'dir.mod2',
]
)









share|improve this question




























    1















    I have a setup.py script for my package which I install using
    python ./setup.py install



    What seems to happen is every time I increase the version, the old version is not removed in /usr/local/lib/python2.7/dist-packages so I see multiple versions.



    Is there a way to set this up in a way that when a person updates, the old version gets removed?



    There is a similar (but not quite) question on SO that asks how to uninstall a package in setup.py but I'm not really looking to uninstall as a separate option. I am looking for a clean 'update' process that removes old versions before installing new ones.



    The other option is if I could just cleanly remove the version number from the installed package name, in which case I suppose it would overwrite, but I haven't been successful in doing that. If I remove version, it creates the package name with "0.0" which looks weird.



    My setup script:



    import io
    import os
    import sys

    from setuptools import setup

    #Package meta-data.
    NAME = 'my_package'
    DESCRIPTION = 'My description'
    URL = 'https://github.com/myurl'
    EMAIL = 'myemail@gmail.com'
    AUTHOR = 'Me'
    VERSION = '3.1.12'

    setup(name = NAME,
    version=VERSION,
    py_modules = ['dir.mod1',
    'dir.mod2',
    ]
    )









    share|improve this question


























      1












      1








      1








      I have a setup.py script for my package which I install using
      python ./setup.py install



      What seems to happen is every time I increase the version, the old version is not removed in /usr/local/lib/python2.7/dist-packages so I see multiple versions.



      Is there a way to set this up in a way that when a person updates, the old version gets removed?



      There is a similar (but not quite) question on SO that asks how to uninstall a package in setup.py but I'm not really looking to uninstall as a separate option. I am looking for a clean 'update' process that removes old versions before installing new ones.



      The other option is if I could just cleanly remove the version number from the installed package name, in which case I suppose it would overwrite, but I haven't been successful in doing that. If I remove version, it creates the package name with "0.0" which looks weird.



      My setup script:



      import io
      import os
      import sys

      from setuptools import setup

      #Package meta-data.
      NAME = 'my_package'
      DESCRIPTION = 'My description'
      URL = 'https://github.com/myurl'
      EMAIL = 'myemail@gmail.com'
      AUTHOR = 'Me'
      VERSION = '3.1.12'

      setup(name = NAME,
      version=VERSION,
      py_modules = ['dir.mod1',
      'dir.mod2',
      ]
      )









      share|improve this question
















      I have a setup.py script for my package which I install using
      python ./setup.py install



      What seems to happen is every time I increase the version, the old version is not removed in /usr/local/lib/python2.7/dist-packages so I see multiple versions.



      Is there a way to set this up in a way that when a person updates, the old version gets removed?



      There is a similar (but not quite) question on SO that asks how to uninstall a package in setup.py but I'm not really looking to uninstall as a separate option. I am looking for a clean 'update' process that removes old versions before installing new ones.



      The other option is if I could just cleanly remove the version number from the installed package name, in which case I suppose it would overwrite, but I haven't been successful in doing that. If I remove version, it creates the package name with "0.0" which looks weird.



      My setup script:



      import io
      import os
      import sys

      from setuptools import setup

      #Package meta-data.
      NAME = 'my_package'
      DESCRIPTION = 'My description'
      URL = 'https://github.com/myurl'
      EMAIL = 'myemail@gmail.com'
      AUTHOR = 'Me'
      VERSION = '3.1.12'

      setup(name = NAME,
      version=VERSION,
      py_modules = ['dir.mod1',
      'dir.mod2',
      ]
      )






      python pip setup.py






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 7 at 8:21









      Rene B.

      528521




      528521










      asked Mar 6 at 14:19









      user1361529user1361529

      9641231




      9641231






















          1 Answer
          1






          active

          oldest

          votes


















          1














          If you want to remove previous versions from your packages then you could use pip in the parent directory of your package. Lets assume your setup.py is in the directory my_package then you can use:



          pip install my_package --upgrade





          share|improve this answer

























          • force does not remove old versions. It only force overwrites the current version.

            – user1361529
            Mar 6 at 14:50











          • therefore you could use "pip install my_package --upgrade"

            – Rene B.
            Mar 6 at 15:40











          • Thanks for editing your answer. The pip based approach works just fine. I do think you should remove the force suggestion as an alternate. It doesn't do what the Q was asking

            – user1361529
            Mar 6 at 17:54











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          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%2fstackoverflow.com%2fquestions%2f55025277%2fpython-setup-py-install-remove-previous-version-while-updating%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          If you want to remove previous versions from your packages then you could use pip in the parent directory of your package. Lets assume your setup.py is in the directory my_package then you can use:



          pip install my_package --upgrade





          share|improve this answer

























          • force does not remove old versions. It only force overwrites the current version.

            – user1361529
            Mar 6 at 14:50











          • therefore you could use "pip install my_package --upgrade"

            – Rene B.
            Mar 6 at 15:40











          • Thanks for editing your answer. The pip based approach works just fine. I do think you should remove the force suggestion as an alternate. It doesn't do what the Q was asking

            – user1361529
            Mar 6 at 17:54
















          1














          If you want to remove previous versions from your packages then you could use pip in the parent directory of your package. Lets assume your setup.py is in the directory my_package then you can use:



          pip install my_package --upgrade





          share|improve this answer

























          • force does not remove old versions. It only force overwrites the current version.

            – user1361529
            Mar 6 at 14:50











          • therefore you could use "pip install my_package --upgrade"

            – Rene B.
            Mar 6 at 15:40











          • Thanks for editing your answer. The pip based approach works just fine. I do think you should remove the force suggestion as an alternate. It doesn't do what the Q was asking

            – user1361529
            Mar 6 at 17:54














          1












          1








          1







          If you want to remove previous versions from your packages then you could use pip in the parent directory of your package. Lets assume your setup.py is in the directory my_package then you can use:



          pip install my_package --upgrade





          share|improve this answer















          If you want to remove previous versions from your packages then you could use pip in the parent directory of your package. Lets assume your setup.py is in the directory my_package then you can use:



          pip install my_package --upgrade






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 6 at 18:06

























          answered Mar 6 at 14:34









          Rene B.Rene B.

          528521




          528521












          • force does not remove old versions. It only force overwrites the current version.

            – user1361529
            Mar 6 at 14:50











          • therefore you could use "pip install my_package --upgrade"

            – Rene B.
            Mar 6 at 15:40











          • Thanks for editing your answer. The pip based approach works just fine. I do think you should remove the force suggestion as an alternate. It doesn't do what the Q was asking

            – user1361529
            Mar 6 at 17:54


















          • force does not remove old versions. It only force overwrites the current version.

            – user1361529
            Mar 6 at 14:50











          • therefore you could use "pip install my_package --upgrade"

            – Rene B.
            Mar 6 at 15:40











          • Thanks for editing your answer. The pip based approach works just fine. I do think you should remove the force suggestion as an alternate. It doesn't do what the Q was asking

            – user1361529
            Mar 6 at 17:54

















          force does not remove old versions. It only force overwrites the current version.

          – user1361529
          Mar 6 at 14:50





          force does not remove old versions. It only force overwrites the current version.

          – user1361529
          Mar 6 at 14:50













          therefore you could use "pip install my_package --upgrade"

          – Rene B.
          Mar 6 at 15:40





          therefore you could use "pip install my_package --upgrade"

          – Rene B.
          Mar 6 at 15:40













          Thanks for editing your answer. The pip based approach works just fine. I do think you should remove the force suggestion as an alternate. It doesn't do what the Q was asking

          – user1361529
          Mar 6 at 17:54






          Thanks for editing your answer. The pip based approach works just fine. I do think you should remove the force suggestion as an alternate. It doesn't do what the Q was asking

          – user1361529
          Mar 6 at 17:54




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • 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%2fstackoverflow.com%2fquestions%2f55025277%2fpython-setup-py-install-remove-previous-version-while-updating%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

          AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

          Алба-Юлія

          Захаров Федір Захарович