0% found this document useful (0 votes)
136 views

Building Anaconda Navigator Applications - Anaconda Documentation

This tutorial describes how to build an Anaconda Navigator application from a JupyterLab recipe. Three modifications are made to the recipe files to declare it as an app: removing noarch, adding an app section, and including launch scripts. The app is then built, uploaded to Anaconda Cloud, and configured in Anaconda Navigator. Troubleshooting tips are provided if the app fails to build, appear, or launch correctly.

Uploaded by

Ahmed Mohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views

Building Anaconda Navigator Applications - Anaconda Documentation

This tutorial describes how to build an Anaconda Navigator application from a JupyterLab recipe. Three modifications are made to the recipe files to declare it as an app: removing noarch, adding an app section, and including launch scripts. The app is then built, uploaded to Anaconda Cloud, and configured in Anaconda Navigator. Troubleshooting tips are provided if the app fails to build, appear, or launch correctly.

Uploaded by

Ahmed Mohamed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

(../../../..

(../../../../)

Building Anaconda Navigator


applications
Who is this for?
Before you start
Using a recipe
Build architecture
App entry in meta.yaml
Build
Upload to Anaconda Cloud
Configure Anaconda Navigator
Troubleshooting
Additional Information

This tutorial will build an Anaconda Navigator Application (app) of JupyterLab.


Three modifications to the files in the build recipe are required to declare the package as an app.
Then, we’ll build JupyterLab with these recipe modifications. After we build the package, we will
upload it to an Anaconda Cloud channel. Finally, after adding the channel in Anaconda Navigator, the
app will appear on the Home pane.

Who is this for?


This tutorial is for Windows, macOS, and Linux users who wish to generate an Anaconda Navigator
app conda package from a given recipe. Prior knowledge of conda-build or conda recipes is
recommended.

Before you start

i Note

Applications to be built for Anaconda Navigator should have a graphical user interface. Not all
conda packages have graphical interfaces.

You should already have installed Miniconda or Anaconda. Install conda-build:


conda install conda-build

It is recommended that you use the latest versions of conda and conda-build. To upgrade both
packages run:

conda upgrade conda  v: latest 


conda upgrade conda-build
You will also need an account on Anaconda Cloud. Your username will be referred to as your
Anaconda Cloud channel.

Using a recipe
First, make a new directory called jupyterlab and then change to the new directory:

mkdir jupyterlab
cd jupyterlab

Create the recipe by opening a text file and name it meta.yaml. Copy the recipe from the feedstock
(https://github.com/anacondarecipes/jupyterlab-feedstock/blob/master/recipe/meta.yaml):

{% set version = "1.2.4" %}


{% set sha256 = "6adb88acd05b51512c37df477a18c36240823a591c2a51bf6556198414026

package:
name: jupyterlab
version: {{ version }}

source:
fn: jupyterlab-{{ version }}.tar.gz
url: https://pypi.io/packages/source/j/jupyterlab/jupyterlab-{{ version }}
sha256: {{ sha256 }}
build:
noarch: python
number: 0
script: {{ PYTHON }} -m pip install --install-option="--skip-npm" . -vv
entry_points:
- jupyter-lab = jupyterlab.labapp:main
- jupyter-labextension = jupyterlab.labextensions:main
- jupyter-labhub = jupyterlab.labhubapp:main
- jlpm = jupyterlab.jlpmapp:main

app:
entry: jupyter lab
icon: icon.png
summary: JupyterLab PRE-ALPHA
type: desk

Build architecture
The recipe, as given, is a noarch recipe. This is not compatible with older versions of Navigator.
Under the build section, remove noarch: python .

App entry in meta.yaml


To declare a conda package as an app, the app parameter must be added to to the meta.yaml file.
The app section will contain three keys: entry, summary, and type. In the case of the JupyterLab
recipe, replace the app section in the meta.yaml with the values below.
In the app section, the entry tag defines how the package is to be launched by Anaconda Navigator.
For JupyterLab, separate entry tags are required for Windows, macOS, and Linux operating systems.
 v: latest 
In your text editor, open the meta.yaml file and add the following lines. On Windows and Linux the
entry tag is:
app:
entry: jupyterlab . [win]

entry: jupyterlab [linux]

Launch script
For macOS, a launch script must also be provided. In a text editor, create a new file in the conda-
build recipe directory called jupyterlab_mac.command. The contents of this file are:

DIR=$(dirname $0)
$DIR/jupyter-lab ${HOME}

Build.sh script
To make sure that the file gets installed, create a new file in the same directory as the meta.yaml.
Title it build.sh and add these lines to the build.sh script:

$PYTHON -m pip install . --no-deps --ignore-installed -vv


if [ `uname` == Darwin ]

then
cp $RECIPE_DIR/jupyterlab_mac.command $PREFIX/bin

fi
Remove the script key under the build section in the meta.yaml.

Build.bat
Create a new file called build.bat. Include the following:

%PYTHON% -m pip install . --no-deps --ignore-installed -vv

Entry key
Then in the meta.yaml, add this line to the app section:
The completed app section should look like this:

i Note

The app icon defaults to the Anaconda logo.

Build
Now that you have the conda-build recipe ready, you can use the conda-build tool to create the
package. You will have to build and upload the JupyterLab package separately on Windows, macOS,
and Linux machines in order for the package to be available on all platforms. If you’re already in the
JupyterLab directory, you can type conda build . in your terminal. Otherwise type conda-build
jupyterlab .

When conda-build is finished, it displays the exact path and filename of the conda package. See the
Troubleshooting (https://docs.conda.io/projects/conda-build/en/latest/user-guide/tutorials/build-pkgs-
skeleton.html#troubleshooting) section if the conda-build command fails.
 v: latest 
Windows example file path: C:\Users\username\miniconda\conda-bld\win-64\jupyterlab-
1.2.4-py38_0.tar.bz2
macOS example file path: /Users/username/anaconda3/conda-bld/osx-64/jupyterlab-1.2.4-
py38_0.tar.bz2

Linux example file path: /home/username/miniconda/conda-bld/linux-64/bjupyterlab-1.2.4-


py38_0.tar.bz2

i Note

The path and filename will vary depending on your installation and operating system.

Save the path and filename information for the next step.

Upload to Anaconda Cloud


Now you can upload the new local packages to Anaconda Cloud. First, log in to Anaconda Cloud
from your terminal: anaconda login
You will be asked for your Anaconda Cloud account name and password. If the login was successful
you will see output like the following:

i Note

This step must be done in the root conda environment.

Now that you are logged into your channel, you can upload the JupyterLab conda package as
follows:
Windows users: anaconda upload C:\Users\username\miniconda\conda-bld\win-
64\jupyterlab-1.2.4-py38_0.tar.bz2

Linux and macOS users: anaconda upload /Users/username/miniconda/conda-bld/osx-


64/jupyterlab-1.2.4-py38_0.tar.bz2

i Note

Change your username, path, and filename to the exact username, path, and filename you saved
in Step 2. These will vary depending on your installation and operating system.

For more information about Anaconda Cloud, see the Anaconda Cloud documentation
(https://docs.anaconda.com/anaconda-cloud) page.

Configure Anaconda Navigator


Now that the JupyterLab package has been uploaded to your Anaconda Cloud channel, you need to
add the channel to Anaconda Navigator.
1. Launch the Anaconda Navigator app. In Windows and Linux it will be available from the Start
Menu. On macOS, you can find it either on the Desktop or through Spotlight.

2. Open the Environments pane on the far left.

3. To add your channel, first click the Channel button. Second, click the Add button. Third, type in the
 v: latest 
URL to your Anaconda Cloud channel: https://conda.anaconda.org/channel
(https://conda.anaconda.org/channel)
i Note

Replace “channel” with your Anaconda Cloud username.

4. Press Enter and select Update Channels.

(../../../../_images/add-channel.png)
5. Close and restart Anaconda Navigator. The JupyterLab app will be displayed on the Home pane.

Troubleshooting
A. Conda-build fails
If the conda recipe fails to build consult the Troubleshooting (https://docs.conda.io/projects/conda-
build/en/latest/user-guide/tutorials/build-pkgs-skeleton.html#troubleshooting) guide.

B. App does not appear on the home pane


Check that the conda package has been uploaded to your Anaconda Cloud channel. Check that
your channel has been added to the Channels list.
You may have to remove your .anaconda/navigator directory and restart Navigator. This directory is
in your Home directory.

C. App does not launch


If after installing the application it does not launch, check that it works correctly on the command line
with the following command: conda run jupyterlab
If JupyterLab starts correctly then you may have to remove your .anaconda/navigator directory and
restart Navigator. This directory is in your Home directory.

Additional Information
 v: latest 

For more information about adding Start Menu entries in Windows, see the menuinst
(https://github.com/ContinuumIO/menuinst) documentation.
« Managing channels (../manage-channels/)     

Using multiple versions of Python with Navigator » (../use-multiple-python-versions/)

Docs Home (../../../../) Anaconda Home More Help & Support


(https://www.anaconda.com/) (https://www.anaconda.com/support)
 2020 Anaconda, Inc. All Rights Reserved. Privacy Policy (https://www.anaconda.com/privacy-policy/)

 v: latest 

You might also like