Can't install via pip with Virtualenv










59















Below is the error I get when I run pip:



serkan$ rm -r mysite
serkan$ pwd
/Users/serkan/Desktop/Python Folder
serkan$ virtualenv mysite
New python executable in mysite/bin/python
Installing setuptools............done.
Installing pip...............done.
serkan$ source mysite/bin/activate
(mysite)serkan$ pip install pinax
-bash: /Users/serkan/Desktop/Python Folder/mysite/bin/pip: "/Users/serkan/Desktop/Python: bad interpreter: No such file or directory
(mysite)serkan$ python pip install pinax
python: can't open file 'pip': [Errno 2] No such file or directory
(mysite)serkan$ python pip install Pinax
python: can't open file 'pip': [Errno 2] No such file or directory
(mysite)serkan$ python pip install Pinax
python: can't open file 'pip': [Errno 2] No such file or directory
(mysite)serkan$ python pip install Pinax
python: can't open file 'pip': [Errno 2] No such file or directory
(mysite)serkan$ python pip
python: can't open file 'pip': [Errno 2] No such file or directory
(mysite)serkan$ pip
-bash: /Users/serkan/Desktop/Python Folder/mysite/bin/pip: "/Users/serkan/Desktop/Python: bad interpreter: No such file or directory
(mysite)serkan$ pip install Pinax
-bash: /Users/serkan/Desktop/Python Folder/mysite/bin/pip: "/Users/serkan/Desktop/Python: bad interpreter: No such file or directory
(mysite)serkan$









