Launching script containing virtual env through desktop icon
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
0
down vote
favorite
I want to launch Spyder with tensorflow environment activated directly through a desktop icon. For this purpose, I created a desktop icon launching a virtualenv and then my application. Many posts already exist but I cannot find a solution for this exact problem. Here is my spyder.sh file:
#!/bin/bash
source /home/alexis/tensorflow/bin/activate
spyder3
and here is my desktop entry:
[Desktop Entry]
Version=1.0
Name=Spyder
Comment=Spyder
Exec='/home/alexis/Launcher/spyder.sh'
Icon=spyder3
Terminal=true
Type=Application
Categories=Application;
Name[en_US]=Spyder
The files have chmod +x
. From a terminal, the script works as expected. From the desktop, the script launches Spyder but the environment is not activated. What I am missing?
Related questions not answering my question:
How do I make a desktop icon to launch a program?
and
How do I automate the activation of Python environment
.desktop virtualenv
add a comment |Â
up vote
0
down vote
favorite
I want to launch Spyder with tensorflow environment activated directly through a desktop icon. For this purpose, I created a desktop icon launching a virtualenv and then my application. Many posts already exist but I cannot find a solution for this exact problem. Here is my spyder.sh file:
#!/bin/bash
source /home/alexis/tensorflow/bin/activate
spyder3
and here is my desktop entry:
[Desktop Entry]
Version=1.0
Name=Spyder
Comment=Spyder
Exec='/home/alexis/Launcher/spyder.sh'
Icon=spyder3
Terminal=true
Type=Application
Categories=Application;
Name[en_US]=Spyder
The files have chmod +x
. From a terminal, the script works as expected. From the desktop, the script launches Spyder but the environment is not activated. What I am missing?
Related questions not answering my question:
How do I make a desktop icon to launch a program?
and
How do I automate the activation of Python environment
.desktop virtualenv
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to launch Spyder with tensorflow environment activated directly through a desktop icon. For this purpose, I created a desktop icon launching a virtualenv and then my application. Many posts already exist but I cannot find a solution for this exact problem. Here is my spyder.sh file:
#!/bin/bash
source /home/alexis/tensorflow/bin/activate
spyder3
and here is my desktop entry:
[Desktop Entry]
Version=1.0
Name=Spyder
Comment=Spyder
Exec='/home/alexis/Launcher/spyder.sh'
Icon=spyder3
Terminal=true
Type=Application
Categories=Application;
Name[en_US]=Spyder
The files have chmod +x
. From a terminal, the script works as expected. From the desktop, the script launches Spyder but the environment is not activated. What I am missing?
Related questions not answering my question:
How do I make a desktop icon to launch a program?
and
How do I automate the activation of Python environment
.desktop virtualenv
I want to launch Spyder with tensorflow environment activated directly through a desktop icon. For this purpose, I created a desktop icon launching a virtualenv and then my application. Many posts already exist but I cannot find a solution for this exact problem. Here is my spyder.sh file:
#!/bin/bash
source /home/alexis/tensorflow/bin/activate
spyder3
and here is my desktop entry:
[Desktop Entry]
Version=1.0
Name=Spyder
Comment=Spyder
Exec='/home/alexis/Launcher/spyder.sh'
Icon=spyder3
Terminal=true
Type=Application
Categories=Application;
Name[en_US]=Spyder
The files have chmod +x
. From a terminal, the script works as expected. From the desktop, the script launches Spyder but the environment is not activated. What I am missing?
Related questions not answering my question:
How do I make a desktop icon to launch a program?
and
How do I automate the activation of Python environment
.desktop virtualenv
.desktop virtualenv
edited Mar 22 at 13:38
asked Mar 22 at 13:32
![](https://i.stack.imgur.com/BvGC7.png?s=32&g=1)
![](https://i.stack.imgur.com/BvGC7.png?s=32&g=1)
ahstat
1014
1014
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
To run your python script within the virtual environment, you simply have to execute the python binary which is in the bin folder of your virtual env folder.
Ie : if your virtual env within /home/alexis/myvirtualenv
and if the script you want to execute is named /home/alexis/scripts/my_python_file.py
, you will have to run your python script this way :
/home/alexis/myvirtualenv/bin/python /home/alexis/scripts/my_python_file.py
For your specific needs :
Try to put the following code within spyder.sh
:
#!/bin/bash
/home/alexis/tensorflow/bin/python spyder3 # you may have to put the full path to spyder3
The code is working in a terminal (launching Spyder and access to tensorflow), but not through the desktop icon (launching Spyder but not in my virtualenv). I've replaced spyder3 with /usr/bin/spyder3
â ahstat
Mar 24 at 2:28
When the second line is only "/home/alexis/tensorflow/bin/python3", the problem is similar: OK in a terminal (open python3 in virtualenv), but not through desktop icon (open python3 but not in my virtualenv)
â ahstat
Mar 24 at 2:30
I have "There was an error launching the application." I tried with ", ' and with nothing. If I let Exec="xterm", it works but it is only an xterm
â ahstat
Mar 24 at 11:10
i made a mistake. TryExec="xterm -e /home/alexis/Launcher/spyder.sh"
â rebrec
Mar 24 at 16:24
same error "There was an error launching the application."
â ahstat
Mar 25 at 8:25
 |Â
show 2 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
To run your python script within the virtual environment, you simply have to execute the python binary which is in the bin folder of your virtual env folder.
Ie : if your virtual env within /home/alexis/myvirtualenv
and if the script you want to execute is named /home/alexis/scripts/my_python_file.py
, you will have to run your python script this way :
/home/alexis/myvirtualenv/bin/python /home/alexis/scripts/my_python_file.py
For your specific needs :
Try to put the following code within spyder.sh
:
#!/bin/bash
/home/alexis/tensorflow/bin/python spyder3 # you may have to put the full path to spyder3
The code is working in a terminal (launching Spyder and access to tensorflow), but not through the desktop icon (launching Spyder but not in my virtualenv). I've replaced spyder3 with /usr/bin/spyder3
â ahstat
Mar 24 at 2:28
When the second line is only "/home/alexis/tensorflow/bin/python3", the problem is similar: OK in a terminal (open python3 in virtualenv), but not through desktop icon (open python3 but not in my virtualenv)
â ahstat
Mar 24 at 2:30
I have "There was an error launching the application." I tried with ", ' and with nothing. If I let Exec="xterm", it works but it is only an xterm
â ahstat
Mar 24 at 11:10
i made a mistake. TryExec="xterm -e /home/alexis/Launcher/spyder.sh"
â rebrec
Mar 24 at 16:24
same error "There was an error launching the application."
â ahstat
Mar 25 at 8:25
 |Â
show 2 more comments
up vote
0
down vote
To run your python script within the virtual environment, you simply have to execute the python binary which is in the bin folder of your virtual env folder.
Ie : if your virtual env within /home/alexis/myvirtualenv
and if the script you want to execute is named /home/alexis/scripts/my_python_file.py
, you will have to run your python script this way :
/home/alexis/myvirtualenv/bin/python /home/alexis/scripts/my_python_file.py
For your specific needs :
Try to put the following code within spyder.sh
:
#!/bin/bash
/home/alexis/tensorflow/bin/python spyder3 # you may have to put the full path to spyder3
The code is working in a terminal (launching Spyder and access to tensorflow), but not through the desktop icon (launching Spyder but not in my virtualenv). I've replaced spyder3 with /usr/bin/spyder3
â ahstat
Mar 24 at 2:28
When the second line is only "/home/alexis/tensorflow/bin/python3", the problem is similar: OK in a terminal (open python3 in virtualenv), but not through desktop icon (open python3 but not in my virtualenv)
â ahstat
Mar 24 at 2:30
I have "There was an error launching the application." I tried with ", ' and with nothing. If I let Exec="xterm", it works but it is only an xterm
â ahstat
Mar 24 at 11:10
i made a mistake. TryExec="xterm -e /home/alexis/Launcher/spyder.sh"
â rebrec
Mar 24 at 16:24
same error "There was an error launching the application."
â ahstat
Mar 25 at 8:25
 |Â
show 2 more comments
up vote
0
down vote
up vote
0
down vote
To run your python script within the virtual environment, you simply have to execute the python binary which is in the bin folder of your virtual env folder.
Ie : if your virtual env within /home/alexis/myvirtualenv
and if the script you want to execute is named /home/alexis/scripts/my_python_file.py
, you will have to run your python script this way :
/home/alexis/myvirtualenv/bin/python /home/alexis/scripts/my_python_file.py
For your specific needs :
Try to put the following code within spyder.sh
:
#!/bin/bash
/home/alexis/tensorflow/bin/python spyder3 # you may have to put the full path to spyder3
To run your python script within the virtual environment, you simply have to execute the python binary which is in the bin folder of your virtual env folder.
Ie : if your virtual env within /home/alexis/myvirtualenv
and if the script you want to execute is named /home/alexis/scripts/my_python_file.py
, you will have to run your python script this way :
/home/alexis/myvirtualenv/bin/python /home/alexis/scripts/my_python_file.py
For your specific needs :
Try to put the following code within spyder.sh
:
#!/bin/bash
/home/alexis/tensorflow/bin/python spyder3 # you may have to put the full path to spyder3
edited Mar 22 at 13:58
answered Mar 22 at 13:52
rebrec
1816
1816
The code is working in a terminal (launching Spyder and access to tensorflow), but not through the desktop icon (launching Spyder but not in my virtualenv). I've replaced spyder3 with /usr/bin/spyder3
â ahstat
Mar 24 at 2:28
When the second line is only "/home/alexis/tensorflow/bin/python3", the problem is similar: OK in a terminal (open python3 in virtualenv), but not through desktop icon (open python3 but not in my virtualenv)
â ahstat
Mar 24 at 2:30
I have "There was an error launching the application." I tried with ", ' and with nothing. If I let Exec="xterm", it works but it is only an xterm
â ahstat
Mar 24 at 11:10
i made a mistake. TryExec="xterm -e /home/alexis/Launcher/spyder.sh"
â rebrec
Mar 24 at 16:24
same error "There was an error launching the application."
â ahstat
Mar 25 at 8:25
 |Â
show 2 more comments
The code is working in a terminal (launching Spyder and access to tensorflow), but not through the desktop icon (launching Spyder but not in my virtualenv). I've replaced spyder3 with /usr/bin/spyder3
â ahstat
Mar 24 at 2:28
When the second line is only "/home/alexis/tensorflow/bin/python3", the problem is similar: OK in a terminal (open python3 in virtualenv), but not through desktop icon (open python3 but not in my virtualenv)
â ahstat
Mar 24 at 2:30
I have "There was an error launching the application." I tried with ", ' and with nothing. If I let Exec="xterm", it works but it is only an xterm
â ahstat
Mar 24 at 11:10
i made a mistake. TryExec="xterm -e /home/alexis/Launcher/spyder.sh"
â rebrec
Mar 24 at 16:24
same error "There was an error launching the application."
â ahstat
Mar 25 at 8:25
The code is working in a terminal (launching Spyder and access to tensorflow), but not through the desktop icon (launching Spyder but not in my virtualenv). I've replaced spyder3 with /usr/bin/spyder3
â ahstat
Mar 24 at 2:28
The code is working in a terminal (launching Spyder and access to tensorflow), but not through the desktop icon (launching Spyder but not in my virtualenv). I've replaced spyder3 with /usr/bin/spyder3
â ahstat
Mar 24 at 2:28
When the second line is only "/home/alexis/tensorflow/bin/python3", the problem is similar: OK in a terminal (open python3 in virtualenv), but not through desktop icon (open python3 but not in my virtualenv)
â ahstat
Mar 24 at 2:30
When the second line is only "/home/alexis/tensorflow/bin/python3", the problem is similar: OK in a terminal (open python3 in virtualenv), but not through desktop icon (open python3 but not in my virtualenv)
â ahstat
Mar 24 at 2:30
I have "There was an error launching the application." I tried with ", ' and with nothing. If I let Exec="xterm", it works but it is only an xterm
â ahstat
Mar 24 at 11:10
I have "There was an error launching the application." I tried with ", ' and with nothing. If I let Exec="xterm", it works but it is only an xterm
â ahstat
Mar 24 at 11:10
i made a mistake. Try
Exec="xterm -e /home/alexis/Launcher/spyder.sh"
â rebrec
Mar 24 at 16:24
i made a mistake. Try
Exec="xterm -e /home/alexis/Launcher/spyder.sh"
â rebrec
Mar 24 at 16:24
same error "There was an error launching the application."
â ahstat
Mar 25 at 8:25
same error "There was an error launching the application."
â ahstat
Mar 25 at 8:25
 |Â
show 2 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1018253%2flaunching-script-containing-virtual-env-through-desktop-icon%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password