Switch between two versions of python in the same environment












1















I need to build a pipeline which was written in python 2.7. A few dependencies like matplotlib have been upgraded since then to work with Python 3.x, but the original pipeline code is incompatible with python 3.x syntax. While building, I am unable to use Python 2.7 as matplotlib and thereby mayavi refuse to be installed after that. And if I build everything using Python 3.x the final code does not execute because the code is incompatible with python 3.x.



The pipeline I need to run is https://github.com/aestrivex/ielu



Please help.










share|improve this question







New contributor




Newbie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • This sounds like an XY problem. Why exactly can't you use matplotlib in python 2.7? What is your Ubuntu version? are you using the OS default python, or a 3rd party installation such as anaconda?

    – steeldriver
    Jan 9 at 3:38











  • @steeldriver looks like the repo mentioned wants to use anaconda

    – Scott Stensland
    Jan 11 at 1:17











  • one possible course of action is to clone that repo and upgrade it to python3 then submit a pull request back to the repo ... however as @steeldriver suggests its probably easier to write your new code using python 2.7

    – Scott Stensland
    Jan 11 at 1:19
















1















I need to build a pipeline which was written in python 2.7. A few dependencies like matplotlib have been upgraded since then to work with Python 3.x, but the original pipeline code is incompatible with python 3.x syntax. While building, I am unable to use Python 2.7 as matplotlib and thereby mayavi refuse to be installed after that. And if I build everything using Python 3.x the final code does not execute because the code is incompatible with python 3.x.



The pipeline I need to run is https://github.com/aestrivex/ielu



Please help.










share|improve this question







New contributor




Newbie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • This sounds like an XY problem. Why exactly can't you use matplotlib in python 2.7? What is your Ubuntu version? are you using the OS default python, or a 3rd party installation such as anaconda?

    – steeldriver
    Jan 9 at 3:38











  • @steeldriver looks like the repo mentioned wants to use anaconda

    – Scott Stensland
    Jan 11 at 1:17











  • one possible course of action is to clone that repo and upgrade it to python3 then submit a pull request back to the repo ... however as @steeldriver suggests its probably easier to write your new code using python 2.7

    – Scott Stensland
    Jan 11 at 1:19














1












1








1








I need to build a pipeline which was written in python 2.7. A few dependencies like matplotlib have been upgraded since then to work with Python 3.x, but the original pipeline code is incompatible with python 3.x syntax. While building, I am unable to use Python 2.7 as matplotlib and thereby mayavi refuse to be installed after that. And if I build everything using Python 3.x the final code does not execute because the code is incompatible with python 3.x.



The pipeline I need to run is https://github.com/aestrivex/ielu



Please help.










share|improve this question







New contributor




Newbie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I need to build a pipeline which was written in python 2.7. A few dependencies like matplotlib have been upgraded since then to work with Python 3.x, but the original pipeline code is incompatible with python 3.x syntax. While building, I am unable to use Python 2.7 as matplotlib and thereby mayavi refuse to be installed after that. And if I build everything using Python 3.x the final code does not execute because the code is incompatible with python 3.x.



The pipeline I need to run is https://github.com/aestrivex/ielu



Please help.







python






share|improve this question







New contributor




Newbie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Newbie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Newbie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Jan 9 at 2:20









NewbieNewbie

61




61




New contributor




Newbie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Newbie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Newbie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • This sounds like an XY problem. Why exactly can't you use matplotlib in python 2.7? What is your Ubuntu version? are you using the OS default python, or a 3rd party installation such as anaconda?

    – steeldriver
    Jan 9 at 3:38











  • @steeldriver looks like the repo mentioned wants to use anaconda

    – Scott Stensland
    Jan 11 at 1:17











  • one possible course of action is to clone that repo and upgrade it to python3 then submit a pull request back to the repo ... however as @steeldriver suggests its probably easier to write your new code using python 2.7

    – Scott Stensland
    Jan 11 at 1:19



















  • This sounds like an XY problem. Why exactly can't you use matplotlib in python 2.7? What is your Ubuntu version? are you using the OS default python, or a 3rd party installation such as anaconda?

    – steeldriver
    Jan 9 at 3:38











  • @steeldriver looks like the repo mentioned wants to use anaconda

    – Scott Stensland
    Jan 11 at 1:17











  • one possible course of action is to clone that repo and upgrade it to python3 then submit a pull request back to the repo ... however as @steeldriver suggests its probably easier to write your new code using python 2.7

    – Scott Stensland
    Jan 11 at 1:19

















This sounds like an XY problem. Why exactly can't you use matplotlib in python 2.7? What is your Ubuntu version? are you using the OS default python, or a 3rd party installation such as anaconda?

