Error “virtualenv : command not found” but install location is in PYTHONPATH










14














This has been driving me crazy for the past 2 days.
I installed virtualenv on my Macbook using pip install virtualenv.
But when I try to create a new virtualenv using virtualenv venv, I get the error saying "virtualenv : command not found".



I used pip show virtualenv and the location of the installation is "Location: /usr/local/lib/python2.7/site-packages" but I can't figure out where the executable is. I tried dozens other similar looking posts but those solutions do not work for me.



Any ideas what might be going wrong here?










share|improve this question























  • Are you sure your python path is correct? Are you using the system installed python, or one you downloaded on your own?
    – cricket_007
    Oct 10 '16 at 18:38










  • Pythonpath wouldn't affect executing a program from the commandline...
    – John Gordon
    Oct 10 '16 at 18:39






  • 3




    Can you try python -m venv?
    – sytech
    Oct 10 '16 at 18:41










  • @cricket_007 : I've been using it for the past 2 years so I'm not sure but I think its the default installation. When I do which python, I get "/usr/local/bin/python"
    – Pravesh Jain
    Oct 10 '16 at 18:42






  • 1




    I have python installed via homebrew. When I did pip install virtualenv, it created it there.
    – cricket_007
    Oct 10 '16 at 19:39















14














This has been driving me crazy for the past 2 days.
I installed virtualenv on my Macbook using pip install virtualenv.
But when I try to create a new virtualenv using virtualenv venv, I get the error saying "virtualenv : command not found".



I used pip show virtualenv and the location of the installation is "Location: /usr/local/lib/python2.7/site-packages" but I can't figure out where the executable is. I tried dozens other similar looking posts but those solutions do not work for me.



Any ideas what might be going wrong here?










share|improve this question























  • Are you sure your python path is correct? Are you using the system installed python, or one you downloaded on your own?
    – cricket_007
    Oct 10 '16 at 18:38










  • Pythonpath wouldn't affect executing a program from the commandline...
    – John Gordon
    Oct 10 '16 at 18:39






  • 3




    Can you try python -m venv?
    – sytech
    Oct 10 '16 at 18:41










  • @cricket_007 : I've been using it for the past 2 years so I'm not sure but I think its the default installation. When I do which python, I get "/usr/local/bin/python"
    – Pravesh Jain
    Oct 10 '16 at 18:42






  • 1




    I have python installed via homebrew. When I did pip install virtualenv, it created it there.
    – cricket_007
    Oct 10 '16 at 19:39













14












14








14


7





This has been driving me crazy for the past 2 days.
I installed virtualenv on my Macbook using pip install virtualenv.
But when I try to create a new virtualenv using virtualenv venv, I get the error saying "virtualenv : command not found".



I used pip show virtualenv and the location of the installation is "Location: /usr/local/lib/python2.7/site-packages" but I can't figure out where the executable is. I tried dozens other similar looking posts but those solutions do not work for me.



Any ideas what might be going wrong here?










share|improve this question















This has been driving me crazy for the past 2 days.
I installed virtualenv on my Macbook using pip install virtualenv.
But when I try to create a new virtualenv using virtualenv venv, I get the error saying "virtualenv : command not found".



I used pip show virtualenv and the location of the installation is "Location: /usr/local/lib/python2.7/site-packages" but I can't figure out where the executable is. I tried dozens other similar looking posts but those solutions do not work for me.



Any ideas what might be going wrong here?







python python-2.7 pip






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 11 '16 at 10:06

























asked Oct 10 '16 at 18:35









Pravesh Jain

1,29731529




1,29731529











  • Are you sure your python path is correct? Are you using the system installed python, or one you downloaded on your own?
    – cricket_007
    Oct 10 '16 at 18:38










  • Pythonpath wouldn't affect executing a program from the commandline...
    – John Gordon
    Oct 10 '16 at 18:39






  • 3




    Can you try python -m venv?
    – sytech
    Oct 10 '16 at 18:41










  • @cricket_007 : I've been using it for the past 2 years so I'm not sure but I think its the default installation. When I do which python, I get "/usr/local/bin/python"
    – Pravesh Jain
    Oct 10 '16 at 18:42






  • 1




    I have python installed via homebrew. When I did pip install virtualenv, it created it there.
    – cricket_007
    Oct 10 '16 at 19:39
















  • Are you sure your python path is correct? Are you using the system installed python, or one you downloaded on your own?
    – cricket_007
    Oct 10 '16 at 18:38










  • Pythonpath wouldn't affect executing a program from the commandline...
    – John Gordon
    Oct 10 '16 at 18:39






  • 3




    Can you try python -m venv?
    – sytech
    Oct 10 '16 at 18:41










  • @cricket_007 : I've been using it for the past 2 years so I'm not sure but I think its the default installation. When I do which python, I get "/usr/local/bin/python"
    – Pravesh Jain
    Oct 10 '16 at 18:42






  • 1




    I have python installed via homebrew. When I did pip install virtualenv, it created it there.
    – cricket_007
    Oct 10 '16 at 19:39















