Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conda skeleton install R package from github #6674

Closed
nick-youngblut opened this issue Jan 6, 2018 · 9 comments
Closed

conda skeleton install R package from github #6674

nick-youngblut opened this issue Jan 6, 2018 · 9 comments
Labels
locked [bot] locked due to inactivity

Comments

@nick-youngblut
Copy link

If possible, I'd like to install an R package into my conda environment, but the R package is only available on GitHub. Is there any way that I can use conda skeleton to create a conda package for this R package, or am I stuck using devtools::install_github within R?

@mingwandroid
Copy link
Contributor

You can just pass the github url to conda skeleton cran. It requires a specific layout (DESCRIPTION file in the root AFAIR). PRs to search for this file in subfolders would be welcomed.

@kalefranz
Copy link
Contributor

PRs to search for this file in subfolders would be welcomed.

In conda-build :)

@nick-youngblut
Copy link
Author

Thanks for the quick reply! I'm unclear about what you mean by

It requires a specific layout (DESCRIPTION file in the root AFAIR)

As a test, I tried the following and ran into an error:

$ conda skeleton cran https://github.com/reptalex/phylofactor
Tip: install CacheControl and lockfile (conda packages) to cache the CRAN metadata
Fetching metadata from https://cran.r-project.org/
Parsing input package https://github.com/reptalex/phylofactor:
.. name: phylofactor location: https://github.com/reptalex/phylofactor new_location: /ebio/abt3_projects/software/dev/conda_packages/r-phylofactor
Making/refreshing recipe for phylofactor
Cloning into bare repository '/ebio/abt3_projects/software/dev/miniconda3_dev/conda-bld/git_cache/github.com/reptalex/phylofactor'...
remote: Counting objects: 2439, done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 2439 (delta 5), reused 12 (delta 3), pack-reused 2415
Receiving objects: 100% (2439/2439), 15.74 MiB | 7.97 MiB/s, done.
Resolving deltas: 100% (1655/1655), done.
Checking connectivity... done.
Cloning into '/ebio/abt3_projects/software/dev/miniconda3_dev/conda-bld/skeleton_1515315639680/work'...
done.
checkout: 'HEAD'
Your branch is up-to-date with 'origin/master'.
==> git log -n1 <==

fatal: No names found, cannot describe anything.
commit be62474fe5d2b6100d709f3636e96912757839e2
Author: Alex Washburne <bigalculus@gmail.com>
Date:   Sat Jan 6 09:05:53 2018 -0700

    ...

==> git describe --tags --dirty <==

commit be62474fe5d2b6100d709f3636e96912757839e2
Author: Alex Washburne <bigalculus@gmail.com>
Date:   Sat Jan 6 09:05:53 2018 -0700

    ...

==> git status <==

On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean


Leaving build/test directories:
  Work:	 /ebio/abt3_projects/software/dev/miniconda3_dev/conda-bld/skeleton_1515315639680/work
  Test:	 /ebio/abt3_projects/software/dev/miniconda3_dev/conda-bld/skeleton_1515315639680/test_tmp
Leaving build/test environments:
  Test:	source activate  /ebio/abt3_projects/software/dev/miniconda3_dev/conda-bld/skeleton_1515315639680/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac
  Build:	source activate  /ebio/abt3_projects/software/dev/miniconda3_dev/conda-bld/skeleton_1515315639680/_build_env


Error: no tags found

The repo has a DESCRIPTION file, which looks like it's correctly formatted. I don't really understand the no tags found error.

@mingwandroid
Copy link
Contributor

mingwandroid commented Jan 7, 2018

It tries to find the most recent tag and errors out if there are none. You should ask the project if they can make a release and tag it (or else make a PR to conda-build to add an argument for which git reference to use, where no value means latest tag).

BTW, please open issues against conda-build in the conda-build repository. All conda skeleton are actually implemented there (confusing, I know).

@nick-youngblut
Copy link
Author

Thanks for the clarification! This should probably be a different thread/issue, but when trying to use conda skeleton cran on many packages (eg., phylosignal), I get dependency errors during the conda-build step. For example:

conda_build.exceptions.DependencyNeedsBuildingError: Unsatisfiable dependencies for platform linux-64: {'r-rnexml', "r-rncl[version='>=0.6.0']"}

When I try to then run conda skeleton cran on the dependency R packages (they aren't available on any anaconda channel), I get new errors with their dependencies. Is there any way to automate the process of creating a conda package with conda skeleton cran and also creating packages for all of the dependencies missing in conda channels, or will I need to build each R package separately, starting with the lowest dependencies and working up from there?

Sorry for all of the questions, but I can't find much documentation on using conda skeleton cran. I'm probably just not looking hard enough.

@mingwandroid
Copy link
Contributor

I'm probably just not looking hard enough

Indeed.

conda skeleton cran --help should be err, helpful?

@nick-youngblut
Copy link
Author

Yep, you're absolutely right. When I last looked at conda skeleton cran --help, I saw the --no-recursive, but I missed that there as also a --recursive. That's what I get for reading the help too quickly. Sorry to waste your time

@krinsman
Copy link

In reference to old comment from above: #6674 (comment)

For anyone else coming here via Google search, a quick workaround to this is forking the repository on GitHub you want to make a conda package from, and then adding a tag to your forked repository, e.g. in the terminal

git clone https://github.com/your_username/forked_repo  destination/forked_repo
cd destination/forked_repo
git tag v0.0.0
git push --tags

Then using e.g. conda skeleton cran https://github.com/your_username/forked_repo on your forked repo will do the trick. This is helpful for version control, e.g. to ensure you make a package from the same commit in the future, or e.g. if the original repo is otherwise destroyed or lost.

@statneutrino
Copy link

statneutrino commented Oct 8, 2021

Hi - I successfully managed to use this method to installr package cmdstanr on Windows conda using the following commands:

conda skeleton cran https://github.com/stan-dev/cmdstanr
conda-build --R 4.1.1 cmdstanr

but now on a different machine on Linux I am getting this error:

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done

fatal: unable to access 'https://github.com/stan-dev/cmdstanr/': Could not resolve host: github.com Failed to update local git cache. Deleting local cached repo: /home/statneutrino/anaconda3/conda-bld/git_cache/github.com/stan-dev/cmdstanr Warning: failed to download source. If building, will try again after downloading recipe dependencies.
Error was:
Command '['/home/statneutrino/anaconda3/conda-bld/r-cmdstanr_1633704969477/_build_env/bin/git', 'fetch']' returned non-zero exit status 128. Failed to download or patch source. Please see build log for info.

Can anyone help? I've spent many hours and I feel like I'm almost there...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity
Projects
None yet
Development

No branches or pull requests

5 participants