Skip to content

Commit

Permalink
Do not run conda install automagically (unless Conda.jl is used) (#580
Browse files Browse the repository at this point in the history
)

fix #560
  • Loading branch information
tkf authored and stevengj committed Sep 23, 2018
1 parent c45a076 commit bb7c9bb
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/PyCall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -656,23 +656,14 @@ function pyimport_conda(modulename::AbstractString, condapkg::AbstractString,
pyimport(modulename)
else
aconda = anaconda_conda()
if !isempty(aconda)
try
Compat.@info "Installing $modulename via Anaconda's $aconda..."
isempty(channel) || run(`$aconda config --add channels $channel --force`)
run(`$aconda install -y $condapkg`)
catch e2
error("""
Detected Anaconda Python, but \"$aconda install -y $condapkg\" failed.
You should either install $condapkg manually or fix your Anaconda installation so that $aconda works. Alternatively, you can reconfigure PyCall to use its own Miniconda installation via the Conda.jl package, by running:
ENV["PYTHON"]=""; Pkg.build("PyCall")
after re-launching Julia.
The exception was: $e2
""")
end
return pyimport(modulename)
if isempty(aconda)
# Not in conda environment; show the error from `pyimport`.
rethrow()
end

options = ""
if !isempty(channel)
options = " --channel $channel"
end

error("""
Expand All @@ -683,6 +674,12 @@ function pyimport_conda(modulename::AbstractString, condapkg::AbstractString,
Pkg.build("PyCall")
before trying again.
Note that Conda.jl can use custom conda environment. Read more about `CONDA_JL_HOME` configuration in Conda.jl documentation:
https://github.com/JuliaPy/Conda.jl
To install $condapkg using $aconda, you can run the following command from your system shell:
$aconda install$options $condapkg
The pyimport exception was: $e
""")
end
Expand Down

0 comments on commit bb7c9bb

Please sign in to comment.