Migrate anaconda from python v3.6 to v3.7 and preserve all conda and pip packages










6















The latest anaconda distribution released on Sep2018 uses python v3.7. My existing anaconda distribution uses python v3.6



I would like to upgrade to this latest distribution which uses python v3.7. When I tried to install from the Windows installation executable file, there is no smooth upgrade. If I were to do a clean reinstall, I will have re-install all the conda and pip packages outside of the standard anaconda distribution that I am currently using.



How can I do an anaconda upgrade while preserving all these conda and pip packages that I am currently using that are out of the standard anaconda distribution?



I tried the following command;



conda list --explicit > environment_backup.txt


environment_backup.txt does not seem to contain the pip packages that I have installed.



I am fine if all the conda and pip packages cannot be preserved during the upgrade. However, I would like to have a convenient way to reinstall these conda and pip packages after the new version has been installed. It will be inconvenient if I have to run conda install XXX or pip install XXX commands individually.










share|improve this question






















  • You can't, not without at least re-installing all packages that require compilation into machine code. The Pure Python packages also benefit from having the .py files compiled to .pyc files, which are tied to the major.minor version too.

    – Martijn Pieters
    Nov 17 '18 at 12:58











  • @Martijn Pieters, So, there is no way to avoid doing conda install XXX and pip install XXX individually?

    – user781486
    Nov 17 '18 at 13:00







  • 1





    I didn't say that :-) You will have to re-install, but I'm sure conda can be made to list your installed packages and environments, and per environment, pip freeze can be made to list the currently installed packages so you can re-install them after upgrading.

    – Martijn Pieters
    Nov 17 '18 at 14:10















6















The latest anaconda distribution released on Sep2018 uses python v3.7. My existing anaconda distribution uses python v3.6



I would like to upgrade to this latest distribution which uses python v3.7. When I tried to install from the Windows installation executable file, there is no smooth upgrade. If I were to do a clean reinstall, I will have re-install all the conda and pip packages outside of the standard anaconda distribution that I am currently using.



How can I do an anaconda upgrade while preserving all these conda and pip packages that I am currently using that are out of the standard anaconda distribution?



I tried the following command;



conda list --explicit > environment_backup.txt


environment_backup.txt does not seem to contain the pip packages that I have installed.



I am fine if all the conda and pip packages cannot be preserved during the upgrade. However, I would like to have a convenient way to reinstall these conda and pip packages after the new version has been installed. It will be inconvenient if I have to run conda install XXX or pip install XXX commands individually.










share|improve this question






















  • You can't, not without at least re-installing all packages that require compilation into machine code. The Pure Python packages also benefit from having the .py files compiled to .pyc files, which are tied to the major.minor version too.

    – Martijn Pieters
    Nov 17 '18 at 12:58











  • @Martijn Pieters, So, there is no way to avoid doing conda install XXX and pip install XXX individually?

    – user781486
    Nov 17 '18 at 13:00







  • 1





    I didn't say that :-) You will have to re-install, but I'm sure conda can be made to list your installed packages and environments, and per environment, pip freeze can be made to list the currently installed packages so you can re-install them after upgrading.

    – Martijn Pieters
    Nov 17 '18 at 14:10













6












6








6








The latest anaconda distribution released on Sep2018 uses python v3.7. My existing anaconda distribution uses python v3.6



I would like to upgrade to this latest distribution which uses python v3.7. When I tried to install from the Windows installation executable file, there is no smooth upgrade. If I were to do a clean reinstall, I will have re-install all the conda and pip packages outside of the standard anaconda distribution that I am currently using.



How can I do an anaconda upgrade while preserving all these conda and pip packages that I am currently using that are out of the standard anaconda distribution?



I tried the following command;



conda list --explicit > environment_backup.txt


environment_backup.txt does not seem to contain the pip packages that I have installed.



I am fine if all the conda and pip packages cannot be preserved during the upgrade. However, I would like to have a convenient way to reinstall these conda and pip packages after the new version has been installed. It will be inconvenient if I have to run conda install XXX or pip install XXX commands individually.










