...
Grab the latest official release from Apache OCW website.
Warning | ||
---|---|---|
| ||
It should be noted that a number of the early releases are very unstable. |
Tip | ||
---|---|---|
| ||
It is recommended that you use one of the below options instead as it is easier for the development team to help you address any problems you may have. |
...
Before invoking conda to install the dependencies, it's always a good idea to ensure that your version of conda is up to date. You can do this with:
Code Block | ||
---|---|---|
| ||
# Update conda packages
$ conda update conda |
Then to install OCW and its dependencies into your conda environment (by default in ~/anaconda or ~/miniconda), you may use:
Code Block | ||
---|---|---|
| ||
conda install -c agoodman ocw # Add the conda-forge repository to your package manager $ conda config --add channels conda-forge # Install ocw to ~/anaconda or ~/miniconda2/3 # conda install ocw |
This installation method should work for all major platforms, making it particularly advantageous. Additional information for advanced users who wish to contribute to the project's development can be found here.
Using Easy-OCW
Warning | ||
---|---|---|
| ||
This particular installation method will be phased out in favor of using a conda package (described above). Use at your own risk. |
Easy OCW is designed to make installing the necessary dependencies for OCW work as easy as possible. If you plan to use Easy-OCW please follow the instructions on the Easy-OCW page for further guidance.
Manually Installing Dependencies
If you decide that you want to manually install the necessary dependencies you can follow the below steps. If you're on a system that Easy-OCW doesn't support, writing a script for your installation process would be a good place to start contributing to the project!
Install VirtualEnv and VirtualEnvWrapper
virtualenv is a tool for creating isolated Python environments and virtualenvwrapper makes using virtualenv super easy. You can install both by running the following commands:
Code Block | ||
---|---|---|
| ||
pip install virtualenv
pip install virtualenvwrapper |
If you don't have pip installed, you should check the pip documentation for guidance.
Now that we have this installed we need to create an environment into which we will install our dependencies.
We will create an environment called ocw that you should work on whenever you want to run the toolkit.
This makes sure that we don't clobber anything important on your system and keeps everything nicely separated.
Code Block | ||
---|---|---|
| ||
mkvirtualenv ocw |
When you are done using OCW you should run deactivate to deactivate the virtual environment. Later, if you want to use OCW you should run workon ocw to activate the virtual environment. Make sure you have it activated before you continue with the following steps!
Install Conda Dependencies
This will also check and install any other missing dependencies that Anaconda didn't provide you.
Code Block | ||
---|---|---|
| ||
cd $CLIMATE_ROOT/easy-ocw
conda install --file ocw-conda-dependencies.txt |
Option 2: Install conda manually instead of using Anaconda
Anaconda can be a bit bloated since we don't need a large majority of the packages that it includes. You can easily accomplish the same thing by manually installing conda, the package manager that Anaconda uses and installing the dependencies with that.
Code Block |
---|
cd $CLIMATE_ROOT/easy-ocw
pip install conda
conda init
conda install --file ocw-conda-dependencies.txt |
Note |
---|
If you didn't allow Anaconda to update your PATH, you may be told that the conda command cannot be found. Instead, you'll need to explicitly reference conda from the Anaconda install directory (default is ~/anaconda/bin) or update your PATH manually. |
Install Additional Dependencies
There are a few more dependencies that you should install with pip.
Warning |
---|
Make sure to "deactivate" your virtual environment first before proceeding, if (earlier in the guide) you chose "Option 1: Install Anaconda and various other dependencies". You may be presented with virtualenv / conda configuration conflicts otherwise. |
Code Block | ||
---|---|---|
| ||
cd $CLIMATE_ROOT/easy-ocw
pip install -r ocw-pip-dependencies.txt |
Make Everything Easier
The last thing we're going to do is make our ocw virtual environment a bit more helpful. Edit ~/.virtualenvs/postactivate in your favorite editor and add the following:
Code Block | ||
---|---|---|
| ||
if [ $VIRTUAL_ENV == "$HOME/.virtualenvs/ocw" ]
then
# You want this to point to where ever you installed Anaconda. By default, this should work.
PATH="$HOME/anaconda/bin":$PATH
# This makes sure OCW is loaded properly when running python. Unfortunately the toolkit is
# not installable at the moment so this step is necessary for the time being.
export PYTHONPATH="$HOME/climate/:$HOME/climate/ocw/:$PYTHONPATH"
fi |
This makes sure that whenever you are using the ocw virtual environment that the Anaconda Python is used (where all the awesome dependencies are installed!) and that your PYTHONPATH is set properly so the toolkit is loaded whenever you use Python.Don't worry though, when you deactivate the virtual environment your original variable values will be reset, so none of this will clobber your other work!
Test Your Installation
...
The easiest way to test your installation is to run one of the example scripts in $HOME/climate/examples.
...