Installing pyjulia
See original GitHub issueHere is a little function that downloads julia if needed, set up an environmnt and instantiate the project.
I think something similar should be provided so that users can call it in setup.py
def setup_pyjulia_env(path_to_project="."):
"""
A function that installs all dependencies for current environment.
This should be the same as what `juliacall` does at every import time.
* `path_to_project` is the path to the project that will be instantiated.
If `None`, no project will be instantiated. Defaults: to the current
working directory.
"""
import jill.install # noqa: autoimport
import os # noqa: autoimport
import shutil # noqa: autoimport
if shutil.which('julia') is None:
print(
"No Julia executable found, installing the latest version using `jill`")
jill.install.install_julia("stable", confirm=True)
if shutil.which('julia') is None:
print(f"Please add {os.environ['JILL_SYMLINK_DIR']} to your path")
import julia # noqa: autoimport
# the following installs dependencies for pyjulia
julia.install()
from julia.api import LibJulia # noqa: autoimport
if path_to_project is not None:
api = LibJulia.load()
api.init_julia([f"--project={path_to_project}"])
from julia import Main # noqa: autoimport
Main.eval('using Pkg')
Main.eval('Pkg.instantiate()')
Example from: https://github.com/00sapo/pyjulia-vs-juliacall
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
PyJulia Documentation
This installs Julia packages required by PyJulia. See also julia.install. Alternatively, you can use Julia's builtin package manager. julia> using Pkg julia> ...
Read more >JuliaPy/pyjulia: python interface to julia - GitHub
Experimenting with developing a better interface to Julia language that works with Python 2 & 3 and Julia v1.0+. Quick usage. $ python3...
Read more >julia - PyPI
Quick usage. $ python3 -m pip install julia # install PyJulia ... # you may need `--user` after `install ...
Read more >Installing PyJulia on Windows - python - Stack Overflow
Looks like you forgot to configure Python Julia module. You should run: import julia julia.install(). In this way Python should be able to ......
Read more >Pyjulia - :: Anaconda.org
noarch v0.6.0. conda install. To install this package run one of the following: conda install -c conda-forge pyjulia. Description.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I neglected to mention here that I wrote a python package find_julia. It is lightweight and should be easy to use. It is a bit featureful, has more than you would want to put in pyjulia.
It supports specifying the required Julia version in exactly the same syntax and semantics that Julia does with julia_semver.
By default it prefers looking in the juliaup directory first and returns the best match. If there is no match, it looks in jill-installed locations. This is because the latter is a bit slower; juliaup caches the julia versions.
It offers to install, if none is found. This is done via jill.py, which is loaded on demand because it takes >50ms to load. In the future, supporting juliaup for downloading would be a good idea. I would do it now, but juliaup is still developing and it does not yet have an API.
Just to clarify: I think it’s very unlikely that I will merge or review a patch that maintains Julia installations in a Python-specific way. There should be a language-agnostic user-facing interface (like juliaup CLI).