1

I have installed virtualenv using the command pip install virtualenv and it gave me this.

pip install virtualenv
Downloading/unpacking virtualenv
 Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB): 0% Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB): 0% Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB): 1.8MB downloaded
Installing collected packages: virtualenv
Successfully installed virtualenv
Cleaning up...

Now you can see that virtualenv is installed to confirm this i have tested like this,

 ubuntu@ubuntu  ~  which pip
/usr/bin/pip
 ubuntu@ubuntu  ~  which python
/usr/bin/python
 ubuntu@ubuntu  ~  which virtualenv
virtualenv not found
 ✘ ubuntu@ubuntu  ~  python --version
Python 2.7.12
ubuntu@ubuntu  ~  pip --version
pip 1.5.6 from /usr/lib/python2.7/dist-packages (python 2.7)

Now real problem is that i want to create a virtualenv i have entered command

virtualenv env --no-site-packages and it gave me error.

command not found: virtualenv

Any solutions to this problem.I have also using ubuntu -16 with all updates installed.

bfontaine
21.4k16 gold badges88 silver badges128 bronze badges
asked Dec 18, 2016 at 18:03
5
  • The executable of virtualenv seems not to be in the load-path. Just reopening the terminal might already help, otherwise pip show virtualenv shows you the location that you can then add to your load-path. Commented Dec 18, 2016 at 18:07
  • 1
    ubuntu@ubuntu  ~  pip show virtualenv --- Name: virtualenv Version: 15.1.0 Location: /home/ubuntu/.local/lib/python2.7/site-packages Requires: ubuntu@ubuntu  ~  virtualenv zsh: command not found: virtualenv Commented Dec 18, 2016 at 18:07
  • What is the output of echo $PATH? Commented Dec 18, 2016 at 18:09
  • /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin Commented Dec 18, 2016 at 18:09
  • You should never install using pip in your Linux systems' python, you might break your system. Apart from that the current pip version is 9.0.1, that what you have there is outdated and insecure. See e.g. stackoverflow.com/a/30692103/1307905 on how to properly create and use virtualenv in a virtual env. Commented Dec 18, 2016 at 18:17

1 Answer 1

5

You should use your system's package manger to install it instead of pip. On Ubuntu, you can run:

apt-get install python-virtualenv

You will then see output from the 'which' command.

answered Dec 18, 2016 at 19:38
Sign up to request clarification or add additional context in comments.

4 Comments

In addition to this correct answer: /usr/bin/pip could not install virtualenv into system directories because regular user "ubuntu" cannot write into /usr/bin/. Then virtualenv was installed into user install directory, so you can launch it as /home/ubuntu/.local/bin/virtualenv. Optionally, append ~/.local/bin to $PATH.
This might work but should not be recommended. Installing this way gives you virtualenv 1.11. The current version of virtualenv is 15.1, which has many bug fixes, and works with a more modern versions of pip for further installs (with their own bug and security fixes). Since you can install virtualenv directly in a virtualenv without needing root prileges, the normal excuse that you should not litter your installation with non-tracked data doesn't hold.
@Anthon it looks like 15.1 is available in the Ubuntu 16 repos packages.ubuntu.com/xenial/python/python-virtualenv
Correction - 15.0.1

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.