0

I am using snakemake as workflow manager. I first create a conda environment in JupyterLab (anaconda) with: conda create base. Then I activate a .yaml file with mamba env create --name <name of the env> --file environment.yaml. In the .yaml file I include among other the following dependencies: R = 4.1.3, tensorflow = 2.8.0. At this point I get an error message:

Encountered problems while solving:

  • nothing provides requested r 4.1.3**
  • nothing provides requested tensorflow 2.8.0**.

As far as I understand, the dependencies are going to be take care of by conda in the local environment. I eventually installed manually tensorflow in the local environment with pip install tensorflow. Nevertheless, I get the same error message when I try to activate the .yaml file. I know that I have already installed R.

What should I do ? I have Ubuntu 20.04.4 LTS.

Many thanks.

Tzane
  • 2,752
  • 1
  • 10
  • 21
user249018
  • 505
  • 2
  • 5
  • 18

1 Answers1

0

Packages are not found because the current highest versions of tensorflow from conda is 2.7.0 and the highest available for R is 4.1.0, so you have to downgrade if you want to install using conda.

For tensorflow, you can tell conda to use pip instead, but I don't know if there is a similar workaround for R.

Edit: Fixed R version

Tzane
  • 2,752
  • 1
  • 10
  • 21
  • 1
    @user249018 It's as if you would activate your conda environment and then call `python -m pip install ...`, so it install whatever version you specify to your active environment. The only downside is you can't manage the package with conda, so you would have to mange pip tracked packages with pip instead of conda. – Tzane Apr 14 '22 at 10:48
  • Many thanks. Does it mean it will install the latest tensorflow version ? What do you mean by 'Fixed R version' i.e. should I include the latest R version under the pip dependencies in the .yaml file ? – user249018 Apr 14 '22 at 10:49
  • 1
    @user249018 I don't think you can install R with pip so that wouldn't work. Easiest way for R would be to just the use latest available version available on conda unless there is something crucial in the minor releases. I added "Fixed R version" because I had linked to an incorrect version of R in my answer originally. – Tzane Apr 14 '22 at 10:54
  • I included tensorflow under pip inside the .yaml document, while R 4.1.0 was listed just like the rest of the dependencies. I get now the following error message: `Encountered problems while solving: - package r-4.1-r41hd8ed1ab_1004 requires r-base >=4.1,<4.2.0a0, but none of the providers can be installed`. Do you have any suggestion how I can overcome this ? – user249018 Apr 14 '22 at 11:15
  • [R Base](https://anaconda.org/conda-forge/r-base) version 4.1 should be available. There was some possibly related discussion over here: https://stackoverflow.com/questions/68336674/unsatisfiable-conda-packages-though-packages-are-found-in-conda-forge-package-x but I think you are better of asking another question regarding R in conda if you can't find anything. – Tzane Apr 14 '22 at 11:22
  • 2
    It turns out that tying in `r-base` and under pip `tensorflow == 2.8.0` in the yaml file solved the issue. – user249018 Apr 14 '22 at 12:08