Are you sure your python path is correct? Are you using the system installed python, or one you downloaded on your own?
– cricket_007
Oct 10 '16 at 18:38




Are you sure your python path is correct? Are you using the system installed python, or one you downloaded on your own?
– cricket_007
Oct 10 '16 at 18:38












Pythonpath wouldn't affect executing a program from the commandline...
– John Gordon
Oct 10 '16 at 18:39




Pythonpath wouldn't affect executing a program from the commandline...
– John Gordon
Oct 10 '16 at 18:39




3




3




Can you try python -m venv?
– sytech
Oct 10 '16 at 18:41




Can you try python -m venv?
– sytech
Oct 10 '16 at 18:41












@cricket_007 : I've been using it for the past 2 years so I'm not sure but I think its the default installation. When I do which python, I get "/usr/local/bin/python"
– Pravesh Jain
Oct 10 '16 at 18:42




@cricket_007 : I've been using it for the past 2 years so I'm not sure but I think its the default installation. When I do which python, I get "/usr/local/bin/python"
– Pravesh Jain
Oct 10 '16 at 18:42




1




1




I have python installed via homebrew. When I did pip install virtualenv, it created it there.
– cricket_007
Oct 10 '16 at 19:39




I have python installed via homebrew. When I did pip install virtualenv, it created it there.
– cricket_007
Oct 10 '16 at 19:39












5 Answers
5






active

oldest

votes


















29














