Reputation: 3138
I'm trying to configure Python and Julia to interoperate using these directions.
This is what I've done.
julia
to my path.PyCall.jl
PyJulia
using python3 -m pip install julia
. This installs pyjulia into my current conda environment's python as well as python-jl
.Now, I think I understand the problems that conda python can cause because of the the statically linked libpython. According to those directions, you can bypass this problem by running python-jl
which is installed with PyJulia and runs using a distribution of python that is separate from the system or any conda install distributions.
However, when I run one of the example tests python-jl -c 'from julia.Base import banner; banner()'
, I receive the following error.
ERROR: PyError (PyImport_ImportModule
The Python package julia could not be found by pyimport. Usually this means
that you did not install julia in the Python version being used by PyCall.
PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package. To install the julia module, you can
use `pyimport_conda("julia", PKG)`, where PKG is the Anaconda
package the contains the module julia, or alternatively you can use the
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).
Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python. As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.
) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'julia'")
Stacktrace:
[1] pyimport(::String) at /Users/austin/.julia/packages/PyCall/0jMpb/src/PyCall.jl:486
[2] top-level scope at none:0
Based off of this, I need to install the PyJulia package julia
on to the Julia distribution of Python. There seems to be a hint on how to do this pyimport_conda("julia", PKG)
but it's not clear what is meant by PKG
...
where PKG is the Anaconda package the contains the module julia
From here, I don't know what to try next or if I should report an issue to PyJulia
. Any help would be appreciated.
Upvotes: 2
Views: 1568
Reputation: 1905
I do not see any issue with your steps and in fact on my Ubuntu 18.04 system, they work (I can call the banner()
function from python).
I would just try this (install PyJulia explicely with python-jl
):
python-jl -c "import pip; pip.main(['install', 'Julia'])"
In any case, opening an issue, would be very useful.
Upvotes: 1