2

I would like to start spyder from a .desktop shortcut.

I am unfortunately unable to start it directly from AnacondaNav, as it stops with a Exit code: 134 message. As an alternative, I installed spyder using:

conda update -n base -c defaults conda  
conda update anaconda  
conda install spyder=5.4.2

This lets me start spyder with:

conda activate spyder-env
spyder

How do I create a .desktop file with these commands?
I have tried copying/altering various other .desktop and .sh files (with/out #!/bin/bash), but none have worked.

System setup:

  • OS: LMDE 5 / elsie
  • 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1
  • Cinnamon 5.6.8
  • Python 3.11.2
  • conda 23.3.1
  • Spyder IDE 5.4.2

Edit: Tried some suggestions from the comments:
(sh -c) conda activate spyder-env; spyder gives either "There was an error launching the application" or no output at all.
Adding conda act... to .profile activates the python env but running spyder from the .desktop after that does nothing.

christerk
  • 21
  • 3
  • 1
    Can you show us some of the things you tried? How does it fail? What happens if you make a .desktop file that executes `conda activate spyder-env; spyder` or `sh -c 'conda activate spyder-env; spyder'`? What happens if you add `conda activate spyder-env` to your `~/.profile` file and then have `spyder` in the .desktop? – terdon Apr 03 '23 at 22:00
  • You're welcome, but did they work? Please [edit] your question and answer the things I asked so we know how to help you. We need to see what you tried and how it failed so we don't waste your time, or ours, suggesting solutions you have already discarded. – terdon Apr 04 '23 at 11:04
  • Thanks for your suggestions. See my edit in the text. – christerk Apr 04 '23 at 11:30
  • OK, but please show us the actual contents of the `.desktop` file you are using and the _exact_ commands you tried since `(sh -c) conda activate spyder-env; spyder` isn't a valid command. Another option would be to make a script with the two commands and run your script from the .desktop file. But the devil's in the details with this sort of thing, so we will always need to see the _exact_ thing you tried. – terdon Apr 04 '23 at 11:45

1 Answers1

0

The solution was in fact quite simple; adding the full path (in my case /home/christer/anaconda3/envs/spyder-env/bin/spyder) to the spyder.sh script solved all problems.
spyder can now be started both from the terminal, and by right-clicking the spyder.sh file on the desktop, regardless of whether the spyder-env is activated or not.

christerk
  • 21
  • 3