Surprisingly, googling "virtualenv" leads you to the
virtualenv documentation. If you want to use it, I suggest at least a quick read-through.
As the name suggests,
virtualenv is a tool to create isolated or "virtual" environments for Python. It allows you to set up multiple independent instances for different projects, each with their own modules and even versions of Python. This is useful in a variety of circumstances, not least when you don't have admin access and want to install Python modules. From the docs:
The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into
/usr/lib/python2.7/site-packages (or whatever your platform’s standard location is), it’s easy to end up in a situation where you unintentionally upgrade an application that shouldn’t be upgraded.
Or more generally, what if you want to install an application and leave it be? If an application works, any change in its libraries or the versions of those libraries can break the application.
Also, what if you can’t install packages into the global
site-packages directory? For instance, on a shared host.
In all these cases,
virtualenv can help you. It creates an environment that has its own installation directories, that doesn’t share libraries with other virtualenv environments (and optionally doesn’t access the globally installed libraries either).
So there you have it.
lib/ is where the modules live.
include/ is for headers and other shared stuff.
local/ is for stuff that lives outside of the main
) module home, like your own applications. And finally,bin/` is where executables live.
/tmp directory is, just as it sounds, a temp directory - used for storing things temporarily. Depending on the system, they may or may not be removed periodically, or when the system is rebooted. Or not, it depends. Your first command created a subdirectory of
Your second command,
source, basically means "run the commands listed in this file". It is a built-in command, part of the shell. The result of this command is to start the virtual environment. You should now see
(venv) prefixed to your shell prompt.
Once inside, you used the Python Installer Program, or
pip, which is automatically included in every virtualenv.
pip communicates with the Python Package Index or PyPI. This is the closest thing the Python community has to a central repository, similar to Perl's CPAN or Ruby's rubygems.org. In your case,
pip was looking for the
ipython-notebook module, which unfortunately does not exist (the notebook is part of the core IPython installation). Had you run
pip install ipython you would have gotten something along the lines of:
Downloading ipython-0.13.2.zip (6.4MB): 6.4MB downloaded
Running setup.py egg_info for package ipython
Installing collected packages: ipython
Running setup.py install for ipython
Installing ipcluster3 script to /tmp/vetest/bin
Installing irunner3 script to /tmp/vetest/bin
Installing ipcontroller3 script to /tmp/vetest/bin
Installing iptest3 script to /tmp/vetest/bin
Installing pycolor3 script to /tmp/vetest/bin
Installing iplogger3 script to /tmp/vetest/bin
Installing ipengine3 script to /tmp/vetest/bin
Installing ipython3 script to /tmp/vetest/bin
Successfully installed ipython
/tmp/vetest, you could now type
ipython3 notebook (assuming you have Python 3, which you should be using anyways) to start the IPython Notebook server, and a session in your browser. Unfortunately, it will fail because you lack a bunch of dependencies like
tornado, but these are easily installed using
pip. A list of basic dependencies is available on the IPython website. Additional functionality like
deactivate command exits your