Ubuntu – Anaconda-Navigator desktop launcher fails to start application

anacondalauncherwhiskerxfcexubuntu

I recently installed Anaconda on my Xubuntu 16.04 system. To launch the application from a terminal, I simply use anaconda-navigator and it works brilliantly.

Now I wanted to create a desktop launcher for the same and add it to my xfce Whisker menu as well. So I created a desktop launcher with the following content.

[Desktop Entry]
Version=1.0
Type=Application
Name=Anaconda-Navigator
GenericName=Anaconda
Comment=Scientific PYthon Development EnviRonment - Python3
Exec=/home/meghana/anaconda3/bin/anaconda-navigator
Categories=Development;Science;IDE;Qt;
Icon=spyder3
Terminal=false
StartupNotify=true
MimeType=text/x-python;

But when I try to open the application from the launcher, I get directed to a local HTML file with the following error message:

Navigator Error

An unexpected error occurred on Navigator start-up

Report

Please report this issue in the anaconda issue tracker

Main Error

byte indices must be integers or slices, not str
Traceback

Traceback (most recent call last):
  File "/home/meghana/anaconda3/lib/python3.6/site-
  packages/anaconda_navigator/exceptions.py", line 75, in exception_handler
     return_value = func(*args, **kwargs)
  File "/home/meghana/anaconda3/lib/python3.6/site-
  packages/anaconda_navigator/app/start.py", line 115, in start_app
     window = run_app(splash)
  File "/home/meghana/anaconda3/lib/python3.6/site-
  packages/anaconda_navigator/app/start.py", line 58, in run_app
     window = MainWindow(splash=splash)
  File "/home/meghana/anaconda3/lib/python3.6/site-
  packages/anaconda_navigator/widgets/main_window.py", line 160, in __init__
     self.api = AnacondaAPI()
  File "/home/meghana/anaconda3/lib/python3.6/site-
  packages/anaconda_navigator/api/anaconda_api.py", line 1205, in AnacondaAPI
     ANACONDA_API = _AnacondaAPI()
  File "/home/meghana/anaconda3/lib/python3.6/site-
  packages/anaconda_navigator/api/anaconda_api.py", line 65, in __init__
     self._conda_api = CondaAPI()
  File "/home/meghana/anaconda3/lib/python3.6/site-
  packages/anaconda_navigator/api/conda_api.py", line 1622, in CondaAPI
     CONDA_API = _CondaAPI()
  File "/home/meghana/anaconda3/lib/python3.6/site-
  packages/anaconda_navigator/api/conda_api.py", line 340, in __init__
     self.set_conda_prefix()
  File "/home/meghana/anaconda3/lib/python3.6/site-
  packages/anaconda_navigator/api/conda_api.py", line 489, in set_conda_prefix
     self.ROOT_PREFIX = info['root_prefix']
  TypeError: byte indices must be integers or slices, not str

I cannot for the life of me figure out why this is happening, or what I should do.

Kindly advise.


NOTE:

Before reporting this question as a duplicate (such as of this one), please note that I am not asking instructions on how to create desktop launchers. I have searched a zillion times through several online forums in order to find a solution, but I have failed.

Best Answer

It seems like the .bashrc environment fails to load with your desktop launcher. That is why you need to manually specify the $PATH in the command that you want to execute. Try editing your desktop file (or create a new Anaconda.desktop file, if you have deleted the old one) with the following content.

[Desktop Entry]
Version=1.0
Type=Application
Name=Anaconda-Navigator
GenericName=Anaconda
Comment=Scientific PYthon Development EnviRonment - Python3
Exec=bash -c 'export PATH="/home/meghana/anaconda3/bin:$PATH" && /home/meghana/anaconda3/bin/anaconda-navigator'
Categories=Development;Science;IDE;Qt;Education;
Icon=spyder3
Terminal=false
StartupNotify=true
MimeType=text/x-python;

Did you notice the difference? Read this article on the anatomy of a .desktop file to learn more.


In order to add the application to your applications menu, simply copy the desktop file to /usr/share/applications. In order to do so, fire up a terminal and navigate to the directory where your desktop file is located, then type in the following command.

sudo cp Anaconda.desktop /usr/share/applications

Obviously, you have to replace the name Anaconda above by whatever name you have given to your desktop file. Hope this helps.

Cheers!

Related Question