3

I would like to install a local R package into a conda environment. The package is not on CRAN or github (and not on any conda channel). For packages on CRAN this is relatively straightforward:

conda skeleton cran <pckg>
conda-build r-<pckg>
conda install --use-local r-<pcgk>

For packages on github this works similarly: install R package from github using "conda" (apart from some issues of versions requiring tags).

conda skeleton cran <url>/<pcgk>
conda-build r-<pckg>
conda install --use-local r-<pcgk>

However, I cannot get this to work with a local package (the package builds without problems using R CMD build). This is what I have tried:

conda skeleton cran <path>/<pcgk>

Connects to cran and then (of course) does not find the package.

conda skeleton cran --cran-url  <relative_path>/<pckg> <pckg>

throws an error with:

requests.exceptions.MissingSchema: Invalid URL '<relative_path>/<pckg>/src/contrib/': No schema supplied. Perhaps you meant http://<relative_path>/<pckg>/src/contrib/? 
conda skeleton cran <absolute_path>/<pckg> <pckg>

Throws:

File "/home/myuser/.conda/envs/myenv/lib/python3.9/site-packages/conda_build/skeletons/cran.py", line 743, in package_to_inputs_dict
    pkg_name = re.match(r'(.*)_(.*)', pkg_filename).group(1).lower()
AttributeError: 'NoneType' object has no attribute 'group'

And lastly:

conda skeleton cran --cran-url  <absolute_path>/<pckg> <pckg>

Throws:

 File "/home/myuser/.conda/envs/myenv/lib/python3.9/site-packages/requests/sessions.py", line 742, in get_adapter
    raise InvalidSchema("No connection adapters were found for {!r}".format(url))
requests.exceptions.InvalidSchema: No connection adapters were found for '<absolute path>/<pckg>/src/contrib/'

Is this not possible with conda? Or am I making a mistake?

Here someone tried to write the skeleton files for a local package themselves, but it seems without success.

fry
  • 509
  • 3
  • 10

1 Answers1

0

If you can upload your R package to your private github repository, then you could proceed with the common conda skeleton cran <github_pckg_http_or_ssh>.

conda will ask (internally by git, I think) for your password to retrieve the code.

merv
  • 67,214
  • 13
  • 180
  • 245
Puriney
  • 2,417
  • 3
  • 20
  • 25