Automate run in Windows 10 using conda (2024)

asked 2024-10-14 16:09:15 +0200

tidesson gravatar image

updated 2024-10-15 15:35:08 +0200

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?

edit retag flag offensive close merge delete

Comments

... but failed miserably,

How does it fail ? Is there any error message printed ?

We're pretty bad at divining error causes.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2024-10-14 17:31:06 +0200 )edit

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

tidesson gravatar imagetidesson ( 2024-10-15 15:36:27 +0200 )edit

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.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2024-10-15 19:55:52 +0200 )edit