Installing the python packages in virtual enviroment with sudo












1















Actually I came across the problem while trying to install mySQL on a Django development virtual environment.



pip install mysqlclient


I tried running sudo pip install mysqlclient. It runs well, but the package gets installed on the global environment. I thought it might require super-user permission to do that. Is there a way to install it on virtual-environment?



screenshot of error










share|improve this question

























  • What operating system are you using? You should not need sudo to install packages for Python, especially in a virtual environment.

    – slhck
    Dec 22 '18 at 9:59











  • I'm using linux mint. I tried running command sudo pip install mysqlclient. It works well but gets installed on global environment.

    – Surya Bhusal
    Dec 22 '18 at 10:00













  • Use pip install --user … to use a local directory. Or use Pyenv (github.com/pyenv/pyenv) to get a local Python installation where you can use pip without sudo.

    – slhck
    Dec 22 '18 at 15:55











  • Sorry to say that i'm a bit new to linux, can't get what you mean, i viewed the link provided by you, it seems a bit difficult for me to understand.

    – Surya Bhusal
    Dec 22 '18 at 19:22











  • Does pip install --user … work?

    – slhck
    Dec 23 '18 at 10:00
















1















Actually I came across the problem while trying to install mySQL on a Django development virtual environment.



pip install mysqlclient


I tried running sudo pip install mysqlclient. It runs well, but the package gets installed on the global environment. I thought it might require super-user permission to do that. Is there a way to install it on virtual-environment?



screenshot of error










share|improve this question

























  • What operating system are you using? You should not need sudo to install packages for Python, especially in a virtual environment.

    – slhck
    Dec 22 '18 at 9:59











  • I'm using linux mint. I tried running command sudo pip install mysqlclient. It works well but gets installed on global environment.

    – Surya Bhusal
    Dec 22 '18 at 10:00













  • Use pip install --user … to use a local directory. Or use Pyenv (github.com/pyenv/pyenv) to get a local Python installation where you can use pip without sudo.

    – slhck
    Dec 22 '18 at 15:55











  • Sorry to say that i'm a bit new to linux, can't get what you mean, i viewed the link provided by you, it seems a bit difficult for me to understand.

    – Surya Bhusal
    Dec 22 '18 at 19:22











  • Does pip install --user … work?

    – slhck
    Dec 23 '18 at 10:00














1












1








1








Actually I came across the problem while trying to install mySQL on a Django development virtual environment.



pip install mysqlclient


I tried running sudo pip install mysqlclient. It runs well, but the package gets installed on the global environment. I thought it might require super-user permission to do that. Is there a way to install it on virtual-environment?



screenshot of error










share|improve this question
















Actually I came across the problem while trying to install mySQL on a Django development virtual environment.



pip install mysqlclient


I tried running sudo pip install mysqlclient. It runs well, but the package gets installed on the global environment. I thought it might require super-user permission to do that. Is there a way to install it on virtual-environment?



screenshot of error







python mysql virtualenv






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 22 '18 at 11:33









Glorfindel

1,37441220




1,37441220










asked Dec 22 '18 at 9:53









Surya BhusalSurya Bhusal

65




65













  • What operating system are you using? You should not need sudo to install packages for Python, especially in a virtual environment.

    – slhck
    Dec 22 '18 at 9:59











  • I'm using linux mint. I tried running command sudo pip install mysqlclient. It works well but gets installed on global environment.

    – Surya Bhusal
    Dec 22 '18 at 10:00













  • Use pip install --user … to use a local directory. Or use Pyenv (github.com/pyenv/pyenv) to get a local Python installation where you can use pip without sudo.

    – slhck
    Dec 22 '18 at 15:55











  • Sorry to say that i'm a bit new to linux, can't get what you mean, i viewed the link provided by you, it seems a bit difficult for me to understand.

    – Surya Bhusal
    Dec 22 '18 at 19:22











  • Does pip install --user … work?

    – slhck
    Dec 23 '18 at 10:00



















  • What operating system are you using? You should not need sudo to install packages for Python, especially in a virtual environment.

    – slhck
    Dec 22 '18 at 9:59











  • I'm using linux mint. I tried running command sudo pip install mysqlclient. It works well but gets installed on global environment.

    – Surya Bhusal
    Dec 22 '18 at 10:00













  • Use pip install --user … to use a local directory. Or use Pyenv (github.com/pyenv/pyenv) to get a local Python installation where you can use pip without sudo.

    – slhck
    Dec 22 '18 at 15:55











  • Sorry to say that i'm a bit new to linux, can't get what you mean, i viewed the link provided by you, it seems a bit difficult for me to understand.

    – Surya Bhusal
    Dec 22 '18 at 19:22











  • Does pip install --user … work?

    – slhck
    Dec 23 '18 at 10:00

















What operating system are you using? You should not need sudo to install packages for Python, especially in a virtual environment.

– slhck
Dec 22 '18 at 9:59