share|improve this question














The latest anaconda distribution released on Sep2018 uses python v3.7. My existing anaconda distribution uses python v3.6



I would like to upgrade to this latest distribution which uses python v3.7. When I tried to install from the Windows installation executable file, there is no smooth upgrade. If I were to do a clean reinstall, I will have re-install all the conda and pip packages outside of the standard anaconda distribution that I am currently using.



How can I do an anaconda upgrade while preserving all these conda and pip packages that I am currently using that are out of the standard anaconda distribution?



I tried the following command;



conda list --explicit > environment_backup.txt


environment_backup.txt does not seem to contain the pip packages that I have installed.



I am fine if all the conda and pip packages cannot be preserved during the upgrade. However, I would like to have a convenient way to reinstall these conda and pip packages after the new version has been installed. It will be inconvenient if I have to run conda install XXX or pip install XXX commands individually.







python python-3.x anaconda conda






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 11:31









user781486user781486

7,5502582191




7,5502582191












  • You can't, not without at least re-installing all packages that require compilation into machine code. The Pure Python packages also benefit from having the .py files compiled to .pyc files, which are tied to the major.minor version too.

    – Martijn Pieters
    Nov 17 '18 at 12:58











  • @Martijn Pieters, So, there is no way to avoid doing conda install XXX and pip install XXX individually?

    – user781486
    Nov 17 '18 at 13:00







  • 1





    I didn't say that :-) You will have to re-install, but I'm sure conda can be made to list your installed packages and environments, and per environment, pip freeze can be made to list the currently installed packages so you can re-install them after upgrading.

    – Martijn Pieters
    Nov 17 '18 at 14:10

















  • You can't, not without at least re-installing all packages that require compilation into machine code. The Pure Python packages also benefit from having the .py files compiled to .pyc files, which are tied to the major.minor version too.

    – Martijn Pieters
    Nov 17 '18 at 12:58











  • @Martijn Pieters, So, there is no way to avoid doing conda install XXX and pip install XXX individually?

    – user781486
    Nov 17 '18 at 13:00







  • 1





    I didn't say that :-) You will have to re-install, but I'm sure conda can be made to list your installed packages and environments, and per environment, pip freeze can be made to list the currently installed packages so you can re-install them after upgrading.

    – Martijn Pieters
    Nov 17 '18 at 14:10
















You can't, not without at least re-installing all packages that require compilation into machine code. The Pure Python packages also benefit from having the .py files compiled to .pyc files, which are tied to the major.minor version too.

– Martijn Pieters
Nov 17 '18 at 12:58





You can't, not without at least re-installing all packages that require compilation into machine code. The Pure Python packages also benefit from having the .py files compiled to .pyc files, which are tied to the major.minor version too.

– Martijn Pieters
Nov 17 '18 at 12:58













@Martijn Pieters, So, there is no way to avoid doing conda install XXX and pip install XXX individually?

– user781486
Nov 17 '18 at 13:00






@Martijn Pieters, So, there is no way to avoid doing conda install XXX and pip install XXX individually?

– user781486
Nov 17 '18 at 13:00





1




1





I didn't say that :-) You will have to re-install, but I'm sure conda can be made to list your installed packages and environments, and per environment, pip freeze can be made to list the currently installed packages so you can re-install them after upgrading.

– Martijn Pieters
Nov 17 '18 at 14:10





I didn't say that :-) You will have to re-install, but I'm sure conda can be made to list your installed packages and environments, and per environment, pip freeze can be made to list the currently installed packages so you can re-install them after upgrading.

– Martijn Pieters
Nov 17 '18 at 14:10












3 Answers
3






active

oldest

votes


















3





+50









For the pip installed packages, you can similarly freeze your packages in a requirements.txt file and apply them in the new python version:



pip freeze > requirements.txt


Or to only freeze local packages



pip freeze -l > requirements.txt


To restore the pip packages:



pip install -r requirements.txt