– steeldriver
Jan 9 at 3:38





This sounds like an XY problem. Why exactly can't you use matplotlib in python 2.7? What is your Ubuntu version? are you using the OS default python, or a 3rd party installation such as anaconda?

– steeldriver
Jan 9 at 3:38













@steeldriver looks like the repo mentioned wants to use anaconda

– Scott Stensland
Jan 11 at 1:17





@steeldriver looks like the repo mentioned wants to use anaconda

– Scott Stensland
Jan 11 at 1:17













one possible course of action is to clone that repo and upgrade it to python3 then submit a pull request back to the repo ... however as @steeldriver suggests its probably easier to write your new code using python 2.7

– Scott Stensland
Jan 11 at 1:19





one possible course of action is to clone that repo and upgrade it to python3 then submit a pull request back to the repo ... however as @steeldriver suggests its probably easier to write your new code using python 2.7

– Scott Stensland
Jan 11 at 1:19










1 Answer
1






active

oldest

votes


















0














You can use pyenv to switch between python versions.



# Get Pyenv
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

# add pyenv to ~/.bashrc
echo -e "export PATH="/root/.pyenv/bin:$PATH" n eval "$(pyenv init -)" n eval "$(pyenv virtualenv-init -)" " >> ~/.bashrc

source ~/.bashrc

# install python 3 via pyenv
pyenv install 3.5.6

# verify
pyenv versions

# pyenv local <version> : use this to set python version per directory.
# pyenv gloal <version> : use this to set python version globally.





share|improve this answer

























    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
    });


    }
    });






    Newbie is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1108166%2fswitch-between-two-versions-of-python-in-the-same-environment%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









    0














    You can use pyenv to switch between python versions.



    # Get Pyenv
    curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

    # add pyenv to ~/.bashrc
    echo -e "export PATH="/root/.pyenv/bin:$PATH" n eval "$(pyenv init -)" n eval "$(pyenv virtualenv-init -)" " >> ~/.bashrc

    source ~/.bashrc

    # install python 3 via pyenv
    pyenv install 3.5.6

    # verify
    pyenv versions

    # pyenv local <version> : use this to set python version per directory.
    # pyenv gloal <version> : use this to set python version globally.





    share|improve this answer






























      0














      You can use pyenv to switch between python versions.



      # Get Pyenv
      curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

      # add pyenv to ~/.bashrc
      echo -e "export PATH="/root/.pyenv/bin:$PATH" n eval "$(pyenv init -)" n eval "$(pyenv virtualenv-init -)" " >> ~/.bashrc

      source ~/.bashrc

      # install python 3 via pyenv
      pyenv install 3.5.6

      # verify
      pyenv versions

      # pyenv local <version> : use this to set python version per directory.
      # pyenv gloal <version> : use this to set python version globally.





      share|improve this answer




























        0












        0








        0







        You can use pyenv to switch between python versions.



        # Get Pyenv
        curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

        # add pyenv to ~/.bashrc
        echo -e "export PATH="/root/.pyenv/bin:$PATH" n eval "$(pyenv init -)" n eval "$(pyenv virtualenv-init -)" " >> ~/.bashrc

        source ~/.bashrc

        # install python 3 via pyenv
        pyenv install 3.5.6

        # verify
        pyenv versions

        # pyenv local <version> : use this to set python version per directory.
        # pyenv gloal <version> : use this to set python version globally.





        share|improve this answer















        You can use pyenv to switch between python versions.



        # Get Pyenv
        curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

        # add pyenv to ~/.bashrc
        echo -e "export PATH="/root/.pyenv/bin:$PATH" n eval "$(pyenv init -)" n eval "$(pyenv virtualenv-init -)" " >> ~/.bashrc

        source ~/.bashrc

        # install python 3 via pyenv
        pyenv install 3.5.6

        # verify
        pyenv versions

        # pyenv local <version> : use this to set python version per directory.
        # pyenv gloal <version> : use this to set python version globally.






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 11 at 2:09









        wjandrea

        8,49742259




        8,49742259










        answered Jan 11 at 0:27









        rɑːdʒɑrɑːdʒɑ

        57.2k84217301




        57.2k84217301






















            Newbie is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            Newbie is a new contributor. Be nice, and check out our Code of Conduct.













            Newbie is a new contributor. Be nice, and check out our Code of Conduct.












            Newbie is a new contributor. Be nice, and check out our Code of Conduct.
















            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%2f1108166%2fswitch-between-two-versions-of-python-in-the-same-environment%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 make a Squid Proxy server?

            Is this a new Fibonacci Identity?

            Touch on Surface Book