What operating system are you using? You should not need sudo to install packages for Python, especially in a virtual environment.

– slhck
Dec 22 '18 at 9:59













I'm using linux mint. I tried running command sudo pip install mysqlclient. It works well but gets installed on global environment.

– Surya Bhusal
Dec 22 '18 at 10:00







I'm using linux mint. I tried running command sudo pip install mysqlclient. It works well but gets installed on global environment.

– Surya Bhusal
Dec 22 '18 at 10:00















Use pip install --user … to use a local directory. Or use Pyenv (github.com/pyenv/pyenv) to get a local Python installation where you can use pip without sudo.

– slhck
Dec 22 '18 at 15:55





Use pip install --user … to use a local directory. Or use Pyenv (github.com/pyenv/pyenv) to get a local Python installation where you can use pip without sudo.

– slhck
Dec 22 '18 at 15:55













Sorry to say that i'm a bit new to linux, can't get what you mean, i viewed the link provided by you, it seems a bit difficult for me to understand.

– Surya Bhusal
Dec 22 '18 at 19:22





Sorry to say that i'm a bit new to linux, can't get what you mean, i viewed the link provided by you, it seems a bit difficult for me to understand.

– Surya Bhusal
Dec 22 '18 at 19:22













Does pip install --user … work?

– slhck
Dec 23 '18 at 10:00





Does pip install --user … work?

– slhck
Dec 23 '18 at 10:00










1 Answer
1






active

oldest

votes


















0














Actually i forgot to mention the python version which i was using 3.6.7. I somehow managed to install the package on the python 3.5.6. Follow the sequence if you're having the same problem.



Install the additional support repository



sudo add-apt-repository ppa:deadsnakes/ppa


Run update:



sudo apt-get update


Install python 3.5(which works in my case):



sudo apt-get install python3.5


Install python3.5 dev



sudo apt-get install python3.5-dev


Create a virtual-enviroment with python3.5 and perform



pip install mysqlclient


And fortunately that works well!! Boom!!!






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    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%2fsuperuser.com%2fquestions%2f1386895%2finstalling-the-python-packages-in-virtual-enviroment-with-sudo%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














    Actually i forgot to mention the python version which i was using 3.6.7. I somehow managed to install the package on the python 3.5.6. Follow the sequence if you're having the same problem.



    Install the additional support repository



    sudo add-apt-repository ppa:deadsnakes/ppa


    Run update:



    sudo apt-get update


    Install python 3.5(which works in my case):



    sudo apt-get install python3.5


    Install python3.5 dev



    sudo apt-get install python3.5-dev


    Create a virtual-enviroment with python3.5 and perform



    pip install mysqlclient


    And fortunately that works well!! Boom!!!






    share|improve this answer




























      0














      Actually i forgot to mention the python version which i was using 3.6.7. I somehow managed to install the package on the python 3.5.6. Follow the sequence if you're having the same problem.



      Install the additional support repository



      sudo add-apt-repository ppa:deadsnakes/ppa


      Run update:



      sudo apt-get update


      Install python 3.5(which works in my case):



      sudo apt-get install python3.5


      Install python3.5 dev



      sudo apt-get install python3.5-dev


      Create a virtual-enviroment with python3.5 and perform



      pip install mysqlclient


      And fortunately that works well!! Boom!!!






      share|improve this answer


























        0












        0








        0







        Actually i forgot to mention the python version which i was using 3.6.7. I somehow managed to install the package on the python 3.5.6. Follow the sequence if you're having the same problem.



        Install the additional support repository



        sudo add-apt-repository ppa:deadsnakes/ppa


        Run update:



        sudo apt-get update


        Install python 3.5(which works in my case):



        sudo apt-get install python3.5


        Install python3.5 dev



        sudo apt-get install python3.5-dev


        Create a virtual-enviroment with python3.5 and perform



        pip install mysqlclient


        And fortunately that works well!! Boom!!!






        share|improve this answer













        Actually i forgot to mention the python version which i was using 3.6.7. I somehow managed to install the package on the python 3.5.6. Follow the sequence if you're having the same problem.



        Install the additional support repository



        sudo add-apt-repository ppa:deadsnakes/ppa


        Run update:



        sudo apt-get update


        Install python 3.5(which works in my case):



        sudo apt-get install python3.5


        Install python3.5 dev



        sudo apt-get install python3.5-dev


        Create a virtual-enviroment with python3.5 and perform



        pip install mysqlclient


        And fortunately that works well!! Boom!!!







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 23 '18 at 16:24









        Surya BhusalSurya Bhusal

        65




        65






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • 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%2fsuperuser.com%2fquestions%2f1386895%2finstalling-the-python-packages-in-virtual-enviroment-with-sudo%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

            If I really need a card on my start hand, how many mulligans make sense? [duplicate]

            Alcedinidae

            Can an atomic nucleus contain both particles and antiparticles? [duplicate]