Basic KGTK Installation
The following instructions install KGTK and the KGTK Jupyter Notebooks on Linux and MacOS systems.
If you want to install KGTK on a Microsoft Windows system, please contact the KGTK team.
Our KGTK installations use a Conda virtual environment. If you don't have the Conda tools installed, follow this guide to install it. We recommend installing Miniconda installation rather than the full Anaconda installation.
Next, execute the following steps to install the latest stable release of KGTK:
conda create -n kgtk-env python=3.9 conda activate kgtk-env conda install -c conda-forge graph-tool conda install -c conda-forge jupyterlab pip --no-cache install -U kgtk
You may sometimes need to install a specific release of KGTK, such as a prerelease that incorporates the latest changes. For example, if you need to install KGTK release
1.1.0, use the following
pipcommand instead of the
pipcommand shown above:
pip --no-cache install kgtk==1.1.0
If you encounter problems with your installation, or are interested in a detailed explanation of these commands, read more about the installation procedure here.
Running KGTK commands¶
To list all the available KGTK commands, run:
To see the arguments of a particular KGTK command, run:
kgtk <command> -h
See our online documentation for additional suggestions.
Installing the KGTK Tutorial and Other Jupyter Notebooks¶
Choose a folder in which you want to install the KGTK Tutorial and other Jupyter notebooks. Change your current working directory to that foder.
/path/to/install/kgtk/tutorialis an appropriate filesystem path of your choice.
Next, execute the following command:
git clone https://github.com/usc-isi-i2/kgtk-notebooks.git
This will create a new folder (
kgtk-notebooks) in your existing folder,
then download the KGTK Tutorial and other Jupyter notebook files into
the new folder.
Change your current working directory to the
You are now in your
kgtk-notebooks folder and ready to start the
KGTK Tutorial using Jupyter Lab.
Running the KGTK Tutorial and Other Jupyter Notebooks¶
kgtk-notebooks folder, start the first KGTK Tutorial notebook using the
jupyter lab part1-kgtk-intro.ipynb
This will start a Jupyter Lab notebook server in your current terminal session. Depending upon your system configuration, a Jupyter Lab interface will automatically open in one of your Web browser windows, or you can use the URI that the Jupyter Labs server prints to open a Jupyter Lab interface in your Web browser manually.
Resuming Work with KGTK in a New Terminal Session¶
If you have started a new terminal session and want to resume work with
KGTK, first execute the following command in the new terminal session in order
to activate your
kgtk-env Conda virtual environment:
conda activate kgtk-env
You should now be able to execute KGTK commands on the command line.
If you want to start a new Jupiter Lab notebook server, activate your Conda virtual environment as shown above and then enter:
cd /path/to/install/kgtk/tutorial/kgtk-notebooks jupyter lab
/path/to/install/kgtk/tutorialis the path you originally choose for installation of the KGTK Tutorial and other Jupyter notebooks.
Use the Jupyter Lab interface to select the KGTK Tutorial notebook on which you wish to resume work, or to select a new notebook to begin.
If you know the name of the notebook you want to start, you may put it on the end of the
jupyter labcommand line:
jupiter lab some-notebook-name.ipynb
Updating your KGTK installation¶
To get the latest stable release of the KGTK commands, execute the following commands:
conda activate kgtk-env pip --no-cache install -U kgtk
To get the latest KGTK Jupyter notebooks, execute the following commands:
conda activate kgtk-env cd /path/to/install/kgtk/tutorial/kgtk-notebooks git pull
conda activate kgtk-envcommands shown above are not needed if you have already activated your
kgtk-envConda virtual environment in your current terminal session.