Skip to content

Instantly share code, notes, and snippets.

View lgautier's full-sized avatar

Laurent Gautier lgautier

View GitHub Profile
@lgautier
lgautier / multiproc_lab.py
Created January 3, 2020 23:02
"Lab" to show how to perform parallel R computing using `multiprocessing`.
import argparse
import multiprocessing as mp
import uuid
import rpy2.rinterface as ri
import rpy2.rinterface_lib.embedded
R_ID_TAG = '_rpy2_R_id_'
def print_setup(args):
Python 3.8.10 (default, Mar 13 2023, 10:26:41)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.11.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from rpy2.robjects.packages import importr
In [2]: reticulate = importr('reticulate')
WARNING: The R package "reticulate" only fixed recently
an issue that caused a segfault when used with rpy2: