Skip to content
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

install into global ~/.julia/conda directory #126

Merged
merged 3 commits into from
Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ os:
- osx
- linux
julia:
- 0.6
- 0.7
- 1.0
- nightly
env:
- CONDA_JL_VERSION="2"
Expand Down
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
julia 0.6
julia 0.7
Compat 0.62.0
JSON
VersionParsing
1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
environment:
matrix:
- julia_version: 0.6
- julia_version: 0.7
- julia_version: 1
- julia_version: nightly
Expand Down
1 change: 0 additions & 1 deletion deps/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
usr/
deps.jl
!.gitignore
23 changes: 14 additions & 9 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
using Compat

const condadir = abspath(homedir(), ".julia", "conda")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not joinpath(DEPOT_PATH[1], "conda")? But maybe it's fine since julia itself hard-codes ~/.julia/config/startup.jl https://github.com/JuliaLang/julia/blob/b519147d60683c3a0ed587925bb7221153b64b65/base/client.jl#L288

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was following client.jl.

const condadeps = joinpath(condadir, "deps.jl")

module DefaultDeps
using Compat
if isfile("deps.jl")
include("deps.jl")
end
if !isdefined(@__MODULE__, :ROOTENV)
const ROOTENV = abspath(dirname(@__FILE__), "usr")
elseif isfile(Main.condadeps)
include(Main.condadeps)
end
if !isdefined(@__MODULE__, :MINICONDA_VERSION)
const MINICONDA_VERSION = "3"
end
if !isdefined(@__MODULE__, :ROOTENV)
const ROOTENV = joinpath(Main.condadir, MINICONDA_VERSION)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested joinpath(Main.condadir, "base") and let conda control the Python version for each Julia environment #123 (comment). But I guess it's OK for a quick fix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still a separate base installation for python 2 and python 3, no? They have completely different miniconda installers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conda command installed in Miniconda3 can install any Python version registered in anaconda repo like 2.7. So, my thought was that, if you need Python 2 for Julia environment ~/.julia/environments/v1.0-with-py27 then you'd create conda environment ~/.julia/conda/envs/v1.0-with-py27 using ~/.julia/conda/base/bin/conda (which is interpreted by Python 3). But since such mechanism does not exist (and not easily implementable without package options), I thought switching Python 2 and 3 by ENV["CONDA_JL_VERSION"] is a valid workaround.

end
end

ROOTENV = get(ENV, "CONDA_JL_HOME", DefaultDeps.ROOTENV)
Expand All @@ -33,11 +38,11 @@ const ROOTENV = "$(escape_string(ROOTENV))"
const MINICONDA_VERSION = "$(escape_string(MINICONDA_VERSION))"
"""

if !isfile("deps.jl") || read("deps.jl", String) != deps
write("deps.jl", deps)
end
mkpath(condadir)
mkpath(ROOTENV)

if !isdir(ROOTENV)
# Ensure ROOTENV exists, otherwise prefix(ROOTENV) will throw
mkpath(ROOTENV)
for depsfile in ("deps.jl", condadeps)
if !isfile(depsfile) || read(depsfile, String) != deps
write(depsfile, deps)
end
end