Installation
The instructions below are for installing RWGEN as a developer on a Windows operating system. Some steps will not be needed once the package has been released on PyPI. A note on updating an existing RWGEN version is also given below - see Installing RWGEN.
Python and the RWGEN dependencies can be installed using the conda package manager. Miniconda provides a lightweight implementation.
Installing Miniconda
The conda website provides instructions for installing Miniconda. Installation on Windows involves downloading and running an installer (use the installer for the most recent Python version).
Note
The second step of the instructions (verify your installer hashes) can typically be skipped.
Updating and Configuring Conda
A few settings need to be adjusted after installing conda. To do this open the
Anaconda Prompt (press the Windows button and then start typing
anaconda prompt
). This should give you a prompt that looks similar to the
Windows Command Prompt.
Update conda by typing the following (enter y
when prompted):
conda update -n base -c defaults conda
Next add the conda-forge channel with the two commands:
conda config --add channels conda-forge
conda config --set channel_priority strict
The conda-forge channel is needed to help manage dependencies.
Getting the RWGEN Files
Download the rwgen-0.0.6
files as a zip file (if you do not have it
already) and unzip. It is recommended to create a RWGEN
folder somewhere
- e.g. H:/RWGEN
.
Note that Windows Extract All...
adds the zip file name (e.g.
rwgen-0.0.6
) to the default location for unzipping. This can be deleted, as
the zip file already contains an rwgen-0.0.6
folder housing all other
files.
If the target folder is H:/RWGEN
then we should end up with a folder
H:/RWGEN/rwgen-0.0.6
, which contains sub-folders docs, examples, rwgen
and some files (e.g. setup.py, environment.yml, ...
).
Creating the Conda Environment
In the Anaconda Prompt (or open a new one if closed - see the
Updating and Configuring Conda section) and navigate (at the prompt) to the
unzipped rwgen-0.0.6
folder.
For example, to change from the directory C:/
to the directory
H:/RWGEN/rwgen-0.0.6
, first switch drives by typing:
H:
Then to change to H:/RWGEN/rwgen-0.0.6
enter
cd H:/RWGEN/rwgen-0.0.6
This folder should contain a file called environment.yml
, which lists all
of the dependencies required by RWGEN.
Note
If you already have an environment for rwgen installed that you want to
update, it may be easiest to remove the existing environment and reinstall.
The existing environment can be removed at this point by using
conda env remove --name rwgen
(if your existing environment name is
rwgen
. You can now proceed with the rest of the instructions.
Create a specific conda environment for RWGEN by typing:
conda env create --name rwgen --file environment.yml
The environment name can be set to something other than rwgen
if preferred.
It may take a few minutes for the environment to be created as conda installs
the dependencies that we need.
Activate the environment before continuing:
conda activate rwgen
Note
If we want to deactivate the rwgen environment at any point we can just
enter conda deactivate
.
Installing RWGEN
Note
If you already have a version of RWGEN installed in the activated
environment but would like to update it to a newer version, first
uninstall the current version by entering pip uninstall rwgen
. Then
proceed to install the new version as below.
At the Anaconda Prompt (while still in the rwgen-0.0.6
folder), type the
following (including the .
) to install RWGEN in developer mode:
pip install -e .
The installation can be initially tested by opening an interactive Python session, which is done by entering:
python
In the Python session type:
import rwgen
This command should not return anything (i.e. anything that is printed to screen will be a warning or an error).
Close the Python session by typing:
exit()