share|improve this question




























    59















    Below is the error I get when I run pip:



    serkan$ rm -r mysite
    serkan$ pwd
    /Users/serkan/Desktop/Python Folder
    serkan$ virtualenv mysite
    New python executable in mysite/bin/python
    Installing setuptools............done.
    Installing pip...............done.
    serkan$ source mysite/bin/activate
    (mysite)serkan$ pip install pinax
    -bash: /Users/serkan/Desktop/Python Folder/mysite/bin/pip: "/Users/serkan/Desktop/Python: bad interpreter: No such file or directory
    (mysite)serkan$ python pip install pinax
    python: can't open file 'pip': [Errno 2] No such file or directory
    (mysite)serkan$ python pip install Pinax
    python: can't open file 'pip': [Errno 2] No such file or directory
    (mysite)serkan$ python pip install Pinax
    python: can't open file 'pip': [Errno 2] No such file or directory
    (mysite)serkan$ python pip install Pinax
    python: can't open file 'pip': [Errno 2] No such file or directory
    (mysite)serkan$ python pip
    python: can't open file 'pip': [Errno 2] No such file or directory
    (mysite)serkan$ pip
    -bash: /Users/serkan/Desktop/Python Folder/mysite/bin/pip: "/Users/serkan/Desktop/Python: bad interpreter: No such file or directory
    (mysite)serkan$ pip install Pinax
    -bash: /Users/serkan/Desktop/Python Folder/mysite/bin/pip: "/Users/serkan/Desktop/Python: bad interpreter: No such file or directory
    (mysite)serkan$









    share|improve this question


























      59












      59








      59


      18






      Below is the error I get when I run pip:



      serkan$ rm -r mysite
      serkan$ pwd
      /Users/serkan/Desktop/Python Folder
      serkan$ virtualenv mysite
      New python executable in mysite/bin/python
      Installing setuptools............done.
      Installing pip...............done.
      serkan$ source mysite/bin/activate
      (mysite)serkan$ pip install pinax
      -bash: /Users/serkan/Desktop/Python Folder/mysite/bin/pip: "/Users/serkan/Desktop/Python: bad interpreter: No such file or directory
      (mysite)serkan$ python pip install pinax
      python: can't open file 'pip': [Errno 2] No such file or directory
      (mysite)serkan$ python pip install Pinax
      python: can't open file 'pip': [Errno 2] No such file or directory
      (mysite)serkan$ python pip install Pinax
      python: can't open file 'pip': [Errno 2] No such file or directory
      (mysite)serkan$ python pip install Pinax
      python: can't open file 'pip': [Errno 2] No such file or directory
      (mysite)serkan$ python pip
      python: can't open file 'pip': [Errno 2] No such file or directory
      (mysite)serkan$ pip
      -bash: /Users/serkan/Desktop/Python Folder/mysite/bin/pip: "/Users/serkan/Desktop/Python: bad interpreter: No such file or directory
      (mysite)serkan$ pip install Pinax
      -bash: /Users/serkan/Desktop/Python Folder/mysite/bin/pip: "/Users/serkan/Desktop/Python: bad interpreter: No such file or directory
      (mysite)serkan$









      share|improve this question
















      Below is the error I get when I run pip:



      serkan$ rm -r mysite
      serkan$ pwd
      /Users/serkan/Desktop/Python Folder
      serkan$ virtualenv mysite
      New python executable in mysite/bin/python
      Installing setuptools............done.
      Installing pip...............done.
      serkan$ source mysite/bin/activate
      (mysite)serkan$ pip install pinax
      -bash: /Users/serkan/Desktop/Python Folder/mysite/bin/pip: "/Users/serkan/Desktop/Python: bad interpreter: No such file or directory
      (mysite)serkan$ python pip install pinax
      python: can't open file 'pip': [Errno 2] No such file or directory
      (mysite)serkan$ python pip install Pinax
      python: can't open file 'pip': [Errno 2] No such file or directory
      (mysite)serkan$ python pip install Pinax
      python: can't open file 'pip': [Errno 2] No such file or directory
      (mysite)serkan$ python pip install Pinax
      python: can't open file 'pip': [Errno 2] No such file or directory
      (mysite)serkan$ python pip
      python: can't open file 'pip': [Errno 2] No such file or directory
      (mysite)serkan$ pip
      -bash: /Users/serkan/Desktop/Python Folder/mysite/bin/pip: "/Users/serkan/Desktop/Python: bad interpreter: No such file or directory
      (mysite)serkan$ pip install Pinax
      -bash: /Users/serkan/Desktop/Python Folder/mysite/bin/pip: "/Users/serkan/Desktop/Python: bad interpreter: No such file or directory
      (mysite)serkan$






      python pip






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 20 '13 at 19:10









      jb.

      13.1k1475118




      13.1k1475118










      asked Oct 27 '11 at 2:08









      shaytacshaytac

      1,63472741




      1,63472741






















          9 Answers
          9






          active

          oldest

          votes


















          121














          Create your virtualenv environment within a path without spaces. This is why it is happening:



          When you create an environment, it sets up a bin directory. In that bin directory are all the executables relating to the environment. Some are scripts. As you may know, hashbangs are used to tell the system what interpreter to use to run the script. You may see this at the top of scripts often:



          #!/usr/bin/env python


          If the script is at /tmp/test.py, that tells the system to run this command to execute the script:



          /usr/bin/env python /tmp/test.py


          In your case, virtualenv is creating scripts like this:



          #!/tmp/oh no/bin/python


          When the system tries to execute that, it will try to execute the command /tmp/oh with the arguments no/bin/python and /tmp/test.py. /tmp/oh does not exist, so it fails.






          share|improve this answer


















          • 9





            "Create your virtualenv environment within a path without spaces." This is what helped! Thanks.

            – KMS
            Feb 11 '12 at 9:58






          • 4





            I had the same error but no spaces, turns out what bit me is that you cannot move a virtualenv once created (which is utter madness…).

            – Alper
            Jun 25 '12 at 19:07






          • 1





            @alper: It kind of supports moving them around.

            – icktoofay
            Jun 30 '12 at 5:09






          • 1





            Thanks, this explained everything for me! I guess this means you can't set up virtualenvs inside your Google Drive folder.

            – GChorn
            Mar 8 '13 at 7:41






          • 1





            @GChorn: It would be a bit of a hack, but you could set up a symbolic link in a path without spaces to the Google Drive folder.

            – icktoofay
            Mar 9 '13 at 6:14


















          22














          For those running into this issue, I discovered that the length of the path could cause issues as well, without using any spaces (Ubuntu 12.04):



          virtualenv /home/user/some/very/longer/path/without/spaces/etc/venv


          failed, while



          virtualenv /home/user/some/very/long/path/without/spaces/etc/venv


          worked just fine, see Alex's comment below






          share|improve this answer




















          • 9





            This isn't a bash constraint and in fact has nothing to do with the shells: it's a kernel constraint in the exec call on the length allowed to specify the interpreter (and args) following the "#!" magic number. Historically it was about 30 characters in older Unixen, in Linux it's closer to 80.

            – Alex North-Keys
            Jan 5 '16 at 21:47











          • @AlexNorth-Keys thanks for explaining!

            – Hedde van der Heide
            Jan 6 '16 at 9:06












          • :-) Now if we can just get people to Stop Putting .sh On Command Names. It's soooo wrong for so many reasons.

            – Alex North-Keys
            Jan 6 '16 at 16:19






          • 1





            Just to clarify, the kernel constraint is BINPRM_BUF_SIZE and the limit length is 127 bytes. More info: in-ulm.de/~mascheck/various/shebang/#length

            – Flat
            May 22 '17 at 14:21


















          15














          pip command won't work if:




          • You have not installed pip in your system. (you have to install pip first in your system before you can use it in virtualenv. To install pip on Ubuntu, use command sudo apt-get install python-pip or sudo apt-get install python3-pip)


          • The path to your virtual environment folder contains space(s).(Example: /home/username/my folder name with spaces/newvirtualenv)


          • The path to your virtual environment folder is too long. Example: /home/username/mytoobigpath/somefolder/anotherfolder/someanotherfolder/someanotherfolderagain/myvirtualenv. (Try renaming parent folders with smaller names)

          If you can't rename folders or change path for some reason, goto yourvirtualenvfolder/bin (using cd command) and then try python pip install packagename.






          share|improve this answer




















          • 5





            You're a hero. It's kind of ridiculous that pip can't handle spaces AND doesn't specifically throw that error.

            – ProGirlXOXO
            Jul 8 '17 at 18:07






          • 2





            Ran into a long path issue. Thanks.

            – Igal Karlinsky
            Feb 5 '18 at 8:56






          • 1





            Does anyone know the virtualenv length limit?

            – Greg Hilston
            Apr 7 '18 at 15:39






          • 2





            Also ran into a length limit due to Jenkins workspace names. Character limit seemed to be 79 characters. CentOS7 AWS-hosted VM with kernel version 3.10.0-693.11.6.el7.x86_64

            – Connor
            Jun 6 '18 at 4:08


















          14














          icktoofay is correct about the cause.



          To use pip with virtualenv in a directory with spaces, edit /path/to/env/bin/pip, replacing the shebang at the top with #!/usr/bin/env python (or #!/usr/bin/env pypy if you're using pypy).



          Note that virtualenv changes your environment such that /usr/bin/env python refers to the python defined by the virtualenv.






          share|improve this answer

























          • @icktoofay, virtualenv changes the PATH defined by env. Thus, /usr/bin/env python will refer to the python defined by the virtualenv.

            – Bryan Head
            Mar 1 '14 at 3:24











          • You're right. That seems obvious now, but I missed that for some reason.

            – icktoofay
            Mar 1 '14 at 3:26











          • No worries. I've changed my answer to make it clearer.

            – Bryan Head
            Mar 1 '14 at 3:29











          • Thanks! Somewhere along a project setup process, I was told to change the folders' names, but I had already created the virtualenv. It was now no longer allowing me to use pip to install packages. Editing the bin/pip executable and fixing the path to the new name did the trick! :)

            – Luca Bezerra
            Dec 1 '16 at 20:11


















          1














          I got the same error in RedHat. Python 2.7.3 is configured and made by myself.
          [root@Ifx installer]# pip install Django
          -bash: /usr/local/bin/pip: /usr/local/bin/python2.7: bad interpreter: Permission denied



          Solution: In /usr/local/bin/pip, replace first line #!/usr/local/bin/python2.7 with your actual Python path #!/root/installer/Python-2.7.5/python






          share|improve this answer






























            0














            I had a very similar issue on my Windows 7 machine and struggled couple of days with that. Both paths, to my python distribution and to my VE had spaces in it. Couple of months before it worked fine. I found the following note on virtualenv website:



            **Windows Notes**
            [...] To create a virtualenv under a path with spaces in it on Windows, you’ll need the win32api library installed.


            The following steps lead me to success:



            1. Make sure I used pip to install virtualenv and it's the latest version (pip-7.1.0). Result: failure.

            2. Install win32api. Result: failure (although there was some error at the very end of installation process).

            3. Try to install my VE in a path without spaces. Result: failure.

            4. Reinstall my Anaconda python distribution to the path that didn't contain the "[" and "]" brackets. VE had spaces in the path. Result: failure.

            5. Reinstall my Anaconda python distribution to the path that also didn't contain any spaces. The VE folder still had spaces in the path. Result: success!

            So at least the Anaconda (python) installation simple, non space-pollutted path was crucial. Maybe win32api installation was also important. Not sure.






            share|improve this answer






























              0














              I found this from a Google search while experiencing the same problem and found this to be very useful. virtualenv now has a --relocatable flag that will rewrite the shebang command to #!/usr/bin/env <the_python_version_you_used_to_create_the_virtualenv>. It does come with some caveats, so be sure to read the documentation to understand the implications:



              https://virtualenv.pypa.io/en/stable/userguide/#making-environments-relocatable



              You need to use the same syntax to relocate the virtualenv as you did when creating it, otherwise the python version may be overwritten. This will work as expected...



              virtualenv --python=python3.5 env-test
              virtualenv --relocatable --python=python3.5 env-test


              whereas this will result in #!/usr/bin/env python2.7 (at least on my local environment)...



              virtualenv --python==python3.5 env-test
              virtualenv --relocatable env-test





              share|improve this answer























              • This does not fix the issue for me

                – Nicolas Bouliane
                May 13 '17 at 15:09


















              0














              For my case, deactivate the environment and source bin/activate again works.



              It seems my folder content has same subfolder names as generated by virtualenv, such as bin, lib etc. And after copy in my files, reactivate the environment let virtualenv to update new information.






              share|improve this answer






























                0














                On Python 3.7 I didn't have any issues with this but when I had to use Python 3.6 I did have an issue. The most easy work-around I found on Github was this:



                Instead of:



                pip install -r requirements.txt


                I use:



                python env/bin/pip install -r requirements.txt


                So you actually directly point to the pip file within your virtual environment directory. Of course you need to activate it first before trying this. Hope this helps someone who comes here!






                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%2f7911003%2fcant-install-via-pip-with-virtualenv%23new-answer', 'question_page');

                  );

                  Post as a guest















                  Required, but never shown

























                  9 Answers
                  9






                  active

                  oldest

                  votes








                  9 Answers
                  9






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes









                  121














                  Create your virtualenv environment within a path without spaces. This is why it is happening:



                  When you create an environment, it sets up a bin directory. In that bin directory are all the executables relating to the environment. Some are scripts. As you may know, hashbangs are used to tell the system what interpreter to use to run the script. You may see this at the top of scripts often:



                  #!/usr/bin/env python


                  If the script is at /tmp/test.py, that tells the system to run this command to execute the script:



                  /usr/bin/env python /tmp/test.py


                  In your case, virtualenv is creating scripts like this:



                  #!/tmp/oh no/bin/python


                  When the system tries to execute that, it will try to execute the command /tmp/oh with the arguments no/bin/python and /tmp/test.py. /tmp/oh does not exist, so it fails.






                  share|improve this answer


















                  • 9





                    "Create your virtualenv environment within a path without spaces." This is what helped! Thanks.

                    – KMS
                    Feb 11 '12 at 9:58






                  • 4





                    I had the same error but no spaces, turns out what bit me is that you cannot move a virtualenv once created (which is utter madness…).

                    – Alper
                    Jun 25 '12 at 19:07






                  • 1





                    @alper: It kind of supports moving them around.

                    – icktoofay
                    Jun 30 '12 at 5:09






                  • 1





                    Thanks, this explained everything for me! I guess this means you can't set up virtualenvs inside your Google Drive folder.

                    – GChorn
                    Mar 8 '13 at 7:41






                  • 1





                    @GChorn: It would be a bit of a hack, but you could set up a symbolic link in a path without spaces to the Google Drive folder.

                    – icktoofay
                    Mar 9 '13 at 6:14















                  121














                  Create your virtualenv environment within a path without spaces. This is why it is happening:



                  When you create an environment, it sets up a bin directory. In that bin directory are all the executables relating to the environment. Some are scripts. As you may know, hashbangs are used to tell the system what interpreter to use to run the script. You may see this at the top of scripts often:



                  #!/usr/bin/env python


                  If the script is at /tmp/test.py, that tells the system to run this command to execute the script:



                  /usr/bin/env python /tmp/test.py


                  In your case, virtualenv is creating scripts like this:



                  #!/tmp/oh no/bin/python


                  When the system tries to execute that, it will try to execute the command /tmp/oh with the arguments no/bin/python and /tmp/test.py. /tmp/oh does not exist, so it fails.






                  share|improve this answer


















                  • 9





                    "Create your virtualenv environment within a path without spaces." This is what helped! Thanks.

                    – KMS
                    Feb 11 '12 at 9:58






                  • 4





                    I had the same error but no spaces, turns out what bit me is that you cannot move a virtualenv once created (which is utter madness…).

                    – Alper
                    Jun 25 '12 at 19:07






                  • 1





                    @alper: It kind of supports moving them around.

                    – icktoofay
                    Jun 30 '12 at 5:09






                  • 1





                    Thanks, this explained everything for me! I guess this means you can't set up virtualenvs inside your Google Drive folder.

                    – GChorn
                    Mar 8 '13 at 7:41






                  • 1





                    @GChorn: It would be a bit of a hack, but you could set up a symbolic link in a path without spaces to the Google Drive folder.

                    – icktoofay
                    Mar 9 '13 at 6:14













                  121












                  121








                  121







                  Create your virtualenv environment within a path without spaces. This is why it is happening:



                  When you create an environment, it sets up a bin directory. In that bin directory are all the executables relating to the environment. Some are scripts. As you may know, hashbangs are used to tell the system what interpreter to use to run the script. You may see this at the top of scripts often:



                  #!/usr/bin/env python


                  If the script is at /tmp/test.py, that tells the system to run this command to execute the script:



                  /usr/bin/env python /tmp/test.py


                  In your case, virtualenv is creating scripts like this:



                  #!/tmp/oh no/bin/python


                  When the system tries to execute that, it will try to execute the command /tmp/oh with the arguments no/bin/python and /tmp/test.py. /tmp/oh does not exist, so it fails.






                  share|improve this answer













                  Create your virtualenv environment within a path without spaces. This is why it is happening:



                  When you create an environment, it sets up a bin directory. In that bin directory are all the executables relating to the environment. Some are scripts. As you may know, hashbangs are used to tell the system what interpreter to use to run the script. You may see this at the top of scripts often:



                  #!/usr/bin/env python


                  If the script is at /tmp/test.py, that tells the system to run this command to execute the script:



                  /usr/bin/env python /tmp/test.py


                  In your case, virtualenv is creating scripts like this:



                  #!/tmp/oh no/bin/python


                  When the system tries to execute that, it will try to execute the command /tmp/oh with the arguments no/bin/python and /tmp/test.py. /tmp/oh does not exist, so it fails.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 27 '11 at 2:19









                  icktoofayicktoofay

                  103k17200211




                  103k17200211







                  • 9





                    "Create your virtualenv environment within a path without spaces." This is what helped! Thanks.

                    – KMS
                    Feb 11 '12 at 9:58






                  • 4





                    I had the same error but no spaces, turns out what bit me is that you cannot move a virtualenv once created (which is utter madness…).

                    – Alper
                    Jun 25 '12 at 19:07






                  • 1





                    @alper: It kind of supports moving them around.

                    – icktoofay
                    Jun 30 '12 at 5:09






                  • 1





                    Thanks, this explained everything for me! I guess this means you can't set up virtualenvs inside your Google Drive folder.

                    – GChorn
                    Mar 8 '13 at 7:41






                  • 1





                    @GChorn: It would be a bit of a hack, but you could set up a symbolic link in a path without spaces to the Google Drive folder.

                    – icktoofay
                    Mar 9 '13 at 6:14












                  • 9





                    "Create your virtualenv environment within a path without spaces." This is what helped! Thanks.

                    – KMS
                    Feb 11 '12 at 9:58






                  • 4





                    I had the same error but no spaces, turns out what bit me is that you cannot move a virtualenv once created (which is utter madness…).

                    – Alper
                    Jun 25 '12 at 19:07






                  • 1





                    @alper: It kind of supports moving them around.

                    – icktoofay
                    Jun 30 '12 at 5:09






                  • 1





                    Thanks, this explained everything for me! I guess this means you can't set up virtualenvs inside your Google Drive folder.

                    – GChorn
                    Mar 8 '13 at 7:41






                  • 1





                    @GChorn: It would be a bit of a hack, but you could set up a symbolic link in a path without spaces to the Google Drive folder.

                    – icktoofay
                    Mar 9 '13 at 6:14







                  9




                  9





                  "Create your virtualenv environment within a path without spaces." This is what helped! Thanks.

                  – KMS
                  Feb 11 '12 at 9:58





                  "Create your virtualenv environment within a path without spaces." This is what helped! Thanks.

                  – KMS
                  Feb 11 '12 at 9:58




                  4




                  4





                  I had the same error but no spaces, turns out what bit me is that you cannot move a virtualenv once created (which is utter madness…).

                  – Alper
                  Jun 25 '12 at 19:07





                  I had the same error but no spaces, turns out what bit me is that you cannot move a virtualenv once created (which is utter madness…).

                  – Alper
                  Jun 25 '12 at 19:07




                  1




                  1





                  @alper: It kind of supports moving them around.

                  – icktoofay
                  Jun 30 '12 at 5:09





                  @alper: It kind of supports moving them around.

                  – icktoofay
                  Jun 30 '12 at 5:09




                  1




                  1





                  Thanks, this explained everything for me! I guess this means you can't set up virtualenvs inside your Google Drive folder.

                  – GChorn
                  Mar 8 '13 at 7:41





                  Thanks, this explained everything for me! I guess this means you can't set up virtualenvs inside your Google Drive folder.

                  – GChorn
                  Mar 8 '13 at 7:41




                  1




                  1





                  @GChorn: It would be a bit of a hack, but you could set up a symbolic link in a path without spaces to the Google Drive folder.

                  – icktoofay
                  Mar 9 '13 at 6:14





                  @GChorn: It would be a bit of a hack, but you could set up a symbolic link in a path without spaces to the Google Drive folder.

                  – icktoofay
                  Mar 9 '13 at 6:14













                  22














                  For those running into this issue, I discovered that the length of the path could cause issues as well, without using any spaces (Ubuntu 12.04):



                  virtualenv /home/user/some/very/longer/path/without/spaces/etc/venv


                  failed, while



                  virtualenv /home/user/some/very/long/path/without/spaces/etc/venv


                  worked just fine, see Alex's comment below






                  share|improve this answer




















                  • 9





                    This isn't a bash constraint and in fact has nothing to do with the shells: it's a kernel constraint in the exec call on the length allowed to specify the interpreter (and args) following the "#!" magic number. Historically it was about 30 characters in older Unixen, in Linux it's closer to 80.

                    – Alex North-Keys
                    Jan 5 '16 at 21:47











                  • @AlexNorth-Keys thanks for explaining!

                    – Hedde van der Heide
                    Jan 6 '16 at 9:06












                  • :-) Now if we can just get people to Stop Putting .sh On Command Names. It's soooo wrong for so many reasons.

                    – Alex North-Keys
                    Jan 6 '16 at 16:19






                  • 1





                    Just to clarify, the kernel constraint is BINPRM_BUF_SIZE and the limit length is 127 bytes. More info: in-ulm.de/~mascheck/various/shebang/#length

                    – Flat
                    May 22 '17 at 14:21















                  22














                  For those running into this issue, I discovered that the length of the path could cause issues as well, without using any spaces (Ubuntu 12.04):



                  virtualenv /home/user/some/very/longer/path/without/spaces/etc/venv


                  failed, while



                  virtualenv /home/user/some/very/long/path/without/spaces/etc/venv


                  worked just fine, see Alex's comment below






                  share|improve this answer




















                  • 9





                    This isn't a bash constraint and in fact has nothing to do with the shells: it's a kernel constraint in the exec call on the length allowed to specify the interpreter (and args) following the "#!" magic number. Historically it was about 30 characters in older Unixen, in Linux it's closer to 80.

                    – Alex North-Keys
                    Jan 5 '16 at 21:47











                  • @AlexNorth-Keys thanks for explaining!

                    – Hedde van der Heide
                    Jan 6 '16 at 9:06












                  • :-) Now if we can just get people to Stop Putting .sh On Command Names. It's soooo wrong for so many reasons.

                    – Alex North-Keys
                    Jan 6 '16 at 16:19






                  • 1





                    Just to clarify, the kernel constraint is BINPRM_BUF_SIZE and the limit length is 127 bytes. More info: in-ulm.de/~mascheck/various/shebang/#length

                    – Flat
                    May 22 '17 at 14:21













                  22












                  22








                  22







                  For those running into this issue, I discovered that the length of the path could cause issues as well, without using any spaces (Ubuntu 12.04):



                  virtualenv /home/user/some/very/longer/path/without/spaces/etc/venv


                  failed, while



                  virtualenv /home/user/some/very/long/path/without/spaces/etc/venv


                  worked just fine, see Alex's comment below






                  share|improve this answer















                  For those running into this issue, I discovered that the length of the path could cause issues as well, without using any spaces (Ubuntu 12.04):



                  virtualenv /home/user/some/very/longer/path/without/spaces/etc/venv


                  failed, while



                  virtualenv /home/user/some/very/long/path/without/spaces/etc/venv


                  worked just fine, see Alex's comment below







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jan 6 '16 at 9:07

























                  answered Jun 4 '15 at 7:55









                  Hedde van der HeideHedde van der Heide

                  14.3k104382




                  14.3k104382







                  • 9





                    This isn't a bash constraint and in fact has nothing to do with the shells: it's a kernel constraint in the exec call on the length allowed to specify the interpreter (and args) following the "#!" magic number. Historically it was about 30 characters in older Unixen, in Linux it's closer to 80.

                    – Alex North-Keys
                    Jan 5 '16 at 21:47











                  • @AlexNorth-Keys thanks for explaining!

                    – Hedde van der Heide
                    Jan 6 '16 at 9:06












                  • :-) Now if we can just get people to Stop Putting .sh On Command Names. It's soooo wrong for so many reasons.

                    – Alex North-Keys
                    Jan 6 '16 at 16:19






                  • 1





                    Just to clarify, the kernel constraint is BINPRM_BUF_SIZE and the limit length is 127 bytes. More info: in-ulm.de/~mascheck/various/shebang/#length

                    – Flat
                    May 22 '17 at 14:21












                  • 9





                    This isn't a bash constraint and in fact has nothing to do with the shells: it's a kernel constraint in the exec call on the length allowed to specify the interpreter (and args) following the "#!" magic number. Historically it was about 30 characters in older Unixen, in Linux it's closer to 80.

                    – Alex North-Keys
                    Jan 5 '16 at 21:47











                  • @AlexNorth-Keys thanks for explaining!

                    – Hedde van der Heide
                    Jan 6 '16 at 9:06












                  • :-) Now if we can just get people to Stop Putting .sh On Command Names. It's soooo wrong for so many reasons.

                    – Alex North-Keys
                    Jan 6 '16 at 16:19






                  • 1





                    Just to clarify, the kernel constraint is BINPRM_BUF_SIZE and the limit length is 127 bytes. More info: in-ulm.de/~mascheck/various/shebang/#length

                    – Flat
                    May 22 '17 at 14:21







                  9




                  9





                  This isn't a bash constraint and in fact has nothing to do with the shells: it's a kernel constraint in the exec call on the length allowed to specify the interpreter (and args) following the "#!" magic number. Historically it was about 30 characters in older Unixen, in Linux it's closer to 80.

                  – Alex North-Keys
                  Jan 5 '16 at 21:47





                  This isn't a bash constraint and in fact has nothing to do with the shells: it's a kernel constraint in the exec call on the length allowed to specify the interpreter (and args) following the "#!" magic number. Historically it was about 30 characters in older Unixen, in Linux it's closer to 80.

                  – Alex North-Keys
                  Jan 5 '16 at 21:47













                  @AlexNorth-Keys thanks for explaining!

                  – Hedde van der Heide
                  Jan 6 '16 at 9:06






                  @AlexNorth-Keys thanks for explaining!

                  – Hedde van der Heide
                  Jan 6 '16 at 9:06














                  :-) Now if we can just get people to Stop Putting .sh On Command Names. It's soooo wrong for so many reasons.

                  – Alex North-Keys
                  Jan 6 '16 at 16:19





                  :-) Now if we can just get people to Stop Putting .sh On Command Names. It's soooo wrong for so many reasons.

                  – Alex North-Keys
                  Jan 6 '16 at 16:19




                  1




                  1





                  Just to clarify, the kernel constraint is BINPRM_BUF_SIZE and the limit length is 127 bytes. More info: in-ulm.de/~mascheck/various/shebang/#length

                  – Flat
                  May 22 '17 at 14:21





                  Just to clarify, the kernel constraint is BINPRM_BUF_SIZE and the limit length is 127 bytes. More info: in-ulm.de/~mascheck/various/shebang/#length

                  – Flat
                  May 22 '17 at 14:21











                  15














                  pip command won't work if:




                  • You have not installed pip in your system. (you have to install pip first in your system before you can use it in virtualenv. To install pip on Ubuntu, use command sudo apt-get install python-pip or sudo apt-get install python3-pip)


                  • The path to your virtual environment folder contains space(s).(Example: /home/username/my folder name with spaces/newvirtualenv)


                  • The path to your virtual environment folder is too long. Example: /home/username/mytoobigpath/somefolder/anotherfolder/someanotherfolder/someanotherfolderagain/myvirtualenv. (Try renaming parent folders with smaller names)

                  If you can't rename folders or change path for some reason, goto yourvirtualenvfolder/bin (using cd command) and then try python pip install packagename.






                  share|improve this answer




















                  • 5





                    You're a hero. It's kind of ridiculous that pip can't handle spaces AND doesn't specifically throw that error.

                    – ProGirlXOXO
                    Jul 8 '17 at 18:07






                  • 2





                    Ran into a long path issue. Thanks.

                    – Igal Karlinsky
                    Feb 5 '18 at 8:56






                  • 1





                    Does anyone know the virtualenv length limit?

                    – Greg Hilston
                    Apr 7 '18 at 15:39






                  • 2





                    Also ran into a length limit due to Jenkins workspace names. Character limit seemed to be 79 characters. CentOS7 AWS-hosted VM with kernel version 3.10.0-693.11.6.el7.x86_64

                    – Connor
                    Jun 6 '18 at 4:08















                  15














                  pip command won't work if:




                  • You have not installed pip in your system. (you have to install pip first in your system before you can use it in virtualenv. To install pip on Ubuntu, use command sudo apt-get install python-pip or sudo apt-get install python3-pip)


                  • The path to your virtual environment folder contains space(s).(Example: /home/username/my folder name with spaces/newvirtualenv)


                  • The path to your virtual environment folder is too long. Example: /home/username/mytoobigpath/somefolder/anotherfolder/someanotherfolder/someanotherfolderagain/myvirtualenv. (Try renaming parent folders with smaller names)

                  If you can't rename folders or change path for some reason, goto yourvirtualenvfolder/bin (using cd command) and then try python pip install packagename.






                  share|improve this answer




















                  • 5





                    You're a hero. It's kind of ridiculous that pip can't handle spaces AND doesn't specifically throw that error.

                    – ProGirlXOXO
                    Jul 8 '17 at 18:07






                  • 2





                    Ran into a long path issue. Thanks.

                    – Igal Karlinsky
                    Feb 5 '18 at 8:56






                  • 1





                    Does anyone know the virtualenv length limit?

                    – Greg Hilston
                    Apr 7 '18 at 15:39






                  • 2





                    Also ran into a length limit due to Jenkins workspace names. Character limit seemed to be 79 characters. CentOS7 AWS-hosted VM with kernel version 3.10.0-693.11.6.el7.x86_64

                    – Connor
                    Jun 6 '18 at 4:08













                  15












                  15








                  15







                  pip command won't work if:




                  • You have not installed pip in your system. (you have to install pip first in your system before you can use it in virtualenv. To install pip on Ubuntu, use command sudo apt-get install python-pip or sudo apt-get install python3-pip)


                  • The path to your virtual environment folder contains space(s).(Example: /home/username/my folder name with spaces/newvirtualenv)


                  • The path to your virtual environment folder is too long. Example: /home/username/mytoobigpath/somefolder/anotherfolder/someanotherfolder/someanotherfolderagain/myvirtualenv. (Try renaming parent folders with smaller names)

                  If you can't rename folders or change path for some reason, goto yourvirtualenvfolder/bin (using cd command) and then try python pip install packagename.






                  share|improve this answer















                  pip command won't work if:




                  • You have not installed pip in your system. (you have to install pip first in your system before you can use it in virtualenv. To install pip on Ubuntu, use command sudo apt-get install python-pip or sudo apt-get install python3-pip)


                  • The path to your virtual environment folder contains space(s).(Example: /home/username/my folder name with spaces/newvirtualenv)


                  • The path to your virtual environment folder is too long. Example: /home/username/mytoobigpath/somefolder/anotherfolder/someanotherfolder/someanotherfolderagain/myvirtualenv. (Try renaming parent folders with smaller names)

                  If you can't rename folders or change path for some reason, goto yourvirtualenvfolder/bin (using cd command) and then try python pip install packagename.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Sep 10 '17 at 16:50

























                  answered Dec 28 '16 at 5:12









                  Mohammed Shareef CMohammed Shareef C

                  1,1681125




                  1,1681125







                  • 5





                    You're a hero. It's kind of ridiculous that pip can't handle spaces AND doesn't specifically throw that error.

                    – ProGirlXOXO
                    Jul 8 '17 at 18:07






                  • 2





                    Ran into a long path issue. Thanks.

                    – Igal Karlinsky
                    Feb 5 '18 at 8:56






                  • 1





                    Does anyone know the virtualenv length limit?

                    – Greg Hilston
                    Apr 7 '18 at 15:39






                  • 2





                    Also ran into a length limit due to Jenkins workspace names. Character limit seemed to be 79 characters. CentOS7 AWS-hosted VM with kernel version 3.10.0-693.11.6.el7.x86_64

                    – Connor
                    Jun 6 '18 at 4:08












                  • 5





                    You're a hero. It's kind of ridiculous that pip can't handle spaces AND doesn't specifically throw that error.

                    – ProGirlXOXO
                    Jul 8 '17 at 18:07






                  • 2





                    Ran into a long path issue. Thanks.

                    – Igal Karlinsky
                    Feb 5 '18 at 8:56






                  • 1





                    Does anyone know the virtualenv length limit?

                    – Greg Hilston
                    Apr 7 '18 at 15:39






                  • 2





                    Also ran into a length limit due to Jenkins workspace names. Character limit seemed to be 79 characters. CentOS7 AWS-hosted VM with kernel version 3.10.0-693.11.6.el7.x86_64

                    – Connor
                    Jun 6 '18 at 4:08







                  5




                  5





                  You're a hero. It's kind of ridiculous that pip can't handle spaces AND doesn't specifically throw that error.

                  – ProGirlXOXO
                  Jul 8 '17 at 18:07





                  You're a hero. It's kind of ridiculous that pip can't handle spaces AND doesn't specifically throw that error.

                  – ProGirlXOXO
                  Jul 8 '17 at 18:07




                  2




                  2





                  Ran into a long path issue. Thanks.

                  – Igal Karlinsky
                  Feb 5 '18 at 8:56





                  Ran into a long path issue. Thanks.

                  – Igal Karlinsky
                  Feb 5 '18 at 8:56




                  1




                  1





                  Does anyone know the virtualenv length limit?

                  – Greg Hilston
                  Apr 7 '18 at 15:39





                  Does anyone know the virtualenv length limit?

                  – Greg Hilston
                  Apr 7 '18 at 15:39




                  2




                  2





                  Also ran into a length limit due to Jenkins workspace names. Character limit seemed to be 79 characters. CentOS7 AWS-hosted VM with kernel version 3.10.0-693.11.6.el7.x86_64

                  – Connor
                  Jun 6 '18 at 4:08





                  Also ran into a length limit due to Jenkins workspace names. Character limit seemed to be 79 characters. CentOS7 AWS-hosted VM with kernel version 3.10.0-693.11.6.el7.x86_64

                  – Connor
                  Jun 6 '18 at 4:08











                  14














                  icktoofay is correct about the cause.



                  To use pip with virtualenv in a directory with spaces, edit /path/to/env/bin/pip, replacing the shebang at the top with #!/usr/bin/env python (or #!/usr/bin/env pypy if you're using pypy).



                  Note that virtualenv changes your environment such that /usr/bin/env python refers to the python defined by the virtualenv.






                  share|improve this answer

























                  • @icktoofay, virtualenv changes the PATH defined by env. Thus, /usr/bin/env python will refer to the python defined by the virtualenv.

                    – Bryan Head
                    Mar 1 '14 at 3:24











                  • You're right. That seems obvious now, but I missed that for some reason.

                    – icktoofay
                    Mar 1 '14 at 3:26











                  • No worries. I've changed my answer to make it clearer.

                    – Bryan Head
                    Mar 1 '14 at 3:29











                  • Thanks! Somewhere along a project setup process, I was told to change the folders' names, but I had already created the virtualenv. It was now no longer allowing me to use pip to install packages. Editing the bin/pip executable and fixing the path to the new name did the trick! :)

                    – Luca Bezerra
                    Dec 1 '16 at 20:11















                  14














                  icktoofay is correct about the cause.



                  To use pip with virtualenv in a directory with spaces, edit /path/to/env/bin/pip, replacing the shebang at the top with #!/usr/bin/env python (or #!/usr/bin/env pypy if you're using pypy).



                  Note that virtualenv changes your environment such that /usr/bin/env python refers to the python defined by the virtualenv.






                  share|improve this answer

























                  • @icktoofay, virtualenv changes the PATH defined by env. Thus, /usr/bin/env python will refer to the python defined by the virtualenv.

                    – Bryan Head
                    Mar 1 '14 at 3:24











                  • You're right. That seems obvious now, but I missed that for some reason.

                    – icktoofay
                    Mar 1 '14 at 3:26











                  • No worries. I've changed my answer to make it clearer.

                    – Bryan Head
                    Mar 1 '14 at 3:29











                  • Thanks! Somewhere along a project setup process, I was told to change the folders' names, but I had already created the virtualenv. It was now no longer allowing me to use pip to install packages. Editing the bin/pip executable and fixing the path to the new name did the trick! :)

                    – Luca Bezerra
                    Dec 1 '16 at 20:11













                  14












                  14








                  14







                  icktoofay is correct about the cause.



                  To use pip with virtualenv in a directory with spaces, edit /path/to/env/bin/pip, replacing the shebang at the top with #!/usr/bin/env python (or #!/usr/bin/env pypy if you're using pypy).



                  Note that virtualenv changes your environment such that /usr/bin/env python refers to the python defined by the virtualenv.






                  share|improve this answer















                  icktoofay is correct about the cause.



                  To use pip with virtualenv in a directory with spaces, edit /path/to/env/bin/pip, replacing the shebang at the top with #!/usr/bin/env python (or #!/usr/bin/env pypy if you're using pypy).



                  Note that virtualenv changes your environment such that /usr/bin/env python refers to the python defined by the virtualenv.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 1 '14 at 3:29

























                  answered Dec 4 '13 at 7:38









                  Bryan HeadBryan Head

                  9,61932445




                  9,61932445












                  • @icktoofay, virtualenv changes the PATH defined by env. Thus, /usr/bin/env python will refer to the python defined by the virtualenv.

                    – Bryan Head
                    Mar 1 '14 at 3:24











                  • You're right. That seems obvious now, but I missed that for some reason.

                    – icktoofay
                    Mar 1 '14 at 3:26











                  • No worries. I've changed my answer to make it clearer.

                    – Bryan Head
                    Mar 1 '14 at 3:29











                  • Thanks! Somewhere along a project setup process, I was told to change the folders' names, but I had already created the virtualenv. It was now no longer allowing me to use pip to install packages. Editing the bin/pip executable and fixing the path to the new name did the trick! :)

                    – Luca Bezerra
                    Dec 1 '16 at 20:11

















                  • @icktoofay, virtualenv changes the PATH defined by env. Thus, /usr/bin/env python will refer to the python defined by the virtualenv.

                    – Bryan Head
                    Mar 1 '14 at 3:24











                  • You're right. That seems obvious now, but I missed that for some reason.

                    – icktoofay
                    Mar 1 '14 at 3:26











                  • No worries. I've changed my answer to make it clearer.

                    – Bryan Head
                    Mar 1 '14 at 3:29











                  • Thanks! Somewhere along a project setup process, I was told to change the folders' names, but I had already created the virtualenv. It was now no longer allowing me to use pip to install packages. Editing the bin/pip executable and fixing the path to the new name did the trick! :)

                    – Luca Bezerra
                    Dec 1 '16 at 20:11
















                  @icktoofay, virtualenv changes the PATH defined by env. Thus, /usr/bin/env python will refer to the python defined by the virtualenv.

                  – Bryan Head
                  Mar 1 '14 at 3:24





                  @icktoofay, virtualenv changes the PATH defined by env. Thus, /usr/bin/env python will refer to the python defined by the virtualenv.

                  – Bryan Head
                  Mar 1 '14 at 3:24













                  You're right. That seems obvious now, but I missed that for some reason.

                  – icktoofay
                  Mar 1 '14 at 3:26





                  You're right. That seems obvious now, but I missed that for some reason.

                  – icktoofay
                  Mar 1 '14 at 3:26













                  No worries. I've changed my answer to make it clearer.

                  – Bryan Head
                  Mar 1 '14 at 3:29





                  No worries. I've changed my answer to make it clearer.

                  – Bryan Head
                  Mar 1 '14 at 3:29













                  Thanks! Somewhere along a project setup process, I was told to change the folders' names, but I had already created the virtualenv. It was now no longer allowing me to use pip to install packages. Editing the bin/pip executable and fixing the path to the new name did the trick! :)

                  – Luca Bezerra
                  Dec 1 '16 at 20:11





                  Thanks! Somewhere along a project setup process, I was told to change the folders' names, but I had already created the virtualenv. It was now no longer allowing me to use pip to install packages. Editing the bin/pip executable and fixing the path to the new name did the trick! :)

                  – Luca Bezerra
                  Dec 1 '16 at 20:11











                  1














                  I got the same error in RedHat. Python 2.7.3 is configured and made by myself.
                  [root@Ifx installer]# pip install Django
                  -bash: /usr/local/bin/pip: /usr/local/bin/python2.7: bad interpreter: Permission denied



                  Solution: In /usr/local/bin/pip, replace first line #!/usr/local/bin/python2.7 with your actual Python path #!/root/installer/Python-2.7.5/python






                  share|improve this answer



























                    1














                    I got the same error in RedHat. Python 2.7.3 is configured and made by myself.
                    [root@Ifx installer]# pip install Django
                    -bash: /usr/local/bin/pip: /usr/local/bin/python2.7: bad interpreter: Permission denied



                    Solution: In /usr/local/bin/pip, replace first line #!/usr/local/bin/python2.7 with your actual Python path #!/root/installer/Python-2.7.5/python






                    share|improve this answer

























                      1












                      1








                      1







                      I got the same error in RedHat. Python 2.7.3 is configured and made by myself.
                      [root@Ifx installer]# pip install Django
                      -bash: /usr/local/bin/pip: /usr/local/bin/python2.7: bad interpreter: Permission denied



                      Solution: In /usr/local/bin/pip, replace first line #!/usr/local/bin/python2.7 with your actual Python path #!/root/installer/Python-2.7.5/python






                      share|improve this answer













                      I got the same error in RedHat. Python 2.7.3 is configured and made by myself.
                      [root@Ifx installer]# pip install Django
                      -bash: /usr/local/bin/pip: /usr/local/bin/python2.7: bad interpreter: Permission denied



                      Solution: In /usr/local/bin/pip, replace first line #!/usr/local/bin/python2.7 with your actual Python path #!/root/installer/Python-2.7.5/python







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered May 22 '14 at 14:19









                      JackChen255JackChen255

                      110211




                      110211





















                          0














                          I had a very similar issue on my Windows 7 machine and struggled couple of days with that. Both paths, to my python distribution and to my VE had spaces in it. Couple of months before it worked fine. I found the following note on virtualenv website:



                          **Windows Notes**
                          [...] To create a virtualenv under a path with spaces in it on Windows, you’ll need the win32api library installed.


                          The following steps lead me to success:



                          1. Make sure I used pip to install virtualenv and it's the latest version (pip-7.1.0). Result: failure.

                          2. Install win32api. Result: failure (although there was some error at the very end of installation process).

                          3. Try to install my VE in a path without spaces. Result: failure.

                          4. Reinstall my Anaconda python distribution to the path that didn't contain the "[" and "]" brackets. VE had spaces in the path. Result: failure.

                          5. Reinstall my Anaconda python distribution to the path that also didn't contain any spaces. The VE folder still had spaces in the path. Result: success!

                          So at least the Anaconda (python) installation simple, non space-pollutted path was crucial. Maybe win32api installation was also important. Not sure.






                          share|improve this answer



























                            0














                            I had a very similar issue on my Windows 7 machine and struggled couple of days with that. Both paths, to my python distribution and to my VE had spaces in it. Couple of months before it worked fine. I found the following note on virtualenv website:



                            **Windows Notes**
                            [...] To create a virtualenv under a path with spaces in it on Windows, you’ll need the win32api library installed.


                            The following steps lead me to success:



                            1. Make sure I used pip to install virtualenv and it's the latest version (pip-7.1.0). Result: failure.

                            2. Install win32api. Result: failure (although there was some error at the very end of installation process).

                            3. Try to install my VE in a path without spaces. Result: failure.

                            4. Reinstall my Anaconda python distribution to the path that didn't contain the "[" and "]" brackets. VE had spaces in the path. Result: failure.

                            5. Reinstall my Anaconda python distribution to the path that also didn't contain any spaces. The VE folder still had spaces in the path. Result: success!

                            So at least the Anaconda (python) installation simple, non space-pollutted path was crucial. Maybe win32api installation was also important. Not sure.






                            share|improve this answer

























                              0












                              0








                              0







                              I had a very similar issue on my Windows 7 machine and struggled couple of days with that. Both paths, to my python distribution and to my VE had spaces in it. Couple of months before it worked fine. I found the following note on virtualenv website:



                              **Windows Notes**
                              [...] To create a virtualenv under a path with spaces in it on Windows, you’ll need the win32api library installed.


                              The following steps lead me to success:



                              1. Make sure I used pip to install virtualenv and it's the latest version (pip-7.1.0). Result: failure.

                              2. Install win32api. Result: failure (although there was some error at the very end of installation process).

                              3. Try to install my VE in a path without spaces. Result: failure.

                              4. Reinstall my Anaconda python distribution to the path that didn't contain the "[" and "]" brackets. VE had spaces in the path. Result: failure.

                              5. Reinstall my Anaconda python distribution to the path that also didn't contain any spaces. The VE folder still had spaces in the path. Result: success!

                              So at least the Anaconda (python) installation simple, non space-pollutted path was crucial. Maybe win32api installation was also important. Not sure.






                              share|improve this answer













                              I had a very similar issue on my Windows 7 machine and struggled couple of days with that. Both paths, to my python distribution and to my VE had spaces in it. Couple of months before it worked fine. I found the following note on virtualenv website:



                              **Windows Notes**
                              [...] To create a virtualenv under a path with spaces in it on Windows, you’ll need the win32api library installed.


                              The following steps lead me to success:



                              1. Make sure I used pip to install virtualenv and it's the latest version (pip-7.1.0). Result: failure.

                              2. Install win32api. Result: failure (although there was some error at the very end of installation process).

                              3. Try to install my VE in a path without spaces. Result: failure.

                              4. Reinstall my Anaconda python distribution to the path that didn't contain the "[" and "]" brackets. VE had spaces in the path. Result: failure.

                              5. Reinstall my Anaconda python distribution to the path that also didn't contain any spaces. The VE folder still had spaces in the path. Result: success!

                              So at least the Anaconda (python) installation simple, non space-pollutted path was crucial. Maybe win32api installation was also important. Not sure.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Aug 13 '15 at 1:54









                              ellockieellockie

                              95631224




                              95631224





















                                  0














                                  I found this from a Google search while experiencing the same problem and found this to be very useful. virtualenv now has a --relocatable flag that will rewrite the shebang command to #!/usr/bin/env <the_python_version_you_used_to_create_the_virtualenv>. It does come with some caveats, so be sure to read the documentation to understand the implications:



                                  https://virtualenv.pypa.io/en/stable/userguide/#making-environments-relocatable



                                  You need to use the same syntax to relocate the virtualenv as you did when creating it, otherwise the python version may be overwritten. This will work as expected...



                                  virtualenv --python=python3.5 env-test
                                  virtualenv --relocatable --python=python3.5 env-test


                                  whereas this will result in #!/usr/bin/env python2.7 (at least on my local environment)...



                                  virtualenv --python==python3.5 env-test
                                  virtualenv --relocatable env-test





                                  share|improve this answer























                                  • This does not fix the issue for me

                                    – Nicolas Bouliane
                                    May 13 '17 at 15:09















                                  0














                                  I found this from a Google search while experiencing the same problem and found this to be very useful. virtualenv now has a --relocatable flag that will rewrite the shebang command to #!/usr/bin/env <the_python_version_you_used_to_create_the_virtualenv>. It does come with some caveats, so be sure to read the documentation to understand the implications:



                                  https://virtualenv.pypa.io/en/stable/userguide/#making-environments-relocatable



                                  You need to use the same syntax to relocate the virtualenv as you did when creating it, otherwise the python version may be overwritten. This will work as expected...



                                  virtualenv --python=python3.5 env-test
                                  virtualenv --relocatable --python=python3.5 env-test


                                  whereas this will result in #!/usr/bin/env python2.7 (at least on my local environment)...



                                  virtualenv --python==python3.5 env-test
                                  virtualenv --relocatable env-test





                                  share|improve this answer























                                  • This does not fix the issue for me

                                    – Nicolas Bouliane
                                    May 13 '17 at 15:09













                                  0












                                  0








                                  0







                                  I found this from a Google search while experiencing the same problem and found this to be very useful. virtualenv now has a --relocatable flag that will rewrite the shebang command to #!/usr/bin/env <the_python_version_you_used_to_create_the_virtualenv>. It does come with some caveats, so be sure to read the documentation to understand the implications:



                                  https://virtualenv.pypa.io/en/stable/userguide/#making-environments-relocatable



                                  You need to use the same syntax to relocate the virtualenv as you did when creating it, otherwise the python version may be overwritten. This will work as expected...



                                  virtualenv --python=python3.5 env-test
                                  virtualenv --relocatable --python=python3.5 env-test


                                  whereas this will result in #!/usr/bin/env python2.7 (at least on my local environment)...



                                  virtualenv --python==python3.5 env-test
                                  virtualenv --relocatable env-test





                                  share|improve this answer













                                  I found this from a Google search while experiencing the same problem and found this to be very useful. virtualenv now has a --relocatable flag that will rewrite the shebang command to #!/usr/bin/env <the_python_version_you_used_to_create_the_virtualenv>. It does come with some caveats, so be sure to read the documentation to understand the implications:



                                  https://virtualenv.pypa.io/en/stable/userguide/#making-environments-relocatable



                                  You need to use the same syntax to relocate the virtualenv as you did when creating it, otherwise the python version may be overwritten. This will work as expected...



                                  virtualenv --python=python3.5 env-test
                                  virtualenv --relocatable --python=python3.5 env-test


                                  whereas this will result in #!/usr/bin/env python2.7 (at least on my local environment)...



                                  virtualenv --python==python3.5 env-test
                                  virtualenv --relocatable env-test






                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  answered Apr 6 '17 at 0:53









                                  bob dobbob dob

                                  1




                                  1












                                  • This does not fix the issue for me

                                    – Nicolas Bouliane
                                    May 13 '17 at 15:09

















                                  • This does not fix the issue for me

                                    – Nicolas Bouliane
                                    May 13 '17 at 15:09
















                                  This does not fix the issue for me

                                  – Nicolas Bouliane
                                  May 13 '17 at 15:09





                                  This does not fix the issue for me

                                  – Nicolas Bouliane
                                  May 13 '17 at 15:09











                                  0














                                  For my case, deactivate the environment and source bin/activate again works.



                                  It seems my folder content has same subfolder names as generated by virtualenv, such as bin, lib etc. And after copy in my files, reactivate the environment let virtualenv to update new information.






                                  share|improve this answer



























                                    0














                                    For my case, deactivate the environment and source bin/activate again works.



                                    It seems my folder content has same subfolder names as generated by virtualenv, such as bin, lib etc. And after copy in my files, reactivate the environment let virtualenv to update new information.






                                    share|improve this answer

























                                      0












                                      0








                                      0







                                      For my case, deactivate the environment and source bin/activate again works.



                                      It seems my folder content has same subfolder names as generated by virtualenv, such as bin, lib etc. And after copy in my files, reactivate the environment let virtualenv to update new information.






                                      share|improve this answer













                                      For my case, deactivate the environment and source bin/activate again works.



                                      It seems my folder content has same subfolder names as generated by virtualenv, such as bin, lib etc. And after copy in my files, reactivate the environment let virtualenv to update new information.







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Sep 13 '18 at 13:38









                                      Yushan ZhangYushan Zhang

                                      154114




                                      154114





















                                          0














                                          On Python 3.7 I didn't have any issues with this but when I had to use Python 3.6 I did have an issue. The most easy work-around I found on Github was this:



                                          Instead of:



                                          pip install -r requirements.txt


                                          I use:



                                          python env/bin/pip install -r requirements.txt


                                          So you actually directly point to the pip file within your virtual environment directory. Of course you need to activate it first before trying this. Hope this helps someone who comes here!






                                          share|improve this answer



























                                            0














                                            On Python 3.7 I didn't have any issues with this but when I had to use Python 3.6 I did have an issue. The most easy work-around I found on Github was this:



                                            Instead of:



                                            pip install -r requirements.txt


                                            I use:



                                            python env/bin/pip install -r requirements.txt


                                            So you actually directly point to the pip file within your virtual environment directory. Of course you need to activate it first before trying this. Hope this helps someone who comes here!






                                            share|improve this answer

























                                              0












                                              0








                                              0







                                              On Python 3.7 I didn't have any issues with this but when I had to use Python 3.6 I did have an issue. The most easy work-around I found on Github was this:



                                              Instead of:



                                              pip install -r requirements.txt


                                              I use:



                                              python env/bin/pip install -r requirements.txt


                                              So you actually directly point to the pip file within your virtual environment directory. Of course you need to activate it first before trying this. Hope this helps someone who comes here!






                                              share|improve this answer













                                              On Python 3.7 I didn't have any issues with this but when I had to use Python 3.6 I did have an issue. The most easy work-around I found on Github was this:



                                              Instead of:



                                              pip install -r requirements.txt


                                              I use:



                                              python env/bin/pip install -r requirements.txt


                                              So you actually directly point to the pip file within your virtual environment directory. Of course you need to activate it first before trying this. Hope this helps someone who comes here!







                                              share|improve this answer












                                              share|improve this answer



                                              share|improve this answer










                                              answered Nov 12 '18 at 15:44









                                              Bob de GraafBob de Graaf

                                              1,51511734




                                              1,51511734



























                                                  draft saved

                                                  draft discarded
















































                                                  Thanks for contributing an answer to Stack Overflow!


                                                  • Please be sure to answer the question. Provide details and share your research!

                                                  But avoid


                                                  • Asking for help, clarification, or responding to other answers.

                                                  • Making statements based on opinion; back them up with references or personal experience.

                                                  To learn more, see our tips on writing great answers.




                                                  draft saved


                                                  draft discarded














                                                  StackExchange.ready(
                                                  function ()
                                                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7911003%2fcant-install-via-pip-with-virtualenv%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

                                                  Kleinkühnau

                                                  Makov (Slowakei)

                                                  Deutsches Schauspielhaus