The only workable approach I could figure out (with help from @Gator_Python was to do python -m virtualenv venv. This creates the virtual environment and works as expected.



I have custom python installed and maybe that's why the default approach doesn't work for me.






share|improve this answer




















  • Works with the official Python3 download on El Capitan. Thanks.
    – marw
    Jan 9 '17 at 20:34


















4














As mentioned in the comments, you've got the virtualenv module installed properly in the expected environment since python -m venv allows you to create virtualenv's.



The fact that virtualenv is not a recognized command is a result of the virtualenv.py not being in your system PATH and/or not being executable. The root cause could be outdated distutils or setuptools.



You should attempt to locate the virtualenv.py file, ensure it is executable (chmod +x) and that its location is in your system PATH. On my system, virtualenv.py is in the ../Pythonx.x/Scripts folder, but this may be different for you.






share|improve this answer




















  • The first solution worked for me, but the second failed, despite locating virtualenv in ~/lib/python/site-packages, adding this directory to the PATH, and making virtualenv.py executable. I am on macOS Mojave with Python 3.6.7 and pip3.
    – mmorin
    Dec 11 at 10:29


















1














Could it be that you are using Anaconda package manager? If so, then it has it's own virtual environment system which you setup as follows:



conda create --name venv





share|improve this answer




























    0














    I had the same issue (although on ubuntu), a simple solution is instead of doing pip install virtualenv, you precede the commend with "sudo".



    A little inspection reveals the reason behind this fix:
    enter image description here



    pip install virtualenv tries to put an executable under /usr/local/bin so that it can be invoked from command line, but it failed because only root has write permission to that directory



    an alternative is pip install --user virtualenv, here are some further readings 1,2






    share|improve this answer






























      -1














      1. Install python's package manager pip.

      2. Install virtual environment using pip3 install virtualenv or pip install virtualenv.





      share|improve this answer




















        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%2f39964635%2ferror-virtualenv-command-not-found-but-install-location-is-in-pythonpath%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        29














        The only workable approach I could figure out (with help from @Gator_Python was to do python -m virtualenv venv. This creates the virtual environment and works as expected.



        I have custom python installed and maybe that's why the default approach doesn't work for me.






        share|improve this answer




















        • Works with the official Python3 download on El Capitan. Thanks.
          – marw
          Jan 9 '17 at 20:34















        29














        The only workable approach I could figure out (with help from @Gator_Python was to do python -m virtualenv venv. This creates the virtual environment and works as expected.



        I have custom python installed and maybe that's why the default approach doesn't work for me.






        share|improve this answer




















        • Works with the official Python3 download on El Capitan. Thanks.
          – marw
          Jan 9 '17 at 20:34













        29












        29








        29






        The only workable approach I could figure out (with help from @Gator_Python was to do python -m virtualenv venv. This creates the virtual environment and works as expected.



        I have custom python installed and maybe that's why the default approach doesn't work for me.






        share|improve this answer












        The only workable approach I could figure out (with help from @Gator_Python was to do python -m virtualenv venv. This creates the virtual environment and works as expected.



        I have custom python installed and maybe that's why the default approach doesn't work for me.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 11 '16 at 7:17









        Pravesh Jain

        1,29731529




        1,29731529











        • Works with the official Python3 download on El Capitan. Thanks.
          – marw
          Jan 9 '17 at 20:34
















        • Works with the official Python3 download on El Capitan. Thanks.
          – marw
          Jan 9 '17 at 20:34















        Works with the official Python3 download on El Capitan. Thanks.
        – marw
        Jan 9 '17 at 20:34




        Works with the official Python3 download on El Capitan. Thanks.
        – marw
        Jan 9 '17 at 20:34













        4














        As mentioned in the comments, you've got the virtualenv module installed properly in the expected environment since python -m venv allows you to create virtualenv's.



        The fact that virtualenv is not a recognized command is a result of the virtualenv.py not being in your system PATH and/or not being executable. The root cause could be outdated distutils or setuptools.



        You should attempt to locate the virtualenv.py file, ensure it is executable (chmod +x) and that its location is in your system PATH. On my system, virtualenv.py is in the ../Pythonx.x/Scripts folder, but this may be different for you.






        share|improve this answer




















        • The first solution worked for me, but the second failed, despite locating virtualenv in ~/lib/python/site-packages, adding this directory to the PATH, and making virtualenv.py executable. I am on macOS Mojave with Python 3.6.7 and pip3.
          – mmorin
          Dec 11 at 10:29















        4














        As mentioned in the comments, you've got the virtualenv module installed properly in the expected environment since python -m venv allows you to create virtualenv's.



        The fact that virtualenv is not a recognized command is a result of the virtualenv.py not being in your system PATH and/or not being executable. The root cause could be outdated distutils or setuptools.



        You should attempt to locate the virtualenv.py file, ensure it is executable (chmod +x) and that its location is in your system PATH. On my system, virtualenv.py is in the ../Pythonx.x/Scripts folder, but this may be different for you.






        share|improve this answer




















        • The first solution worked for me, but the second failed, despite locating virtualenv in ~/lib/python/site-packages, adding this directory to the PATH, and making virtualenv.py executable. I am on macOS Mojave with Python 3.6.7 and pip3.
          – mmorin
          Dec 11 at 10:29













        4












        4








        4






        As mentioned in the comments, you've got the virtualenv module installed properly in the expected environment since python -m venv allows you to create virtualenv's.



        The fact that virtualenv is not a recognized command is a result of the virtualenv.py not being in your system PATH and/or not being executable. The root cause could be outdated distutils or setuptools.



        You should attempt to locate the virtualenv.py file, ensure it is executable (chmod +x) and that its location is in your system PATH. On my system, virtualenv.py is in the ../Pythonx.x/Scripts folder, but this may be different for you.






        share|improve this answer












        As mentioned in the comments, you've got the virtualenv module installed properly in the expected environment since python -m venv allows you to create virtualenv's.



        The fact that virtualenv is not a recognized command is a result of the virtualenv.py not being in your system PATH and/or not being executable. The root cause could be outdated distutils or setuptools.



        You should attempt to locate the virtualenv.py file, ensure it is executable (chmod +x) and that its location is in your system PATH. On my system, virtualenv.py is in the ../Pythonx.x/Scripts folder, but this may be different for you.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 11 '16 at 12:34









        sytech

        4,61311031




        4,61311031











        • The first solution worked for me, but the second failed, despite locating virtualenv in ~/lib/python/site-packages, adding this directory to the PATH, and making virtualenv.py executable. I am on macOS Mojave with Python 3.6.7 and pip3.
          – mmorin
          Dec 11 at 10:29
















        • The first solution worked for me, but the second failed, despite locating virtualenv in ~/lib/python/site-packages, adding this directory to the PATH, and making virtualenv.py executable. I am on macOS Mojave with Python 3.6.7 and pip3.
          – mmorin
          Dec 11 at 10:29















        The first solution worked for me, but the second failed, despite locating virtualenv in ~/lib/python/site-packages, adding this directory to the PATH, and making virtualenv.py executable. I am on macOS Mojave with Python 3.6.7 and pip3.
        – mmorin
        Dec 11 at 10:29




        The first solution worked for me, but the second failed, despite locating virtualenv in ~/lib/python/site-packages, adding this directory to the PATH, and making virtualenv.py executable. I am on macOS Mojave with Python 3.6.7 and pip3.
        – mmorin
        Dec 11 at 10:29











        1














        Could it be that you are using Anaconda package manager? If so, then it has it's own virtual environment system which you setup as follows:



        conda create --name venv





        share|improve this answer

























          1














          Could it be that you are using Anaconda package manager? If so, then it has it's own virtual environment system which you setup as follows:



          conda create --name venv





          share|improve this answer























            1












            1








            1






            Could it be that you are using Anaconda package manager? If so, then it has it's own virtual environment system which you setup as follows:



            conda create --name venv





            share|improve this answer












            Could it be that you are using Anaconda package manager? If so, then it has it's own virtual environment system which you setup as follows:



            conda create --name venv






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 28 '17 at 0:53









            Bill

            2,09421929




            2,09421929





















                0














                I had the same issue (although on ubuntu), a simple solution is instead of doing pip install virtualenv, you precede the commend with "sudo".



                A little inspection reveals the reason behind this fix:
                enter image description here



                pip install virtualenv tries to put an executable under /usr/local/bin so that it can be invoked from command line, but it failed because only root has write permission to that directory



                an alternative is pip install --user virtualenv, here are some further readings 1,2






                share|improve this answer



























                  0














                  I had the same issue (although on ubuntu), a simple solution is instead of doing pip install virtualenv, you precede the commend with "sudo".



                  A little inspection reveals the reason behind this fix:
                  enter image description here



                  pip install virtualenv tries to put an executable under /usr/local/bin so that it can be invoked from command line, but it failed because only root has write permission to that directory



                  an alternative is pip install --user virtualenv, here are some further readings 1,2






                  share|improve this answer

























                    0












                    0








                    0






                    I had the same issue (although on ubuntu), a simple solution is instead of doing pip install virtualenv, you precede the commend with "sudo".



                    A little inspection reveals the reason behind this fix:
                    enter image description here



                    pip install virtualenv tries to put an executable under /usr/local/bin so that it can be invoked from command line, but it failed because only root has write permission to that directory



                    an alternative is pip install --user virtualenv, here are some further readings 1,2






                    share|improve this answer














                    I had the same issue (although on ubuntu), a simple solution is instead of doing pip install virtualenv, you precede the commend with "sudo".



                    A little inspection reveals the reason behind this fix:
                    enter image description here



                    pip install virtualenv tries to put an executable under /usr/local/bin so that it can be invoked from command line, but it failed because only root has write permission to that directory



                    an alternative is pip install --user virtualenv, here are some further readings 1,2







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Dec 2 at 6:28

























                    answered Nov 12 at 4:14









                    watashiSHUN

                    3,39812134




                    3,39812134





















                        -1














                        1. Install python's package manager pip.

                        2. Install virtual environment using pip3 install virtualenv or pip install virtualenv.





                        share|improve this answer

























                          -1














                          1. Install python's package manager pip.

                          2. Install virtual environment using pip3 install virtualenv or pip install virtualenv.





                          share|improve this answer























                            -1












                            -1








                            -1






                            1. Install python's package manager pip.

                            2. Install virtual environment using pip3 install virtualenv or pip install virtualenv.





                            share|improve this answer












                            1. Install python's package manager pip.

                            2. Install virtual environment using pip3 install virtualenv or pip install virtualenv.






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 12 at 5:40









                            SAHIL SINGH SODHI

                            121




                            121



























                                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.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • 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%2f39964635%2ferror-virtualenv-command-not-found-but-install-location-is-in-pythonpath%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