Navigation

If you plan to do regular work on astropy you should do your development in
a python virtual environment. Conceptually a virtual environment is a
duplicate of the python environment you normally work in with as many (or as
few) of the packages from your normal environment included in that virtual
environment. It is sandboxed from your normal python environment in the sense
that packages installed in the virtual environment do not affect your normal
environment in any way.

Note

“Normal python environment” means whatever python you are using when you
log in.

There are two options for using virtual environments; the choice of method is
dictated by the python distribution you use:

If you use the anaconda python distribution you must use conda to make
and manage your virtual environments.

This needs to be done once for each virtual environment you want. There is one
important choice you need to make when you create a virtual environment:
which, if any, of the packages installed in your normal python environment do
you want in your virtual environment?

Including them in your virtual environment doesn’t take much extra space–they
are linked into the virtual environment instead of being copied. Within the
virtual environment you can install new versions of packages like Numpy or
Astropy that override the versions installed in your normal python environment.

The easiest way to get started is to include in your virtual environment the
packages installed in your your normal python environment; the instructions
below do that.

In everything that follows, ENV represents the name you give your virtual
environment.

To use a new virtual environment you may need to activate it;
virtualenvwrapper will try to automatically activate your new environment
when you create it. Activation does two things (either of which you could do
manually, though it would be inconvenient):

Put the bin directory for the virtual environment at the front of your
$PATH.

Add the name of the virtual environment to your command prompt. If you have
successfully switched to a new environment called ENV your prompt should
look something like this: (ENV)[~]$

The commands below allow you to switch between virtual environments in
addition to activating new ones.