You could try this:
module switch others/texlive others/texlive/2022
module switch apps/python apps/python/3.9.6
module switch apps/fltExport apps/fltExport/v2.017
module switch others/nodejs others/nodejs/16.17.1
You might have to use module switch -f, if the first module might not be loaded.
On 2025-11-18 10:15 AM, Laurent BESSON wrote:
> Hello dear Modules community,
>
> Naively, I thought « module switch » would be a nice , more compact, way of writing « module unload / module load ». But either I stumbled on a bug or Modules does not work as I expected 😊
>
> Here is the context. I was previously sourcing this script :
>
> module unload others/texlive
> module load others/texlive
>
> module unload apps/python
> module load apps/python/3.9.6
>
> module unload apps/fltExport
> module load apps/fltExport/v2.017
>
> module unload others/nodejs
> module load others/nodejs/16.17 .1
>
> So I thought it would be nice, more readable, to write it this way :
>
> module switch others/texlive/2022
> module switch apps/python/3.9.6
> module switch apps/fltExport/v2.017
> module switch others/nodejs/16.17.1
>
> But, when starting from a fresh terminal where no tool has been set, It ends up with these 2 modules only:
>
> … 1) apps/fltExport/v2.017 2) others/nodejs/16.17.1
>
> I was expecting to have loaded also « others/texlive » and « apps/python/3.9.6 ».
>
> So I read the documentation with more attention on the « switch » command. It says :
>
> Switch loaded modulefile1 with modulefile2. If modulefile1 is not specified, then it is assumed to be the currently loaded module with the same root name as modulefile2.
>
> So it seems that when I run « module switch apps/fltExport/v2.017 », it unload the first module that match the « root name »and it unloads« apps » thus unload « apps/python/3.9.6 »
>
> Do I understand it correctly ? Is it the expected behavior ?
> In fact, I thought Modules would try to unload « apps/fltExport/<any version> » when running « module switch apps/fltExport/v2.017 ».
>
> What do you think ?
>
> Best regards,
> Laurent.
>
> PS : I found an intermediate syntax that works :
>
> module switch others/texlive others/texlive/2022
> module switch apps/python apps/python/3.9.6
> module switch apps/fltExport apps/fltExport/v2.017
> module switch others/nodejs others/nodejs/16.17.1
>
>
> This body part will be downloaded on demand.
>
>
> This body part will be downloaded on demand.
>
--
--------------------------------------------------------
The views and opinions expressed above are strictly
those of the author(s). The content of this message has
not been reviewed nor approved by any entity whatsoever.
--------------------------------------------------------
Paul FM Info: http://paulfm.com/~paulfm/
--------------------------------------------------------
|