Skip to content

Latest commit

 

History

History
79 lines (41 loc) · 5.79 KB

anaconda-navigator-getting-started.md

File metadata and controls

79 lines (41 loc) · 5.79 KB

Getting started with Anaconda Navigator

Anaconda itself is an freemium distribution of Python. It aims to make package management and deployment easier. Anaconda provides conda, a package management system.

Anaconda Navigator is a graphical interface for launching common Python programs without having to use command lines, to install packages and manage your environments. It also allows you to launch applications and easily manage conda packages, environments, and channels without using command-line commands.

Updating the 'ol-connectome' environment based on the 'requirements.txt' file.

Below is a step-by-step run through, with screenshots, of how to update your 'ol-connectome' environment based on the 'requirements.txt' file in the main 'optic-lobe-connectome' folder (this should already have been created as explained in the python-getting-started page). If you are using Microsoft Windows, you might need to take an extra step to install the C++ build tools.

Open the 'Anaconda Navigator' and look at the available environments

Once you have opened Anaconda Navigator you will need to click on the 'Environments' tab on the far left columnn. This will then display your available environmets in the second column. In the screenshot below you can see that in this case there are three available environments: 'base', 'ol-connectome' and 'pandas-playground'.

Screenshot of Anaconda Navigato with a list of available environments

Renaming the current 'ol-connectome' environment.

Although you can overwrite the current 'ol-connectome' environment directly based on the dependencies described in the 'requirements.txt' file, it is safer to simply generate a new environment with these dependencies. To do this, we must first rename the current 'ol-connectome' environment so that we might name the new, updated environment 'ol-connectome'. Keeping the name ensures consistency when running other people's code.

To do this, open an environment that is not 'ol-connectome', i.e. the 'base' environment in a terminal window by clicking on the green arrow to the side and choosing 'Open Terminal'. You cannot rename an environment if it is currently active, if you are in the 'ol-connectome' environment decactivate it by typing 'conda deactivate' in a terminal where you have that environment currently activated.

Anaconda navigator showing that a click on the triangle next to an environment lets you open a terminal

Anaconda navigator with terminal window opened in front of it

Once you have a terminal window open, where you can see you are in the env (base) you can then type:

conda rename -n current_env_name new_env_name`

Which in my case was:

conda rename -n ol-connectome ol-connectome-230907`

I am using a naming structure that appends the date of which I create the 'new' environment to the old one. I.e. the date when the old environment was last used in a YYMMDD format, but you could use any naming structure.

terminal window showing the process of renaming the environment

Once the environment has been renamed it should be updated automatically in Anaconda Navigator.

terminal floating over Anaconda Navigator displaying a new environment name

Generating a new environment based on the requirements in the 'requirements.txt' file

You can now click on the 'Import' button – found at the bottom of the second column of the navigator interface.

Anaconda Navigator with the Import button highlighted

When the pop-up window appears choose the top option: 'Local Drive' and click on the small folder icon to the right.

Anaconda Navigator Import window with Local drive selected

Anaconda Navigator with OS file selector pointing to the optic-lobe-connectome folder

Locate the 'optic-lobe-connectome' folder that might be found in your Github folder or wherever you cloned your repository at.

select pip requirements file instead of conda yaml to see the requirements.txt file

Select 'pip requirement files (*.txt)' from the drop-down box to be able to select the 'requirements.txt' file from within the 'optic-lobe-connectome' folder. Click 'open'.

select requirements.txt file in file selector

You will then be taken back to the pop-up window – make sure the 'New environment name:' is ol-connectome, then click 'Import'.

Anaconda Navigator import window confirming the location of the requirements file and the name of the new environment

While the navigator is importing the new packages into this environment it will look like this:

Anaconda Navigator while building the new environment

Once the updated environment is ready you will see it added to your list of available environments in the second column.

the new environment ol-connectome shown in the Anaconda Navigator