PIP not installing to virtualenv directoryubuntu 11.04 install mysqldb for custom python2.5virtualenv gcc error MySQL-pythonPython eggs are not imported for Apache2 mod_wsgiError while installing with Python “pip”: Cannot fetch index base URL http://Python's 3.4a LEFOVERSHow do I re-compile python?How should virtualenv be set up in a production Web server (user, location, etc.)Django 1.10.3 Apache wsgi - ImportError: cannot import name signalsLinux “which virtualenv-2.7” shows a repeating pathError when trying install mod_wsgi using pip

As programers say: Strive to be lazy

Help in identifying a mystery wall socket

What kind of SATA connector is this?

What episode was being referenced by this part of Discovery's season 2 episode 13 recap?

Solubility in different pressure conditions

what does a native speaker say when he wanted to leave his work?

Is there anything special about -1 (0xFFFFFFFF) regarding ADC?

Safety when modifying old electrical work

Why do I get two different answers when solving for arclength?

Why is tomato paste so cheap?

What's the difference between "за ... от" and "в ... от"?

Is taking modulus on both sides of an equation valid?

Why was Endgame Thanos so different than Infinity War Thanos?

Do I need to say 'o`clock'?

Does SQL Server allow (make visible) DDL inside a transaction to the transaction prior to commit?

Entering the UK as a British citizen who is a Canadian permanent resident

Why is it harder to turn a motor/generator with shorted terminals?

Area under the curve - Integrals (Antiderivatives)

What is the best way for a skeleton to impersonate human without using magic?

Was this character’s old age look CGI or make-up?

Why does my circuit work on a breadboard, but not on a perfboard? I am new to soldering

How can a layman easily get the consensus view of what academia *thinks* about a subject?

What to do if SUS scores contradict qualitative feedback?

Smallest Guaranteed hash collision cycle length



PIP not installing to virtualenv directory


ubuntu 11.04 install mysqldb for custom python2.5virtualenv gcc error MySQL-pythonPython eggs are not imported for Apache2 mod_wsgiError while installing with Python “pip”: Cannot fetch index base URL http://Python's 3.4a LEFOVERSHow do I re-compile python?How should virtualenv be set up in a production Web server (user, location, etc.)Django 1.10.3 Apache wsgi - ImportError: cannot import name signalsLinux “which virtualenv-2.7” shows a repeating pathError when trying install mod_wsgi using pip






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








7















I am attempting to install django to a virtualenv that already exists.



Following the instructions listed on the pip-install website here, I ran the following from SSH.



name@server:~$ . myenv.env/bin/activate
(myenv.env)nam@server:~$ pip install django


However at the bottom of the installation, I am seeing this:



creating /usr/local/lib/python2.7/dist-packages/django

error: could not create '/usr/local/lib/python2.7/dist-packages/django': Permission denied


It appears that it is trying to install it to the global directory. I do not have sudo privileges. Am I doing something wrong here?



Update:
$PATH = /var/django/myenv.env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games










share|improve this question
























  • Does it work correctly for other packages? Do you have the same problem if you use easy_install?

    – larsks
    Jul 26 '13 at 17:28











  • Same problem with other packages. And I believe easy_install requires sudo and would install into the global directory.

    – Luke Sapan
    Jul 26 '13 at 17:53











  • Nope, setting up a virtualenv gets you easy_install as well as pip. You can type which easy_install to see if you're using your virtualenv or the system one.

    – larsks
    Jul 26 '13 at 17:55












  • Actually, are you sure you're running pip from inside the virtualenv? What does which pip yield? And do you see pip inside myenv.env/bin/?

    – larsks
    Jul 26 '13 at 17:56












  • I do see pip inside of myenv.env/bin/. I just tried "activating" my env again, and despite being in that mode, "which pip" and "which easy_install" both return "usr/local/bin/pip" and "usr/bin/easy_install" respectively.

    – Luke Sapan
    Jul 26 '13 at 18:20

















7