share|improve this answer






























    3














    conda env exoprt and import are your friends!
    From the conda docs:



    conda env export > environment.yml


    And then:



    conda create --name myenv --file environment.yml


    This does reinstall all packages but you know exactly which ones you had, including pip packages.






    share|improve this answer






























      0














      You can update python with conda using:



      conda update python


      Make sure your conda also up to date by running



      conda update conda


      Alternatively you can create new enviroment and use the latest python by using.



      conda create --name python37 python=3.7


      And activate it with source activate python37 in macOS or activate python37 in windows (make sure to use Anaconda Prompt).






      share|improve this answer


















      • 4





        Unfortunately, this will not migrate pip installed packages, as far as I know, because the site-packages directory changes and conda doesn't migrate pip-installed packages...

        – darthbith
        Nov 15 '18 at 14:34






      • 1





        I have verified that the pip-installed packages will not be migrated.

        – user781486
        Nov 15 '18 at 23:39











      • This will not migrate packages.

        – Martijn Pieters
        Nov 17 '18 at 12:58










      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%2f53318517%2fmigrate-anaconda-from-python-v3-6-to-v3-7-and-preserve-all-conda-and-pip-package%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3





      +50









      For the pip installed packages, you can similarly freeze your packages in a requirements.txt file and apply them in the new python version:



      pip freeze > requirements.txt


      Or to only freeze local packages



      pip freeze -l > requirements.txt


      To restore the pip packages:



      pip install -r requirements.txt





      share|improve this answer



























        3





        +50









        For the pip installed packages, you can similarly freeze your packages in a requirements.txt file and apply them in the new python version:



        pip freeze > requirements.txt


        Or to only freeze local packages



        pip freeze -l > requirements.txt


        To restore the pip packages:



        pip install -r requirements.txt





        share|improve this answer

























          3





          +50







          3





          +50



          3




          +50





          For the pip installed packages, you can similarly freeze your packages in a requirements.txt file and apply them in the new python version:



          pip freeze > requirements.txt


          Or to only freeze local packages



          pip freeze -l > requirements.txt


          To restore the pip packages:



          pip install -r requirements.txt





          share|improve this answer













          For the pip installed packages, you can similarly freeze your packages in a requirements.txt file and apply them in the new python version:



          pip freeze > requirements.txt


          Or to only freeze local packages



          pip freeze -l > requirements.txt


          To restore the pip packages:



          pip install -r requirements.txt






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 19 '18 at 22:01









          Yacine FilaliYacine Filali

          1,4371217




          1,4371217























              3














              conda env exoprt and import are your friends!
              From the conda docs:



              conda env export > environment.yml


              And then:



              conda create --name myenv --file environment.yml


              This does reinstall all packages but you know exactly which ones you had, including pip packages.






              share|improve this answer



























                3














                conda env exoprt and import are your friends!
                From the conda docs:



                conda env export > environment.yml


                And then:



                conda create --name myenv --file environment.yml


                This does reinstall all packages but you know exactly which ones you had, including pip packages.






                share|improve this answer

























                  3












                  3








                  3







                  conda env exoprt and import are your friends!
                  From the conda docs:



                  conda env export > environment.yml


                  And then:



                  conda create --name myenv --file environment.yml


                  This does reinstall all packages but you know exactly which ones you had, including pip packages.






                  share|improve this answer













                  conda env exoprt and import are your friends!
                  From the conda docs:



                  conda env export > environment.yml


                  And then:



                  conda create --name myenv --file environment.yml


                  This does reinstall all packages but you know exactly which ones you had, including pip packages.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 20 '18 at 21:06









                  roeen30roeen30

                  46629




                  46629





















                      0














                      You can update python with conda using:



                      conda update python


                      Make sure your conda also up to date by running



                      conda update conda


                      Alternatively you can create new enviroment and use the latest python by using.



                      conda create --name python37 python=3.7


                      And activate it with source activate python37 in macOS or activate python37 in windows (make sure to use Anaconda Prompt).






                      share|improve this answer


















                      • 4





                        Unfortunately, this will not migrate pip installed packages, as far as I know, because the site-packages directory changes and conda doesn't migrate pip-installed packages...

                        – darthbith
                        Nov 15 '18 at 14:34






                      • 1





                        I have verified that the pip-installed packages will not be migrated.

                        – user781486
                        Nov 15 '18 at 23:39











                      • This will not migrate packages.

                        – Martijn Pieters
                        Nov 17 '18 at 12:58















                      0














                      You can update python with conda using:



                      conda update python


                      Make sure your conda also up to date by running



                      conda update conda


                      Alternatively you can create new enviroment and use the latest python by using.



                      conda create --name python37 python=3.7


                      And activate it with source activate python37 in macOS or activate python37 in windows (make sure to use Anaconda Prompt).






                      share|improve this answer


















                      • 4





                        Unfortunately, this will not migrate pip installed packages, as far as I know, because the site-packages directory changes and conda doesn't migrate pip-installed packages...

                        – darthbith
                        Nov 15 '18 at 14:34






                      • 1





                        I have verified that the pip-installed packages will not be migrated.

                        – user781486
                        Nov 15 '18 at 23:39











                      • This will not migrate packages.

                        – Martijn Pieters
                        Nov 17 '18 at 12:58













                      0












                      0








                      0







                      You can update python with conda using:



                      conda update python


                      Make sure your conda also up to date by running



                      conda update conda


                      Alternatively you can create new enviroment and use the latest python by using.



                      conda create --name python37 python=3.7


                      And activate it with source activate python37 in macOS or activate python37 in windows (make sure to use Anaconda Prompt).






                      share|improve this answer













                      You can update python with conda using:



                      conda update python


                      Make sure your conda also up to date by running



                      conda update conda


                      Alternatively you can create new enviroment and use the latest python by using.



                      conda create --name python37 python=3.7


                      And activate it with source activate python37 in macOS or activate python37 in windows (make sure to use Anaconda Prompt).







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 15 '18 at 13:07









                      Baran BuluttekinBaran Buluttekin

                      111




                      111







                      • 4





                        Unfortunately, this will not migrate pip installed packages, as far as I know, because the site-packages directory changes and conda doesn't migrate pip-installed packages...

                        – darthbith
                        Nov 15 '18 at 14:34






                      • 1





                        I have verified that the pip-installed packages will not be migrated.

                        – user781486
                        Nov 15 '18 at 23:39











                      • This will not migrate packages.

                        – Martijn Pieters
                        Nov 17 '18 at 12:58












                      • 4





                        Unfortunately, this will not migrate pip installed packages, as far as I know, because the site-packages directory changes and conda doesn't migrate pip-installed packages...

                        – darthbith
                        Nov 15 '18 at 14:34






                      • 1





                        I have verified that the pip-installed packages will not be migrated.

                        – user781486
                        Nov 15 '18 at 23:39











                      • This will not migrate packages.

                        – Martijn Pieters
                        Nov 17 '18 at 12:58







                      4




                      4





                      Unfortunately, this will not migrate pip installed packages, as far as I know, because the site-packages directory changes and conda doesn't migrate pip-installed packages...

                      – darthbith
                      Nov 15 '18 at 14:34





                      Unfortunately, this will not migrate pip installed packages, as far as I know, because the site-packages directory changes and conda doesn't migrate pip-installed packages...

                      – darthbith
                      Nov 15 '18 at 14:34




                      1




                      1





                      I have verified that the pip-installed packages will not be migrated.

                      – user781486
                      Nov 15 '18 at 23:39





                      I have verified that the pip-installed packages will not be migrated.

                      – user781486
                      Nov 15 '18 at 23:39













                      This will not migrate packages.

                      – Martijn Pieters
                      Nov 17 '18 at 12:58





                      This will not migrate packages.

                      – Martijn Pieters
                      Nov 17 '18 at 12:58

















                      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%2f53318517%2fmigrate-anaconda-from-python-v3-6-to-v3-7-and-preserve-all-conda-and-pip-package%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







                      這個網誌中的熱門文章

                      How to read a connectionString WITH PROVIDER in .NET Core?

                      In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

                      Museum of Modern and Contemporary Art of Trento and Rovereto