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

Do not run conda install automagically (unless Conda.jl is used) #580

Merged
merged 1 commit into from
Sep 23, 2018

Conversation

tkf
Copy link
Member

@tkf tkf commented Sep 22, 2018

fix #560

@@ -683,6 +674,12 @@ function pyimport_conda(modulename::AbstractString, condapkg::AbstractString,
Pkg.build("PyCall")
before trying again.

Copy link
Member

@stevengj stevengj Sep 22, 2018

Choose a reason for hiding this comment

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

The error message should also suggest that the user run \"$aconda install -y $condapkg\" manually

Copy link
Member Author

Choose a reason for hiding this comment

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

I did that below. Isn't it enough?:

PyCall.jl/src/PyCall.jl

Lines 680 to 681 in f1def60

To install $condapkg using $aconda, you can run the following command from your system shell:
$aconda install$options $condapkg

return pyimport(modulename)
if isempty(aconda)
# Not in conda environment; show the error from `pyimport`.
rethrow()
Copy link
Member

Choose a reason for hiding this comment

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

This is the case where it should say that PyCall was configured to use $python and suggest configuring with Conda.jl if the user wants automatic installation.

Copy link
Member Author

Choose a reason for hiding this comment

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

With #579 merged this rethrow() should show the detailed error message from pyimport:

PyCall.jl/src/PyCall.jl

Lines 461 to 482 in c45a076

msg = msg * """
PyCall is currently configured to use the Python version at:
$python
and you should use whatever mechanism you usually use (apt-get, pip, conda,
etcetera) to install the Python package containing the $name module.
One alternative is to re-configure PyCall to use a different Python
version on your system: set ENV["PYTHON"] to the path/name of the python
executable you want to use, run Pkg.build("PyCall"), and re-launch Julia.
Another alternative is to configure PyCall to use a Julia-specific Python
distribution via the Conda.jl package (which installs a private Anaconda
Python distribution), which has the advantage that packages can be installed
and kept up-to-date via Julia. As explained in the PyCall documentation,
set ENV["PYTHON"]="", run Pkg.build("PyCall"), and re-launch Julia. Then,
To install the $name module, you can use `pyimport_conda("$(escape_string(name))", PKG)`,
where PKG is the Anaconda package the contains the module $name,
or alternatively you can use the Conda package directly (via
`using Conda` followed by `Conda.add` etcetera).
"""

I guess it covers what you are saying?

@stevengj stevengj merged commit bb7c9bb into JuliaPy:master Sep 23, 2018
@tkf tkf deleted the pyimport_conda branch November 4, 2018 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On anaconda_conda
2 participants