I am trying to package some of my Python code that calls R code using rpy2. That R code currently sits in a separate file which I source
from the Python script. For
This question might be dated, but I ran into the same issue today and wanted to provide more detail for the question 1 solution suggested by @ivan_pozdeev and a new solution for question 2.
1) Edit your setup.py file to:
from setuptools import setup, find_packages
setup(
...
# If any package contains *.r files, include them:
package_data={'': ['*.r', '*.R']},
include_package_data=True)
)
2) Conda is quickly becoming a good option for dealing with package dependencies across both python and R. You can create an environment (http://conda.pydata.org/docs/using/envs), download all the r and python packages that you might need, and then generate an environment.yml file so that anyone can replicate your environment. Check out this blog for more info: https://www.continuum.io/content/conda-data-science