Failing to conda build R package - r

I'm trying to use conda and Jupypter to write some R code. I found a useful package called 'treatSens' and tried to install via conda following the instructions here.
conda install conda-build
conda skeleton cran treatSens
conda build r-treatsens
conda install -c local r-treatsens
Then I got this error conda_build.exceptions.DependencyNeedsBuildingError: Unsatisfiable dependencies for platform osx-64: {"r-dbarts[version='>=0.9_1']"}. How do I satisfy this dependency? Any suggestion is appreciated.
===UPDATE====
Added --recursive then I got a new error, posted a new question
here.

Try the following:
conda install conda-build
conda skeleton cran --recursive treatSens
conda build r-treatsens
conda install -c local r-treatsens
The recursive option should account for the dependencies you need.

Related

Installing R development version in Conda environment

I would like to install R development version (i.e. latest daily snapshot) inside a conda environment. I haven't found any conda package that would allow me to install such a version from conda directly. I can install it from source, but I'm not sure how well that would work. Any suggestion on whether this is possible or do you know of any other preferable way to perform the installation? I'm aware I could use a container, but I'd rather avoid that option for now. Thanks!
No Anaconda Cloud channels build the R development version.
Conda is a package manager that works with non-Python packages as well. Before installing any packages, you should set up a new conda environment with conda create -n r-env (replace env-name with your desired name). Then you need to activate it with conda activate r-env. Then you can install the essential R packages with conda install r-essentials -c conda-forge.
In case you are unfamiliar with the -c flag, it tells conda to look at a specific channel when looking for your packages. -c conda-forge thus searches on the conda-forge-channel.

R fails to load igraph in conda environment

I am trying to run an RShiny app in a WSL2 installation of Ubuntu on Windows. I am no expert in R, but I feel this is a problem due to conda interaction with R. I run the following commands:
conda create -n r_env r-essentials r-base
conda activate r_env
conda install -c conda-forge r-shiny
conda install -c r r-visnetwork
conda install -c conda-forge r-dplyr
conda install -c r r-dt
conda install -c conda-forge r-igraph
conda install -c r r-leaflet
conda install -c conda-forge r-rgdal
conda install -c r r-shinydashboard
conda install -c conda-forge r-shinywidgets
conda install -c conda-forge r-shinycssloaders
conda install -c conda-forge r-igraph
When I run R and type in : library(igraph) i get:
->Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/carlo/anaconda3/envs/r_env/lib/R/library/igraph/libs/igraph.so':
but I can list it, it's there:
ll /home/carlo/anaconda3/envs/r_env/lib/R/library/igraph/libs/igraph.so
-> -rwxrwxr-x 1 carlo carlo 3816608 Mar 31 15:38 /home/carlo/anaconda3/envs/r_env/lib/R/library/igraph/libs/igraph.so
Did anybody encounter a similar problem?
The igraph library was meant to load correctly
(My Opinion) I would caution against the use of the r channel and the r-essentials package. The Continuum/Anaconda support for R was a good college-try, but is since outmoded and superseded by the broader CRAN support that Conda Forge provides. Users managing R environments will find a better experience ignoring any Continuum/Anaconda documentation and exclusively using Conda Forge for their R environments. (End Opinion)
Mixing channels can lead to symbol reference errors. Furthermore, sequences of ad hoc installations are subpar - instead specify through a YAML.
The following YAML file works just fine on linux-64, osx-64, and win-64 platforms:
so-igraph.yaml
name: so-igraph
channels:
- conda-forge
dependencies:
- r-base=4.1 # adjust to desired version
- r-shiny
- r-visnetwork
- r-dplyr
- r-dt
- r-igraph
- r-leaflet
- r-rgdal
- r-shinydashboard
- r-shinywidgets
- r-shinycssloaders
- r-igraph
Which can be used with
conda env create -n so-igraph -f so-igraph.yaml
conda activate so-igraph
I was having a similar problem with R on AlmaLinux, and it turned out I was missing some libraries on the OS itself, which I thought I had and that were necessary for some R packages. I think they were these, which makes sense, given that we're talking about igraph, a graphing package:
gsl-devel-2.5-1.el8.x86_64
gsl-2.5-1.el8.x86_64
openssl-1.1.1k-6.el8_5.x86_64
geos-devel-3.7.2-1.el8.x86_64
geos-3.7.2-1.el8.x86_64
proj-datumgrid-1.8-6.3.2.4.el8.noarch
proj-6.3.2-4.el8.x86_64
libtiff-devel-4.0.9-21.el8.x86_64
libgeotiff-devel-1.5.1-1.el8.x86_64
libgeotiff-1.5.1-1.el8.x86_64
Installing openblas may work, see https://github.com/conda-forge/r-igraph-feedstock/issues/19

