Installation and setup

Install Neptune client for Python

Neptune comes with a client library neptune-client.

Before you start

Make sure you meet the following prerequisites before starting:

  • Have Python 3.6+ installed.

Install neptune-client

Depending on your operating system open a terminal or CMD and run this command:

pip
conda
pip
pip install neptune-client
conda
conda install -c conda-forge neptune-client

Install psutil

If you want to have your hardware consumption logged you should additionally install psutil.

pip
conda
pip
pip install psutil
conda
conda install -c anaconda psutil

Install Neptune client for R

The Neptune integration with R is available as a CRAN package and a Github project.

Before you start

Make sure you meet the following prerequisites before starting:

  • Have Python 3.x installed.

Warning

Even if you are using R you still need to have Python installed on your system. The easiest way to install Python environment is with Conda. Go here to read installation instructions.

Install neptune package

Install the package by running:

install.packages('neptune')

Authentication (Neptune API token)

Get API token

NEPTUNE_API_TOKEN is located under your user menu (top right side of the screen):

Set to the environment variable

Assign it to the bash environment variable:

Linux
Windows
macOS
Notebook
Linux
export NEPTUNE_API_TOKEN='YOUR_LONG_API_TOKEN'
Windows
set NEPTUNE_API_TOKEN="YOUR_LONG_API_TOKEN"
macOS
export NEPTUNE_API_TOKEN='YOUR_LONG_API_TOKEN'
Notebook
from getpass import getpass
api_token = getpass('Enter your private Neptune API token: ')

or append this line to your ~/.bashrc or ~/.bash_profile files (recommended).

Always keep your API token secret - it is like a password to the application. Appending the “export NEPTUNE_API_TOKEN=’YOUR_LONG_API_TOKEN’” line to your ~/.bashrc or ~/.bash_profile file is the recommended method to ensure it remains secret.

Pass API token in scripts

Python

Once your API token is set to the NEPTUNE_API_TOKEN environment variable you can simply skip the api_token argument of the init().

run = neptune.init(project='my_workspace/my_project')

R

The suggested way to pass your api_token is to store your key in an environment variable and pass it using Sys.getenv('MY_NEPTUNE_KEY').

init_neptune(project_name = 'my_workspace/my_project',
api_token = Sys.getenv('NEPTUNE_API_TOKEN')
)

You can set your environment variable NEPTUNE_API_TOKEN with your API token directly from R with:

Sys.setenv('NEPTUNE_API_TOKEN'='YOUR_TOKEN')

Setting the project name

To log Runs into a Project you need to know the full name of your Project. It has a format of:workspace_name/project_name and the easiest way to get it is to:

  • go to your project in the Neptune UI

  • go to Settings

  • go to Properties

  • copy the full project name from there

Once you have your full project name, you can pass the full project name into the project argument of neptune.init()

# Create run in project
run = neptune.init(project='my_workspace/my_project')

Deploy Neptune on your own server (on-premises)

You can also deploy Neptune on your own infrastructure. If you are interested in that read:

How to deploy Neptune on-prem

What is next?