You are not logged in.

#1 2021-01-05 21:23:52

fstabme
Member
Registered: 2020-10-05
Posts: 11

Simple desktop entry app that runs a sh script

Hi,

I can't get this to work for some reason. I just want a button on my desktop that I can press that runs a few simple lines of code.

Running the sh script via terminal works completely file (/home/user/Desktop/jupyterlabstart.sh)

I have a jupyterlabstart.sh script:

cd /mnt/datahdd/
conda activate
jupyter lab
read -n1 -p "Press any key to exit."
exit

and a desktop entry file:

[Desktop Entry]
Name=Custom JupyterLab instance starter
Comment=JupyterLab
Exec=sh /home/yasser/Desktop/jupyterlabstart.sh
Terminal=true
Type=Application
Icon=blueman-trust
Path=
StartupNotify=false

But for some reason, when I double click the desktop application I get:

/home/user/Desktop/jupyterlabstart.sh: line 2: conda: command not found
/home/user/Desktop/jupyterlabstart.sh: line 3: jupyter: command not found


edit:

So thought i'd edit the script a little:

cd /mnt/datahdd/
/home/user/miniconda3/bin/conda activate
/home/user/miniconda3/bin/jupyter lab
read -n1 -p "Press any key to exit."
exit

and now it's working, but I get the error:

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Last edited by fstabme (2021-01-05 21:28:39)

Offline

#2 2021-01-05 22:21:57

seth
Member
Registered: 2012-09-03
Posts: 18,781

Re: Simple desktop entry app that runs a sh script

Non interactive /bin/sh isn't an interactive bash - it won't source most of the config files/profiles.

Apparently getting conda to behave is't simple, cause it manipulates your bashrc, https://stackoverflow.com/questions/555 … ell-script
=> run it in an interactive bash (explained in the link)

Offline

Board footer

Powered by FluxBB