I am attempting to install django to a virtualenv that already exists.



Following the instructions listed on the pip-install website here, I ran the following from SSH.



name@server:~$ . myenv.env/bin/activate
(myenv.env)nam@server:~$ pip install django


However at the bottom of the installation, I am seeing this:



creating /usr/local/lib/python2.7/dist-packages/django

error: could not create '/usr/local/lib/python2.7/dist-packages/django': Permission denied


It appears that it is trying to install it to the global directory. I do not have sudo privileges. Am I doing something wrong here?



Update:
$PATH = /var/django/myenv.env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games










share|improve this question
























  • Does it work correctly for other packages? Do you have the same problem if you use easy_install?

    – larsks
    Jul 26 '13 at 17:28











  • Same problem with other packages. And I believe easy_install requires sudo and would install into the global directory.

    – Luke Sapan
    Jul 26 '13 at 17:53











  • Nope, setting up a virtualenv gets you easy_install as well as pip. You can type which easy_install to see if you're using your virtualenv or the system one.

    – larsks
    Jul 26 '13 at 17:55












  • Actually, are you sure you're running pip from inside the virtualenv? What does which pip yield? And do you see pip inside myenv.env/bin/?

    – larsks
    Jul 26 '13 at 17:56












  • I do see pip inside of myenv.env/bin/. I just tried "activating" my env again, and despite being in that mode, "which pip" and "which easy_install" both return "usr/local/bin/pip" and "usr/bin/easy_install" respectively.

    – Luke Sapan
    Jul 26 '13 at 18:20













7












7








7








I am attempting to install django to a virtualenv that already exists.



Following the instructions listed on the pip-install website here, I ran the following from SSH.



name@server:~$ . myenv.env/bin/activate
(myenv.env)nam@server:~$ pip install django


However at the bottom of the installation, I am seeing this:



creating /usr/local/lib/python2.7/dist-packages/django

error: could not create '/usr/local/lib/python2.7/dist-packages/django': Permission denied


It appears that it is trying to install it to the global directory. I do not have sudo privileges. Am I doing something wrong here?



Update:
$PATH = /var/django/myenv.env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games










share|improve this question
















I am attempting to install django to a virtualenv that already exists.



Following the instructions listed on the pip-install website here, I ran the following from SSH.



name@server:~$ . myenv.env/bin/activate
(myenv.env)nam@server:~$ pip install django


However at the bottom of the installation, I am seeing this:



creating /usr/local/lib/python2.7/dist-packages/django

error: could not create '/usr/local/lib/python2.7/dist-packages/django': Permission denied


It appears that it is trying to install it to the global directory. I do not have sudo privileges. Am I doing something wrong here?



Update:
$PATH = /var/django/myenv.env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games







python installation packages virtualenv pip






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 26 '13 at 18:40







Luke Sapan

















asked Jul 26 '13 at 17:21









Luke SapanLuke Sapan

621111




621111












  • Does it work correctly for other packages? Do you have the same problem if you use easy_install?

    – larsks
    Jul 26 '13 at 17:28











  • Same problem with other packages. And I believe easy_install requires sudo and would install into the global directory.

    – Luke Sapan
    Jul 26 '13 at 17:53











  • Nope, setting up a virtualenv gets you easy_install as well as pip. You can type which easy_install to see if you're using your virtualenv or the system one.

    – larsks
    Jul 26 '13 at 17:55












  • Actually, are you sure you're running pip from inside the virtualenv? What does which pip yield? And do you see pip inside myenv.env/bin/?

    – larsks
    Jul 26 '13 at 17:56












  • I do see pip inside of myenv.env/bin/. I just tried "activating" my env again, and despite being in that mode, "which pip" and "which easy_install" both return "usr/local/bin/pip" and "usr/bin/easy_install" respectively.

    – Luke Sapan
    Jul 26 '13 at 18:20

















  • Does it work correctly for other packages? Do you have the same problem if you use easy_install?

    – larsks
    Jul 26 '13 at 17:28











  • Same problem with other packages. And I believe easy_install requires sudo and would install into the global directory.

    – Luke Sapan
    Jul 26 '13 at 17:53











  • Nope, setting up a virtualenv gets you easy_install as well as pip. You can type which easy_install to see if you're using your virtualenv or the system one.

    – larsks
    Jul 26 '13 at 17:55












  • Actually, are you sure you're running pip from inside the virtualenv? What does which pip yield? And do you see pip inside myenv.env/bin/?

    – larsks
    Jul 26 '13 at 17:56












  • I do see pip inside of myenv.env/bin/. I just tried "activating" my env again, and despite being in that mode, "which pip" and "which easy_install" both return "usr/local/bin/pip" and "usr/bin/easy_install" respectively.

    – Luke Sapan
    Jul 26 '13 at 18:20
















Does it work correctly for other packages? Do you have the same problem if you use easy_install?

– larsks
Jul 26 '13 at 17:28





Does it work correctly for other packages? Do you have the same problem if you use easy_install?

– larsks
Jul 26 '13 at 17:28













Same problem with other packages. And I believe easy_install requires sudo and would install into the global directory.

– Luke Sapan
Jul 26 '13 at 17:53





Same problem with other packages. And I believe easy_install requires sudo and would install into the global directory.

– Luke Sapan
Jul 26 '13 at 17:53













Nope, setting up a virtualenv gets you easy_install as well as pip. You can type which easy_install to see if you're using your virtualenv or the system one.

– larsks
Jul 26 '13 at 17:55






Nope, setting up a virtualenv gets you easy_install as well as pip. You can type which easy_install to see if you're using your virtualenv or the system one.

– larsks
Jul 26 '13 at 17:55














Actually, are you sure you're running pip from inside the virtualenv? What does which pip yield? And do you see pip inside myenv.env/bin/?

– larsks
Jul 26 '13 at 17:56






Actually, are you sure you're running pip from inside the virtualenv? What does which pip yield? And do you see pip inside myenv.env/bin/?

– larsks
Jul 26 '13 at 17:56














I do see pip inside of myenv.env/bin/. I just tried "activating" my env again, and despite being in that mode, "which pip" and "which easy_install" both return "usr/local/bin/pip" and "usr/bin/easy_install" respectively.

– Luke Sapan
Jul 26 '13 at 18:20





I do see pip inside of myenv.env/bin/. I just tried "activating" my env again, and despite being in that mode, "which pip" and "which easy_install" both return "usr/local/bin/pip" and "usr/bin/easy_install" respectively.

– Luke Sapan
Jul 26 '13 at 18:20










6 Answers
6






active

oldest

votes


















3














Sorry for a year late answer! I had the same problem and fixed it, I don't know if you changed the name of a directory after creating the virtual environment, I did though. If so then here's what I did.



1.) deactivate your v-env. After the fix you need to restart the v-env, so might as well deactivate now. right?



2.) Now, since we created the v-env in a different path, we have to change the static path variables in these files.



To get pip working you don't need to do this, but I still do.
bin/activate,
bin/activate.csh,
bin/activate.fish



bin/pip,
bin/pip2,
bin/pip2.7



bin/easy_install,
bin/easy_install2.7



3.) To get pip working, you must correct the python interpreter in the pip file, this as well has a static interpreter location set by virtualenv in the creation process.



4.) To get easy_install working? You guessed it, fix the interpreter location.



I hope this helped for any people reading this in the future. Sorry OP, for being late.






share|improve this answer























  • Yeah that was exactly it. In my case I was able to just re-create the virtualenv from scratch and that solved it.

    – Luke Sapan
    Jun 6 '15 at 16:29











  • Glad to be of help

    – Crispy
    Jun 6 '15 at 16:41











  • I'm so glad to finally find an answer. For me, using sed in the venv folder made the job a lot easier. Something like grep -rli '/path/to/old/env/bin' * | xargs -i@ sed -i 's//path/to/old/env/bin//path/to/new/env/bin/g' @.source

    – Keith
    Feb 25 '17 at 6:56



















