I'm using PyJulia to run a Julia file in Python. The file I want to run uses a package, that is already installed on Julia. But it still gives the following error:
JULIA: LoadError: ArgumentError: Package LowRankApprox not found in current path: Run `import Pkg; Pkg.add("LowRankApprox")` to install the LowRankApprox package.
Why are you giving this error, if the package has already been installed on Julia?
To force Julia to use its own Python distribution, via Conda, simply set ENV["PYTHON"] to the empty string "" and re-run Pkg. build("PyCall") . The current Python version being used is stored in the pyversion global variable of the PyCall module. You can also look at PyCall.
Julia is a high-level, high-performance, dynamic programming language for numerical computing. Users can import arbitrary Python modules and libraries into Julia.
By default, packages will be installed to ~/. julia/packages . To exit package mode, enter the Backspace key on an empty line.
You can call Python as needed, but you'll probably find that almost everything in NumPy and SciPy can be done natively with Julia packages. Definitely this. NumPy and SciPy are necessary in Python to make numerical computing fast, but Julia arrays are far nicer to work with (and I assume just as fast).
You need to make sure that the correct Julia environment got activated by pyjulia. Try running in Python:
from julia import Pkg
Pkg.activate("/home/user/.julia/environments/v1.5") #use the correct path
You need to use the directory path exactly the same that Julia is using (this is the folder where Project.toml
is stored). To check what is the correct path run in Julia:
julia> using Pkg; Pkg.activate()
Activating environment at `/home/user/.julia/environments/v1.5/Project.toml`
Last but not least, for the best results I recommend using the Python Anaconda that gets installed together with Julia (using Pkg; Pkg.add("PyCall");Pkg.add("Conda");using Conda;Conda.add("whateveranacondapackageyouneed")
). It gets installed to your Julia folder and the Anaconda version that gets installed this way has been tested against integration issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With