conda install r-essentials takes forever

I am unable to install the r-base and r-essentials packages into my conda environment. Whenever I run
conda install -c r r-base r-essentials
I just get the Solving environment message for a good hour or more before I just exit out altogether. This even occurs when I create a brand new environment without any other packages before attempting to install r-base and r-essentials.
What is going on here and is there any way to fix this?
Try that. conda install -c conda-forge r r-essentials.
For some reason there is a conflict when r-essentials and pip are in the same conda environment. You can solve it by creating a new environment that has the package directly:
conda create -n r_env -c r r-essentials

How to install Hotelling (R package) with conda?

I am trying to install this package to use with R in conda:
Hotelling
However, I get this error message with the conda install:
$ conda install Hotelling
Fetching package metadata .................
PackageNotFoundError: Packages missing in current channels:
hotelling
We have searched for the packages in the following channels:
https://conda.anaconda.org/bioconda/osx-64
https://conda.anaconda.org/bioconda/noarch
https://conda.anaconda.org/conda-forge/osx-64
https://conda.anaconda.org/conda-forge/noarch
https://repo.continuum.io/pkgs/main/osx-64
https://repo.continuum.io/pkgs/main/noarch
https://repo.continuum.io/pkgs/free/osx-64
https://repo.continuum.io/pkgs/free/noarch
https://repo.continuum.io/pkgs/r/osx-64
https://repo.continuum.io/pkgs/r/noarch
https://repo.continuum.io/pkgs/pro/osx-64
https://repo.continuum.io/pkgs/pro/noarch
https://conda.anaconda.org/r/osx-64
https://conda.anaconda.org/r/noarch
It isn't available on any anaconda repos. You can add it to a private repo and then install it using conda. Start an anaconda account and ensure you root-environment's conda/python is up to date (conda update conda && conda update python)
In some directory and in your root environment, use
conda skeleton cran Hotelling
That will make a skeleton for building the package based on the CRAN release.
Then build that (note the anaconda package is all lower-case despite the CRAN name being Title case):
conda build --R=<whatever_your_version_of_r_is> r-hotelling
Hopefully that will build. If it's succesful it should give you a message that tells you how to upload to your account on anaconda-cloud
anaconda upload <path_to_your_built_r-hotelling> -u <your_account_name>
Then install it:
conda install -c <your_account_name> r-hotelling

Anaconda Jupyter R install

Hi I tried to install R for my Jupyter notebook (Anaconda) and used the below command in my Anaconda prompt "conda install -c r r-essentials". But there is an error like below: any suggestions (especially missing package).
(C:\Anaconda3) C:\windows\system32>conda install -c r r-essentials
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata ...Could not connect to
https://repo.continuum.io/pkgs
/pro/noarch/
Could not connect to https://repo.continuum.io/pkgs/free/win-64/
Could not connect to https://repo.continuum.io/pkgs/pro/win-64/
...Could not connect to https://conda.anaconda.org/r/win-64/
.Could not connect to https://conda.anaconda.org/r/noarch/
.Could not connect to https://repo.continuum.io/pkgs/free/noarch/
.
Solving package specifications: .
Error: Package missing in current win-64 channels:
- r-essentials
You can search for packages on anaconda.org with
anaconda search -t conda r-essentials
(C:\Anaconda3) C:\windows\system32>
Thanks
Try this alternative. It worked on my colleague's machine:
conda create -n my-r-env -c r r-essentials
Another approach would be to reinstall Anaconda and execute
conda install -c r r-essentials
Let us know if it worked.

Resources