MyNixOS website logo
Description

Easy to Configure an Isolated 'Python' Environment.

Aims to create a single isolated 'Miniconda' and 'Python' environment for reproducible pipeline scripts. The package provides utilities to run system command within the 'conda' environment, making it easy to install, launch, manage, and stop 'Jupyter-lab'.

Isolated Miniconda, Python, and Matlab (experimental) Environment

R-CMD-check

The goal of rpymat is to create a single isolated Miniconda and Python environment for reproducible pipeline scripts. The package is a shell of reticulate package, but provides more stable behaviors, especially on 'ARM' machines.

Installation

You can install the released version of rpymat from CRAN with:

install.packages("rpymat")

Configure environment

Configure python after installation

# change `python_ver` accordingly
rpymat::configure_conda(python_ver = 'auto')

Add Python or conda packages

# Add conda packages
rpymat::add_packages(c('pandas', 'numpy'))

# Add conda packages from channels
rpymat::add_packages(c('h5py'), channel = "conda-forge")

# Add pip packages
rpymat::add_packages(c('sklearn'), pip = TRUE)

Use Jupyterlab

# Install Jupyterlab, will install
# numpy, h5py, matplotlib, pandas, 
# jupyter, jupyterlab, jupyterlab-git, ipywidgets, jupyter-server-proxy
# jupyterlab_latex, jupyterlab_github, matlab_kernel
rpymat::add_jupyter()

# Launch Jupyterlab
rpymat::jupyter_launch(async = FALSE)

Advanced configurations:

rpymat::jupyter_launch(
    async = TRUE, workdir = "~",
    port = 18888, open_browser = TRUE,
    token = "IwontTellYouMyToken"
)

To query existing servers

rpymat::jupyter_server_list()
#>        host  port                                              token
#> 1 127.0.0.1  8888 3hzWfGPa0EOmonaNS48jrTvpw07KiX7VKerA9ZTFJMkCOJMgfB
#> 2 127.0.0.1 18888                                IwontTellYouMyToken

To stop a server

rpymat::jupyter_server_stop(port = 18888)

Use rpymat with reticulate

# Initialize the isolated environment

rpymat::ensure_rpymat()

rpymat::repl_python()

Then run python code interactively.

Alternatively, you can use rpymat::run_script(path) to execute Python scripts, and use reticulate::py to obtain the results.

Uninstall

The following command will erase the environment completely.

rpymat::remove_conda()
Metadata

Version

0.1.7

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows