Fix python pip command
Return more sane error during precompilation
Fix check for pip
Stop importing optional dask dependency
Increment version number
Revert "Stop importing optional dask dependency"
This reverts commit <code>43c6c20</code>.
96 | 96 | if _has_pip() && _isyes(Base.prompt("Try updating arviz using pip? [Y/n]")) |
|
97 | 97 | # can't specify version lower bound, so update to latest |
|
98 | 98 | try |
|
99 | - | run(`$(PyCall.pyprogramname) -m pip install --upgrade -- arviz`) |
|
99 | + | run(PyCall.python_cmd(`-m pip install --upgrade -- arviz`)) |
|
100 | 100 | return true |
|
101 | 101 | catch e |
|
102 | 102 | println(e.msg) |
105 | 105 | return false |
|
106 | 106 | end |
|
107 | 107 | ||
108 | - | function _import_dependency(modulename, pkgname; channel = nothing) |
|
109 | - | _has_pymodule(modulename) && return pyimport(modulename) |
|
110 | - | return if _using_conda() |
|
111 | - | # auto-installing with conda is safe and convenient |
|
112 | - | if channel === nothing |
|
108 | + | function _import_dependency(modulename, pkgname = modulename; channel = nothing) |
|
109 | + | try |
|
110 | + | return if channel === nothing |
|
113 | 111 | pyimport_conda(modulename, pkgname) |
|
114 | 112 | else |
|
115 | 113 | pyimport_conda(modulename, pkgname, channel) |
|
116 | 114 | end |
|
117 | - | elseif _has_pip() && _isyes(Base.prompt("Try installing $pkgname using pip? [Y/n]")) |
|
118 | - | # installing with pip is riskier, so we ask for permission |
|
119 | - | run(`$(PyCall.pyprogramname) -m pip install -- $pkgname`) |
|
120 | - | pyimport(modulename) |
|
121 | - | else |
|
122 | - | error("Dependency $modulename cannot be imported. Install manually to continue.") |
|
115 | + | catch e |
|
116 | + | if _has_pip() && _isyes(Base.prompt("Try installing $pkgname using pip? [Y/n]")) |
|
117 | + | # installing with pip is riskier, so we ask for permission |
|
118 | + | run(PyCall.python_cmd(`-m pip install -- $pkgname`)) |
|
119 | + | return pyimport(modulename) |
|
120 | + | end |
|
121 | + | # PyCall has a nice error message |
|
122 | + | throw(e) |
|
123 | 123 | end |
|
124 | 124 | end |
|
125 | 125 |
127 | 127 | ||
128 | 128 | _using_conda() = PyCall.conda |
|
129 | 129 | ||
130 | - | _has_pip() = ispynull(pyimport_e("pip")) |
|
130 | + | _has_pip() = _has_pymodule("pip") |
|
131 | 131 | ||
132 | 132 | _has_pymodule(modulename) = !ispynull(pyimport_e(modulename)) |
Files | Coverage |
---|---|
src | 88.06% |
Project Totals (13 files) | 88.06% |