Can't create anaconda shortcut to launch from desktop on ubuntu 17.10?

Solution 1:

Following steps work in Ubuntu 16.04, but I don't know if it works in 17.04.

  1. Create a shell script /home/paygilant/bin/anaconda.sh

    export CONDA_PYTHON_EXE=/home/paygilant/anaconda3/bin/python
    export PATH=/home/paygilant/anaconda3/bin:$PATH
    python /home/paygilant/anaconda3/bin/anaconda-navigator
    
  2. Create a desktop file /home/paygilant/anaconda.desktop

    [Desktop Entry]
    Version=1.0
    Type=Application
    Name=Anaconda-Navigator
    GenericName=Anaconda
    Exec=/bin/bash "/home/paygilant/bin/anaconda.sh"
    Icon=/home/paygilant/anaconda3/lib/python3.6/site-packages/anaconda_navigator/static/images/anaconda-icon-256x256.png
    Terminal=false
    StartupNotify=true
    
  3. Run sudo desktop-file-install anaconda.desktop. After 10~20 seconds, you can see Anaconda shortcut in dash.

Solution 2:

First check if anaconda3 is installed on your system or not (Sometime the package may be broken due to network issues during installation). And whether you are able to launch anaconda-navigator without a desktop entry or not (See how to launch anaconda-navigator without a desktop-entry, later in this post).

For creating a desktop entry

Step 1. Open your text editor and save the following content as Anaconda.desktop to your home directory.

[Desktop Entry]
Version=1.0
Type=Application
Name=Anaconda-Navigator
GenericName=Anaconda
Comment=Scientific Python Development Environment - Python3
Exec=bash -c 'export PATH="/home/jishan/anaconda3/bin:$PATH" && /home/jishan/anaconda3/bin/anaconda-navigator'
Categories=Development;Science;IDE;Qt;Education;
Icon=/home/jishan/anaconda3/lib/python3.6/site-packages/anaconda_navigator/static/images/anaconda-icon-256x256.png
Terminal=false
StartupNotify=true
MimeType=text/x-python;

Change the user-name to your username in Icon=/home/jishan/anaconda3/lib/python3.6/site-packages/anaconda_navigator/static/images/anaconda-icon-256x256.png i.e. replace jishan by your username.

Step 2. Copy your Anaconda.desktop to /usr/share/applications/ as root (Because you might need permission to copy at /usr/share/applications/)

sudo cp Anaconda.desktop /usr/share/applications

This will create a desktop entry named Anaconda in /usr/share/applications/.

Step 3. Check if Anaconda is added to your application dock. If you didn't find it, search it in search-bar. Or you can run directly from /usr/share/applications/Anaconda.desktop.

Launch Anaconda-navigator without a desktop entry

Your user (not root) may not have access to anaconda-navigator or it is not activated it yet.

Source ~/anaconda3/bin/activate root

This will result in single line showing (bash), if installed. If it is not installed, install it from here.

If installed, you can launch now by

anaconda-navigator

This will result in opening anaconda-navigator. (For each time you've to activate root as soon as your session is destroyed).

Solution 3:

Tried and tested. You need to give it the full path for some reason:

[Desktop Entry]
Name=Anaconda
Exec=bash -c 'export PATH="/home/paygilant/anaconda3/bin:$PATH" && /home/paygilant/anaconda3/bin/anaconda-navigator'
Terminal=false
Type=Application
StartupNotify=true

Then to add it to the Unity/Gnome dash:

cp -t ~/.local/share/applications ~/Desktop/anaconda_launcher.desktop

Note: I did not add an icon here and I am not sure the path you use for it is a good one (didn't check).