Simon Danisch / Sep 17 2019
Julia Python Image
CONDA_VER="4.5.4" curl -sSL -o ~/anaconda.sh \ https://repo.continuum.io/miniconda/Miniconda3-${CONDA_VER}-Linux-x86_64.sh /bin/bash ~/anaconda.sh -b -p /opt/conda rm ~/anaconda.sh
# make this the last alphabetically => lowest precedence libraries echo "/opt/conda/lib" >> /etc/ld.so.conf.d/zz-conda.conf conda config --set always_yes True printf "[global]\ndisable-pip-version-check = True\n" > /etc/pip.conf echo 'pip >=19.1' > /opt/conda/conda-meta/pinned # prevent pip downgrade # upgrade Python within minor version PYTHON_MINOR=`python --version 2>&1 | sed 's/Python //;s/.[0-9] ::.*//;'` echo "python =$PYTHON_MINOR" >> /opt/conda/conda-meta/pinned conda update python conda update -yn base conda conda clean -qtipy ldconfig python -V pip -V
conda install -c matplotlib numpy jupyter conda clean -qtipy ldconfig pip install --upgrade jupyter-client python -V pip -V jupyter --version jupyter kernelspec list jupyter --paths
pip install julia https://github.com/tkf/ipyjulia_hacks/archive/master.zip#egg=ipyjulia_hacks
]add PyCall
using PyCall PyCall.current_python()
"/opt/conda/bin/python3"
import julia julia.install() # install PyCall.jl etc. from julia import Base # short demo println(Base.sind(90))
Julia
write("test.py", """ import julia from julia.api import Julia jl = Julia(compiled_modules=False) #julia.install() # install PyCall.jl etc. from julia import Base # short demo print(Base.sind(90)) """)
186
python3 test.py
import julia from julia.api import Julia jl = Julia(compiled_modules=False) #julia.install() # install PyCall.jl etc. from julia import Main from julia import Base # short demo print(Base.sind(90)) Main.eval("Dict(:a => 22)")
from julia import Colors from julia import ImageShow class Bla: def _repr_png_(self): img = Main.rand(Colors.RGB, 100, 100) return Main.repr(Main.eval('MIME"image/png"()'), img) Bla()