10

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.

1 Answer 1

10

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!

4
  • 1
    This works fine, except for Icon=spyder3 for me, had to do a locate -i 'anaconda-logo' and use the result as Icon.
    – Aristu
    Sep 11, 2017 at 16:43
  • 1
    Is there an official "Desktop Launcher" for Anaconda? Why don't they provide something?
    – Royi
    Oct 28, 2017 at 15:20
  • On xfce menu editor (menulibre) can simplify the task, only missing link was the export statement. @Royi there is a project named ContinuumIO/menuinst on github to make a cross platform menu item installation but it's not mature yet. For now we should wait for a port in some future update. Mar 19, 2018 at 3:32
  • Instead of copying the file to /usr/share/applications/ you can simply run sudo desktop-file-install Anaconda.desktop on the file.
    – addohm
    Nov 8, 2018 at 7:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .