Easily creating shortcuts with the powershell_shortcut_miniconda and console_shortcut_miniconda packages, and can this be replicated with menuinst ? #246
Labels
type::documentation
request for improved documentation
Checklist
What happened?
My problem
I have installed miniconda3 on Windows 10 (and on several Linux platforms) and thoroughly documented all the steps, so that our students can understand and replicate this, and can then create their own clean environments, without altering the base environment
After installing miniconda3 on Windows, you end up with a
Miniconda3 (64-bit)
Windows menu, a shortcut to open anAnaconda Powershell Prompt
and one to open anAnaconda Prompt
, both with thebase
environment activatedI had no idea where these convenient shortcuts were coming from, and I wanted to find a clean way to create direct shortcuts to new (non-
base
) environments, on Windows. So that students can directly start a specific environment, without having totype conda activate env
). You've got to make things easy for new users, if you want to get them past notebooks...What I have tried
I have relatively quickly found out about
menuinst
on Google and played a bit (a lot, too much, actually) with in order to understand more about the json config files. I figured that generating and distributing a good json config file to our students would do the trickUnfortunately, I have read and re-read the menuinst documentation (and filled some issues along the way) and got the impression I was running in circles and not getting anywhere near my easy environment initialization goal.
The documentation is not very clear/detailed about using non-base environments. The closest thing I found was Specifying different shortcut names for base and non-base environments. But this seemed like a very convoluted way to get thins done, and I did not really get it working. Maybe I'll fill an issue about that. For selecting a non based environment, I was more expecting something like : use a parameter in the json file to specify the environment name, and then create the shortcuts by calling menuinst in the base environment
I also tried to do some reverse engineering by comparing the content of my json files to the generated
.lnk
and.bat
files but this only got me some severe headaches. I'm mostly a Linux user and I know next to nothing about.bat
files and powershell syntaxWhat seems to work (without using menuinst explicitly...)
I tried to understand where the Windows shortcuts (to
base
) that appeared when I installed miniconda3 were coming from, and I eventually found out that they were provided by thepowershell_shortcut_miniconda
andconsole_shortcut_miniconda
packages bundled with miniconda3 !It is actually trivial to install or uninstall either the
powershell
or theconsole
shortcuts (or both) by just installing or removing thepowershell_shortcut_miniconda
andconsole_shortcut_miniconda
packagesIn the example below, I easily create a Windows menu shortcut to my
spyder_test
environment, from thebase
environmentAfter testing the Windows menu shortcut, I can also easily remove the shortcut, still from the
base
environmentI can also create and remove the shortcuts directly from the non-
base
environment. Note that menuinst is not installed in that environment, but I guess that if conda can be called from this non-base
environment, it can also use menuinst from the base environmentHow do 'powershell_shortcut_miniconda' and 'console_shortcut_miniconda' work ?
I'm glad I found an easy solution to my initial problem, but this raised other questions
I have found the following json files in the packages
C:\Utils\miniconda3_2024-03\pkgs\console_shortcut_miniconda-0.1.1-haa95532_2\Menu\console_shortcut.json
C:\Utils\miniconda3_2024-03\pkgs\powershell_shortcut_miniconda-0.0.1-haa95532_2\Menu\powershell_shortcut.json
My new questions:
${PY_VER}
is giving a better result (3
) than the{{ PY_VER }}
placeholder (N. A.
). See PY_VER placeholder not defined/updated correctly on Windows #235My other requirement: Windows Terminal profiles
I would also like to easily create Windows Terminal profiles that would open a Windows terminal using the
base
or a non-base
environment.I understand that this can theoretically be achieved with the
terminal_profile
option, and has been covered by #196 . Can somebody provide a detailed example for both cases (base
and non-base
). I have already spent way tp much time on this and I need to move on to creating actual complex (and non-base
!) environmentsThere are lots of online tutorials to do this, but they may be obsolete or not safe. And I'd like a clean way to do this (distributing a json file would be nice)
Thanks!
Additional Context
No response
The text was updated successfully, but these errors were encountered: