Thanks a lot @awvwgk, I finally solved the problem!
Here’s what my Intel Python module looks like right now.
family( "python" )
whatis( "Intel Python 3.7" )
help([[
Intel Distribution for Python
Bundled with Intel oneAPI 2021.4
]])
local root = "/opt/intel/oneapi"
local ipy = pathJoin( root, "intelpython/latest" )
local conda_sh = pathJoin( ipy, "etc/profile.d/conda." .. myShellType() )
local envver = "2021.4.0"
cmd = "source " .. conda_sh .. "; " .. "conda activate " .. envver
execute{cmd=cmd, modeA={"load"}}
if (myShellType() == "csh") then
-- csh sets these environment variables and an alias for conda
cmd = "unsetenv CONDA_EXE; unsetenv _CONDA_ROOT; unsetenv _CONDA_EXE; " ..
"unsetenv CONDA_SHLVL; unalias conda"
execute{cmd=cmd, modeA={"unload"}}
end
if (myShellType() == "sh") then
-- bash sets environment variables, shell functions and path to condabin
if (mode() == "unload") then
execute{cmd="for i in $(seq ${CONDA_SHLVL:=0}); do conda deactivate; done;", modeA={"unload"} }
cmd = "conda deactivate; unset CONDA_EXE; unset _CE_CONDA; unset _CE_M; " ..
"unset -f __conda_activate; unset -f __conda_reactivate; " ..
"unset -f __conda_hashr; unset CONDA_SHLVL; unset _CONDA_EXE; " ..
"unset _CONDA_ROOT; unset -f conda; " ..
"unset CONDA_PREFIX; unset CONDA_PYTHON_EXE"
execute{cmd=cmd, modeA={"unload"}}
remove_path( "PATH", pathJoin( ipy, "bin" ))
remove_path( "PATH", pathJoin( ipy, "condabin" ))
end
end