Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Automate run in Windows 10 using conda (2024)

Hello everyone!

I've installed Sagemath on two Windows 10 machines following the guide https://doc.sagemath.org/html/en/installation/index.html with different results.

In one of them (the one with the issue), to run Sagemath I have to open Ubuntu and run

$ conda activate sage

every time I want to use sagemath. This prevents me from being able to use a shortcut to launch sagemath: when following the instructions in

https://doc.sagemath.org/html/en/installation/launching.html#create-a-notebook-launch-script

and

https://doc.sagemath.org/html/en/installation/launching.html#create-a-shortcut

it doesn't work, it shows:./sage_nb.sh: line 3: sage: command not found

Q1: currently my script reads

#!/bin/bash 
cd /mnt/c 
sage -n jupyter

Can I modify it to also do the "$ conda activate sage" command first? I've tried in several ways but failed miserably, for instance changing it to

#!/bin/bash 
conda init
conda activate sage
cd /mnt/c 
sage -n jupyter

Q2: Is there a way of permanently avoiding the need to enter the command $ conda activate sage every time?

Automate run in Windows 10 using conda (2024)

Hello everyone!

I've installed Sagemath on two Windows 10 machines following the guide https://doc.sagemath.org/html/en/installation/index.html with different results.

In one of them (the one with the issue), to run Sagemath I have to open Ubuntu and run

$ conda activate sage

every time I want to use sagemath. This prevents me from being able to use a shortcut to launch sagemath: when following the instructions in

https://doc.sagemath.org/html/en/installation/launching.html#create-a-notebook-launch-script

and

https://doc.sagemath.org/html/en/installation/launching.html#create-a-shortcut

it doesn't work, it shows:./sage_nb.sh: line 3: sage: command not found

Q1: currently my script reads

#!/bin/bash 
cd /mnt/c 
sage -n jupyter

Can I modify it to also to do the "$ conda activate sage" command first? I've tried in several ways but failed miserably, for instance changing it to

#!/bin/bash 
conda init
conda activate sage
cd /mnt/c 
sage -n jupyter

I get

CondaError: Run 'conda init' before 'conda activate'
./sage_nb.sh: line 5: sage: command not found

which, by the way, is exactly the same message I get when NOT entering the line 2 with conda init.

Q2: Is there a way of permanently avoiding the need to enter the command $ conda activate sage every time?