Virtualenv Team Not Found

I could not get virtualenv to work despite various attempts. I installed virtualenv on MAC OS X using:

 pip install virtualenv 

and also added PATH to my .bash_profile . Every time I try to run the virtualenv command, it returns:

 -bash: virtualenv: command not found 

Each time I run pip install virtualenv , it returns:

 Requirement already satisfied (use --upgrade to upgrade): virtualenv in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages 

I understand that on mac, virtualenv must be installed correctly in

 /usr/local/bin 

virtualenv indeed installed in /usr/local/bin , but whenever I try to run the virtualenv command, the command was not found. I also tried running the virtualenv command in the /usr/local/bin , and this gives me the same result:

 -bash: virtualenv: command not found 

This is the PATH that I added to my .bash_profile

 export PATH=$PATH:/usr/local/bin export PATH=$PATH:/usr/local/bin/python export PATH=$PATH:/Library/Framework/Python.framework/Version/2.7/lib/site-packages 

Any workarounds for this? Why is this so?

+152
python virtualenv macos
Jun 30 '15 at 8:17
source share
18 answers

If you installed it using

 pip install virtualenv 

What you need to do is run:

 sudo /usr/bin/easy_install virtualenv 

which puts it in / usr / local / bin /. The default directory above should be in your PATH; otherwise, edit your .zshrc (or .bashrc) accordingly.

+267
Jan 02 '17 at 15:09 on
source share

I ran into the same problem, and that is how I solved it:

  • The problem occurred to me because I installed virtualenv via pip as a regular user (and not root). pip installed packages into the ~/.local/lib/pythonX.X/site-packages directory
  • When I started pip as root or as administrator (sudo), it installed packages in /usr/lib/pythonX.X/dist-packages . This path may be different for you.
  • virtualenv command is recognized only in the second script
  • So, to solve the problem, do pip uninstall virtualenv and then reinstall it using sudo pip install virtualenv (or install as root user)
+121
May 15 '16 at 19:05
source share

The simplest answer. Simply:

 pip uninstall virtualenv 

and then:

 pip install virtualenv 

Or you might have installed virtualenv with sudo , in this case:

 pip install --user virtualenv 
+29
Jan 04 '18 at 3:27
source share

On Ubuntu 18.04 LTS, I also encountered the same error. The following command worked:

 sudo apt-get install python-virtualenv 
+26
May 11 '18 at 16:00
source share

I had the same issue on Mac OS X El Capitan .

When I installed virtualenv like this sudo pip3 install virtualenv , I did not have virtualenv on my command line.

I solved this problem by following these steps:

  • Delete previous installations.
  • Switch to the superuser account before installing virtualenv by calling sudo su
  • Install virtualenv by calling pip3 install virtualenv
  • Finally, you must have access to virtualenv from the user account and super user .
+21
Dec 13 '16 at 7:29
source share

You said that every time you run pip install , you get Requirement already satisfied (use --upgrade to upgrade): virtualenv in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages . What you need to do is the following:

  • Change directory (go to virtualenv.py file) cd /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
  • If you execute ls , you will see that the script is virtualenv.py
  • Run the script as follows: python virtualenv.py --distribute /the/path/at/which/you/want/the/new/venv/at theNameOfTheNewVirtualEnv

Hope this helps. My advice would be to investigate venvs more. Here is a good resource: https://www.dabapps.com/blog/introduction-to-pip-and-virtualenv-python/

+9
Apr 12 '16 at 15:04
source share

Find out the problem

Try checking --verbose

 pip install virtualenv --verbose 

The result will look something like this.

  .. Using cached virtualenv-15.1.0-py2.py3-none-any.whl Downloading from URL https://pypi.python.org/packages/6f/86/3dc328ee7b1a6419ebfac7896d882fba83c48e3561d22ddddf38294d3e83/virtualenv-15.1.0-py2.py3-none-any.whl#md5=aa7e5b86cc8cdb99794c4b99e8d670f3 (from https://pypi.python.org/simple/virtualenv/) Installing collected packages: virtualenv changing mode of /home/manos/.local/bin/virtualenv to 755 Successfully installed virtualenv-15.1.0 Cleaning up... 

At the output, we see that it is installed in /home/manos/.local/bin/virtualenv , so let PATH include it.

 echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin 

In my case, we can clearly see that /home/manos/.local/bin completely missing and that the shell cannot find the program.

Solutions

We can solve this in many ways:

  • We can install directly to a specific directory by going through the pip parameters (not recommended).
  • Create the appropriate symbolic links in /usr/local/bin or similar.
  • Add /home/manos/.local/bin to PATH.
  • Install as sudo to install directly on /usr/local/bin

The last two options are probably the most reasonable. The last solution is the simplest, so I'll just show solution 3.

Add this to ~ / .profile:

 PATH="$PATH:$HOME/.local/bin" 

Log out again and it should work.

+9
May 27 '17 at 22:13
source share

I had problems because I used apt to install the python-virtualenv package. To make it work, I had to remove this package using apt-get remove python-virtualenv and install it using pip install virtualenv .

+8
Jun 09 '17 at 9:36 on
source share

In my case, I ran pip show virtualenv to get virtualenv package info. I will look something like this, and also show the location of the package:

 user@machine:~$ pip show virtualenv Name: virtualenv Version: 16.2.0 Summary: Virtual Python Environment builder Home-page: https://virtualenv.pypa.io/ Author: Ian Bicking Author-email: ianb@colorstudy.com License: MIT Location: /home/user/.local/lib/python3.6/site-packages Requires: setuptools 

From this, capture the location part to the .local part, which in this case is /home/user/.local/ . /home/user/.local/bin/virtualenv virtualenv can be found in /home/user/.local/bin/virtualenv .

Then you can run commands like /home/user/.local/bin/virtualenv newvirtualenv .

+6
Jan 18 '19 at 12:08
source share

I think your problem can be solved with a simple symbolic link , but you are creating a symbolic link to the wrong file . As far as I know, virtualenv is installed on /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenv (you can change the numbers for your version of Python), so the command To create a symbolic link / strong> should be:

 ln -s /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenv /usr/local/bin/virtualenv 
+4
Jun 08 '17 at 22:33
source share

One and the same problem: so I just did pip uninstall virtualenv then pip install virtualenv

 pip install virtualenv --user 

Collecting virtualenv Using cached https://files.pythonhosted.org/packages/b6/30/96a02b2287098b23b875bc8c2f58071c35d2efe84f747b64d523721dc2b5/virtualenv-16.0.0-py2.py3-none-anyvwhl installed

Then I got this:

The virtualenv script is installed in '/Users/brahim/Library/Python/2.7/bin', which is not in PATH. Consider adding this directory to your PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

which clearly indicates where it is installed and what to do to get it

+4
Sep 12 '18 at 23:56 on
source share

On Ubuntu 18.4 on AWS, installing with pip does not work correctly. Using apt-get install the problem was solved for me.

 sudo apt-get install python-virtualenv 

and check

 virtualenv --version 
+4
Jan 11 '19 at 15:22
source share

Make sure virtualenv doable.

If virtualenv not found, the full path works ( /usr/local/bin/virtualenv ).

+2
Apr 03 '16 at 4:12
source share

If you are using Linux, open your terminal and enter virtualenv halfway and autocomplete using the tab key. If your system does not automatically complete virtualenv installation by running:

 mycomp$sudo apt-get install virtualenv //if you're already super user. mycomp#apt-get install virtualenv 

Now you can go where you want to create your project, and follow these steps:

 myprj$pip3 install virtualenv //to install python 3.5 and above myprj$virtualenv venv --python=python3.5 //to activate virtualenv (venv)myprj$source venv/bin/activate (venv)myprj$deactivate 
+2
Oct 08 '18 at 12:24
source share
 apt update apt upgrade apt install ufw python virtualenv git unzip pv 

3 teams and everything works!

+1
Jun 20 '19 at 15:19
source share

python3 -m virtualenv virtualenv_name

python -m virtualenv virtualenv_name

+1
Aug 20 '19 at 6:29
source share

Follow these basic steps to configure virtual env

 sudo pip install virtualenv virtualenvwrapper sudo rm -rf ~/get-pip.py ~/.cache/pip 

we need to update ~/.bashrc

 export WORKON_HOME=$HOME/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh 

The ~/.bashrc is just a shell script that Bash runs whenever you launch a new terminal. Usually you use this file to install various configurations. In this case, we set an environment variable called WORKON_HOME to point to the directory in which our virtual Python environments live. Then we load any necessary configurations from virtualenvwrapper.

To update the ~/.bashrc , just use a standard text editor, nano is most likely the easiest to use. A simpler solution is to use the cat command and completely eliminate the editors:

 echo -e "\n# virtualenv and virtualenvwrapper" >> ~/.bashrc echo "export WORKON_HOME=$HOME/.virtualenvs" >> ~/.bashrc echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc 

After editing our ~ / .bashrc file, we need to reload the changes:

 source ~/.bashrc 

Now that we have installed virtualenv and virtualenvwrapper, the next step is to actually create a virtual Python environment - we do this with the mkvirtualenv command.

 mkvirtualenv YOURENV 
0
05 Oct '17 at 6:49
source share
 sudo apt-get install python-virtualenv 
-four
Aug 09 '16 at 6:49
source share



All Articles