-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce CONDA_JL_CONDA_EXE environment variable #216
Changes from 1 commit
3d42c9f
53ed58c
6c244f2
1399e71
bbb2653
2162971
0756e35
c95e1ab
8eb7c9a
1cadc27
2c723b7
84c662c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -70,14 +70,18 @@ function python_dir(env::Environment) | |||
end | ||||
const PYTHONDIR = python_dir(ROOTENV) | ||||
|
||||
# note: the same conda program is used for all environments | ||||
const conda = if Sys.iswindows() | ||||
p = script_dir(ROOTENV) | ||||
conda_bat = joinpath(p, "conda.bat") | ||||
isfile(conda_bat) ? conda_bat : joinpath(p, "conda.exe") | ||||
else | ||||
joinpath(bin_dir(ROOTENV), "conda") | ||||
if ! @isdefined(CONDA_EXE) | ||||
# We have an oudated deps.jl file that does not define CONDA_EXE | ||||
const CONDA_EXE = if Sys.iswindows() | ||||
p = script_dir(ROOTENV) | ||||
conda_bat = joinpath(p, "conda.bat") | ||||
isfile(conda_bat) ? conda_bat : joinpath(p, "conda.exe") | ||||
else | ||||
joinpath(bin_dir(ROOTENV), "conda") | ||||
end | ||||
end | ||||
# note: the same conda program is used for all environments | ||||
const conda = CONDA_EXE | ||||
|
||||
"Path to the condarc file" | ||||
function conda_rc(env::Environment) | ||||
|
@@ -191,20 +195,24 @@ _quiet() = get(ENV, "CI", "false") == "true" ? `-q` : `` | |||
"Install miniconda if it hasn't been installed yet; _install_conda(true) installs Conda even if it has already been installed." | ||||
function _install_conda(env::Environment, force::Bool=false) | ||||
if force || !isfile(Conda.conda) | ||||
# This assumes that the conda executable will in some directory under | ||||
# CONDA_EXE_PREFIX. | ||||
# Ex: If CONDA_EXE="$HOME/miniforge3/bin/conda", then CONDA_EXE_PREFIX="$HOME/miniforge3" | ||||
CONDA_EXE_PREFIX = conda |> dirname |> dirname | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this assumption is too strong. It's possible that people use a shim script or symlink. Can you use something like Nitpicks: It's strange that a local variable is all caps. I also notice that src/Conda.jl does not use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mkitti, why do we need a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Line 47 in f169018
We reach this line of code when the conda executable does not exist at There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean when the user sets There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can add a check at build time. What should we do at runtime when There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Thanks
Nothing. We just use PREFIX since the if condition above is invoked only if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it only invoked if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forgot to mention another point: does Conda.jl still use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's an internal constant called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
True. I'm not sure how to handle it. If |
||||
@info("Downloading miniconda installer ...") | ||||
if Sys.isunix() | ||||
installer = joinpath(PREFIX, "installer.sh") | ||||
installer = joinpath(CONDA_EXE_PREFIX, "installer.sh") | ||||
end | ||||
if Sys.iswindows() | ||||
installer = joinpath(PREFIX, "installer.exe") | ||||
installer = joinpath(CONDA_EXE_PREFIX, "installer.exe") | ||||
end | ||||
mkpath(PREFIX) | ||||
mkpath(CONDA_EXE_PREFIX) | ||||
Downloads.download(_installer_url(), installer) | ||||
|
||||
@info("Installing miniconda ...") | ||||
if Sys.isunix() | ||||
chmod(installer, 33261) # 33261 corresponds to 755 mode of the 'chmod' program | ||||
run(`$installer -b -f -p $PREFIX`) | ||||
run(`$installer -b -f -p $CONDA_EXE_PREFIX`) | ||||
end | ||||
if Sys.iswindows() | ||||
run(Cmd(`$installer /S --no-shortcuts /NoRegistry=1 /AddToPath=0 /RegisterPython=0 /D=$PREFIX`, windows_verbatim=true)) | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is impossible. If there's an outdated deps.jl that means there was a update of Conda.jl which means the package has to be built first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible in a few situations such as using multiple Julia installations with the same
JULIA_DEPOT_PATH
and/or a modifiedJULIA_LOAD_PATH
. Julia will only force a rebuild if it is aware that the version changed.For example, I did this to myself in the course of testing the package by using
pkg"dev Conda"
. In this case, the Conda package was checked out in~/.julia/dev/Conda
and the deps file at~/.julia/dev/Conda/deps/deps.jl
was carried over between several versions as I moved between branches or I changed environments.While we could just throw and error if we detect this condition, encouraging the user to rebuild, just doing the former calculation seems friendlier since we can just follow the old behavior here.
We see this issue with an outdated deps.jl file quite commonly with GR.jl and users will appear in support channels complaining that plotting is broken. The issues were reduced once we just started fixing the issues automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove it now, but my recommendation is to keep it for the moment and then remove it at a later time to smooth over the migration process.