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/inst... 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/inst...
and
https://doc.sagemath.org/html/en/inst...
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 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?
How does it fail ? Is there any error message printed ?
We're pretty bad at divining error causes.
I just added the error message in the post. It says CondaError: Run 'conda init' before 'conda activate' ./sage_nb.sh: line 5: sage: command not found
What happens when you try
conda init && conda activate sage & command -V sage
from a terminal command line, and
from a script ?
Please cut 'n paste the whole thing : again, dinination isn't our forte...
BTW, the same thing for
echo $PATH
may be useful.