2














I had this same problem.



I deleted the virtual environment and created a new one, which solved the problem.



Probably not the answer you were hoping for, but since it's the only one...






share|improve this answer






























    1














    Well without administrative privileges you're very limited on what you are able to do. If you are not allowed to elevate yourself or ask for privileges, the best way I found to go about that would be to create another environment, make a requirements.txt file, download all the packages you need to your machine( django ) that would also be located in your requirements file and it should work.






    share|improve this answer






























      0














      Had the same problem. In my case the reason was that the created virtual env was for python2.7 (the default) but I was using pip3 to install a package. pip3 was not present in my virtualenv so it defaulted to the global one. For me the fix was to use



      virtualenv flask --python=python3


      to create the env.






      share|improve this answer






























        0














        I had encountered the same problem caused by renaming of user.
        Crispy's answer is totally right. And my solution may be more convenient.



        setps:

        1. Enter your virtual environment's bin path, such as cd ~/virenv_dir/bin

        2. Rename all files under this directory using sed command. sed -i 's/old_name/new_name/' *






        share|improve this answer
































          0














          In my case, I had defined two aliases (to overcome some other issue on the default python version):



          alias pip='/usr/bin/pip3'
          alias python='/usr/bin/python3'


          And this was causing the same symptoms:



          [Errno 13] Permission denied: '/usr/lib/python3.6/site-packages'


          Removing the aliases solved the issue (before or after creating the virtualenv)






          share|improve this answer























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "2"
            ;
            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%2fserverfault.com%2fquestions%2f526594%2fpip-not-installing-to-virtualenv-directory%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









            3














            Sorry for a year late answer! I had the same problem and fixed it, I don't know if you changed the name of a directory after creating the virtual environment, I did though. If so then here's what I did.



            1.) deactivate your v-env. After the fix you need to restart the v-env, so might as well deactivate now. right?



            2.) Now, since we created the v-env in a different path, we have to change the static path variables in these files.



            To get pip working you don't need to do this, but I still do.
            bin/activate,
            bin/activate.csh,
            bin/activate.fish



            bin/pip,
            bin/pip2,
            bin/pip2.7



            bin/easy_install,
            bin/easy_install2.7



            3.) To get pip working, you must correct the python interpreter in the pip file, this as well has a static interpreter location set by virtualenv in the creation process.



            4.) To get easy_install working? You guessed it, fix the interpreter location.



            I hope this helped for any people reading this in the future. Sorry OP, for being late.






            share|improve this answer























            • Yeah that was exactly it. In my case I was able to just re-create the virtualenv from scratch and that solved it.

              – Luke Sapan
              Jun 6 '15 at 16:29











            • Glad to be of help

              – Crispy
              Jun 6 '15 at 16:41











            • I'm so glad to finally find an answer. For me, using sed in the venv folder made the job a lot easier. Something like grep -rli '/path/to/old/env/bin' * | xargs -i@ sed -i 's//path/to/old/env/bin//path/to/new/env/bin/g' @.source

              – Keith
              Feb 25 '17 at 6:56
















            3














            Sorry for a year late answer! I had the same problem and fixed it, I don't know if you changed the name of a directory after creating the virtual environment, I did though. If so then here's what I did.



            1.) deactivate your v-env. After the fix you need to restart the v-env, so might as well deactivate now. right?



            2.) Now, since we created the v-env in a different path, we have to change the static path variables in these files.



            To get pip working you don't need to do this, but I still do.
            bin/activate,
            bin/activate.csh,
            bin/activate.fish



            bin/pip,
            bin/pip2,
            bin/pip2.7



            bin/easy_install,
            bin/easy_install2.7



            3.) To get pip working, you must correct the python interpreter in the pip file, this as well has a static interpreter location set by virtualenv in the creation process.



            4.) To get easy_install working? You guessed it, fix the interpreter location.



            I hope this helped for any people reading this in the future. Sorry OP, for being late.






            share|improve this answer























            • Yeah that was exactly it. In my case I was able to just re-create the virtualenv from scratch and that solved it.

              – Luke Sapan
              Jun 6 '15 at 16:29











            • Glad to be of help

              – Crispy
              Jun 6 '15 at 16:41











            • I'm so glad to finally find an answer. For me, using sed in the venv folder made the job a lot easier. Something like grep -rli '/path/to/old/env/bin' * | xargs -i@ sed -i 's//path/to/old/env/bin//path/to/new/env/bin/g' @.source

              – Keith
              Feb 25 '17 at 6:56














            3












            3








            3







            Sorry for a year late answer! I had the same problem and fixed it, I don't know if you changed the name of a directory after creating the virtual environment, I did though. If so then here's what I did.



            1.) deactivate your v-env. After the fix you need to restart the v-env, so might as well deactivate now. right?



            2.) Now, since we created the v-env in a different path, we have to change the static path variables in these files.



            To get pip working you don't need to do this, but I still do.
            bin/activate,
            bin/activate.csh,
            bin/activate.fish



            bin/pip,
            bin/pip2,
            bin/pip2.7



            bin/easy_install,
            bin/easy_install2.7



            3.) To get pip working, you must correct the python interpreter in the pip file, this as well has a static interpreter location set by virtualenv in the creation process.



            4.) To get easy_install working? You guessed it, fix the interpreter location.



            I hope this helped for any people reading this in the future. Sorry OP, for being late.






            share|improve this answer













            Sorry for a year late answer! I had the same problem and fixed it, I don't know if you changed the name of a directory after creating the virtual environment, I did though. If so then here's what I did.



            1.) deactivate your v-env. After the fix you need to restart the v-env, so might as well deactivate now. right?



            2.) Now, since we created the v-env in a different path, we have to change the static path variables in these files.



            To get pip working you don't need to do this, but I still do.
            bin/activate,
            bin/activate.csh,
            bin/activate.fish



            bin/pip,
            bin/pip2,
            bin/pip2.7



            bin/easy_install,
            bin/easy_install2.7



            3.) To get pip working, you must correct the python interpreter in the pip file, this as well has a static interpreter location set by virtualenv in the creation process.



            4.) To get easy_install working? You guessed it, fix the interpreter location.



            I hope this helped for any people reading this in the future. Sorry OP, for being late.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jun 6 '15 at 16:07









            CrispyCrispy

            1461




            1461












            • Yeah that was exactly it. In my case I was able to just re-create the virtualenv from scratch and that solved it.

              – Luke Sapan
              Jun 6 '15 at 16:29











            • Glad to be of help

              – Crispy
              Jun 6 '15 at 16:41











            • I'm so glad to finally find an answer. For me, using sed in the venv folder made the job a lot easier. Something like grep -rli '/path/to/old/env/bin' * | xargs -i@ sed -i 's//path/to/old/env/bin//path/to/new/env/bin/g' @.source

              – Keith
              Feb 25 '17 at 6:56


















            • Yeah that was exactly it. In my case I was able to just re-create the virtualenv from scratch and that solved it.

              – Luke Sapan
              Jun 6 '15 at 16:29











            • Glad to be of help

              – Crispy
              Jun 6 '15 at 16:41











            • I'm so glad to finally find an answer. For me, using sed in the venv folder made the job a lot easier. Something like grep -rli '/path/to/old/env/bin' * | xargs -i@ sed -i 's//path/to/old/env/bin//path/to/new/env/bin/g' @.source

              – Keith
              Feb 25 '17 at 6:56

















            Yeah that was exactly it. In my case I was able to just re-create the virtualenv from scratch and that solved it.

            – Luke Sapan
            Jun 6 '15 at 16:29





            Yeah that was exactly it. In my case I was able to just re-create the virtualenv from scratch and that solved it.

            – Luke Sapan
            Jun 6 '15 at 16:29













            Glad to be of help

            – Crispy
            Jun 6 '15 at 16:41





            Glad to be of help

            – Crispy
            Jun 6 '15 at 16:41













            I'm so glad to finally find an answer. For me, using sed in the venv folder made the job a lot easier. Something like grep -rli '/path/to/old/env/bin' * | xargs -i@ sed -i 's//path/to/old/env/bin//path/to/new/env/bin/g' @.source

            – Keith
            Feb 25 '17 at 6:56






            I'm so glad to finally find an answer. For me, using sed in the venv folder made the job a lot easier. Something like grep -rli '/path/to/old/env/bin' * | xargs -i@ sed -i 's//path/to/old/env/bin//path/to/new/env/bin/g' @.source

            – Keith
            Feb 25 '17 at 6:56














            2














            I had this same problem.



            I deleted the virtual environment and created a new one, which solved the problem.



            Probably not the answer you were hoping for, but since it's the only one...






            share|improve this answer



























              2














              I had this same problem.



              I deleted the virtual environment and created a new one, which solved the problem.



              Probably not the answer you were hoping for, but since it's the only one...






              share|improve this answer

























                2












                2








                2







                I had this same problem.



                I deleted the virtual environment and created a new one, which solved the problem.



                Probably not the answer you were hoping for, but since it's the only one...






                share|improve this answer













                I had this same problem.



                I deleted the virtual environment and created a new one, which solved the problem.



                Probably not the answer you were hoping for, but since it's the only one...







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 3 '14 at 15:43









                MarkMark

                1516




                1516





















                    1














                    Well without administrative privileges you're very limited on what you are able to do. If you are not allowed to elevate yourself or ask for privileges, the best way I found to go about that would be to create another environment, make a requirements.txt file, download all the packages you need to your machine( django ) that would also be located in your requirements file and it should work.






                    share|improve this answer



























                      1














                      Well without administrative privileges you're very limited on what you are able to do. If you are not allowed to elevate yourself or ask for privileges, the best way I found to go about that would be to create another environment, make a requirements.txt file, download all the packages you need to your machine( django ) that would also be located in your requirements file and it should work.






                      share|improve this answer

























                        1












                        1








                        1







                        Well without administrative privileges you're very limited on what you are able to do. If you are not allowed to elevate yourself or ask for privileges, the best way I found to go about that would be to create another environment, make a requirements.txt file, download all the packages you need to your machine( django ) that would also be located in your requirements file and it should work.






                        share|improve this answer













                        Well without administrative privileges you're very limited on what you are able to do. If you are not allowed to elevate yourself or ask for privileges, the best way I found to go about that would be to create another environment, make a requirements.txt file, download all the packages you need to your machine( django ) that would also be located in your requirements file and it should work.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Mar 3 '14 at 16:48









                        secure212secure212

                        1531210




                        1531210





















                            0














                            Had the same problem. In my case the reason was that the created virtual env was for python2.7 (the default) but I was using pip3 to install a package. pip3 was not present in my virtualenv so it defaulted to the global one. For me the fix was to use



                            virtualenv flask --python=python3


                            to create the env.






                            share|improve this answer



























                              0














                              Had the same problem. In my case the reason was that the created virtual env was for python2.7 (the default) but I was using pip3 to install a package. pip3 was not present in my virtualenv so it defaulted to the global one. For me the fix was to use



                              virtualenv flask --python=python3


                              to create the env.






                              share|improve this answer

























                                0












                                0








                                0







                                Had the same problem. In my case the reason was that the created virtual env was for python2.7 (the default) but I was using pip3 to install a package. pip3 was not present in my virtualenv so it defaulted to the global one. For me the fix was to use



                                virtualenv flask --python=python3


                                to create the env.






                                share|improve this answer













                                Had the same problem. In my case the reason was that the created virtual env was for python2.7 (the default) but I was using pip3 to install a package. pip3 was not present in my virtualenv so it defaulted to the global one. For me the fix was to use



                                virtualenv flask --python=python3


                                to create the env.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Nov 20 '15 at 14:10









                                AdversusAdversus

                                1163




                                1163





















                                    0














                                    I had encountered the same problem caused by renaming of user.
                                    Crispy's answer is totally right. And my solution may be more convenient.



                                    setps:

                                    1. Enter your virtual environment's bin path, such as cd ~/virenv_dir/bin

                                    2. Rename all files under this directory using sed command. sed -i 's/old_name/new_name/' *






                                    share|improve this answer





























                                      0














                                      I had encountered the same problem caused by renaming of user.
                                      Crispy's answer is totally right. And my solution may be more convenient.



                                      setps:

                                      1. Enter your virtual environment's bin path, such as cd ~/virenv_dir/bin

                                      2. Rename all files under this directory using sed command. sed -i 's/old_name/new_name/' *






                                      share|improve this answer



























                                        0












                                        0








                                        0







                                        I had encountered the same problem caused by renaming of user.
                                        Crispy's answer is totally right. And my solution may be more convenient.



                                        setps:

                                        1. Enter your virtual environment's bin path, such as cd ~/virenv_dir/bin

                                        2. Rename all files under this directory using sed command. sed -i 's/old_name/new_name/' *






                                        share|improve this answer















                                        I had encountered the same problem caused by renaming of user.
                                        Crispy's answer is totally right. And my solution may be more convenient.



                                        setps:

                                        1. Enter your virtual environment's bin path, such as cd ~/virenv_dir/bin

                                        2. Rename all files under this directory using sed command. sed -i 's/old_name/new_name/' *







                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Nov 13 '17 at 18:11









                                        Vaibhav Panmand

                                        761411




                                        761411










                                        answered Nov 13 '17 at 12:11









                                        xialuxialu

                                        1




                                        1





















                                            0














                                            In my case, I had defined two aliases (to overcome some other issue on the default python version):



                                            alias pip='/usr/bin/pip3'
                                            alias python='/usr/bin/python3'


                                            And this was causing the same symptoms:



                                            [Errno 13] Permission denied: '/usr/lib/python3.6/site-packages'


                                            Removing the aliases solved the issue (before or after creating the virtualenv)






                                            share|improve this answer



























                                              0














                                              In my case, I had defined two aliases (to overcome some other issue on the default python version):



                                              alias pip='/usr/bin/pip3'
                                              alias python='/usr/bin/python3'


                                              And this was causing the same symptoms:



                                              [Errno 13] Permission denied: '/usr/lib/python3.6/site-packages'


                                              Removing the aliases solved the issue (before or after creating the virtualenv)






                                              share|improve this answer

























                                                0












                                                0








                                                0







                                                In my case, I had defined two aliases (to overcome some other issue on the default python version):



                                                alias pip='/usr/bin/pip3'
                                                alias python='/usr/bin/python3'


                                                And this was causing the same symptoms:



                                                [Errno 13] Permission denied: '/usr/lib/python3.6/site-packages'


                                                Removing the aliases solved the issue (before or after creating the virtualenv)






                                                share|improve this answer













                                                In my case, I had defined two aliases (to overcome some other issue on the default python version):



                                                alias pip='/usr/bin/pip3'
                                                alias python='/usr/bin/python3'


                                                And this was causing the same symptoms:



                                                [Errno 13] Permission denied: '/usr/lib/python3.6/site-packages'


                                                Removing the aliases solved the issue (before or after creating the virtualenv)







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered May 2 at 20:03









                                                coderazzicoderazzi

                                                1012




                                                1012



























                                                    draft saved

                                                    draft discarded
















































                                                    Thanks for contributing an answer to Server Fault!


                                                    • 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%2fserverfault.com%2fquestions%2f526594%2fpip-not-installing-to-virtualenv-directory%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

                                                    Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

                                                    Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

                                                    What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company