Clara Apicella
Clara Apicella

Reputation: 13

Mambaforge cannot collect package metadata for perl-dbi (MacOS M1), to install snakemake

I am really new to anything bioinformatics, so sorry if things are not that clear. I am trying to run a snakemake pipeline for genome analysis. I have installed mambaforge for MacOSM1 by downloading the Mambaforge-MacOSX-arm64.sh file from github.com/conda-forge/miniforge#mambaforge. Then, from the terminal I run:

bash Mambaforge-$(uname)-$(uname -m).sh -u

Then I tried to install snake-make with:

conda activate base

From this point on, all commands were triggered from the base environment

mamba create -c bioconda -c conda-forge -n snakemake snakemake-minimal

mamba started running, but I got the following error code, as well as a full error report: 'Multi-download failed. Reason: Transfer finalized, status: 404 [https://conda.anaconda.org/perl-dbi/noarch/repodata.json] 3091 bytes'

  1. To solve this I first tried severel another way to install snakemake:

mamba create --only-deps -n snakemake-main snakemake

but the same error appeared.

  1. then I tried with pip and it seeemed to have worked:

pip install git+https://github.com/snakemake/snakemake

since it looked like the different packages could be downloaded successfully. However, in the end it was not possible to activate snakemake with:

conda activate snakemake

Since it gave the error:

EnvironmentNameNotFound: Could not find conda environment: snakemake You can list all discoverable environments with: 'conda info --envs'.

  1. Then I realised that the link that manba is tring to use for perl-dbi was indeed not available so I tried to change the address of the channel by editing the .condarc file:
(base) clara@Claras-MacBook-Air ~ % conda config --show-sources        
==> /Users/clara/mambaforge/.condarc <==
channels:
  - bioconda

==> /Users/clara/.condarc <==
auto_activate_base: False
channel_priority: strict
channels:
  - bioconda
  - conda-forge
  - https://anaconda.org/bioconda/perl-dbi/
  - defaults

And again it did not manage to download it:

(base) clara@Claras-MacBook-Air ~ % conda install -c bioconda snakemake
Collecting package metadata (current_repodata.json): failed

UnavailableInvalidChannel: HTTP 404 NOT FOUND for channel bioconda/perl-dbi <https://anaconda.org/bioconda/perl-dbi>

The channel is not accessible or is invalid.

You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state,
and use `conda config --show-sources` to view config file locations.


Thank you so much for any light you might be able to shed on this!

Upvotes: 1

Views: 1343

Answers (2)

Cornelius Roemer
Cornelius Roemer

Reputation: 8286

Snakemake comes from bioconda, and bioconda only has an osx-64 channel at the time of writing (2023-06-02) [in contrast to conda-forge, which has osx-arm as well, see e.g. this or that Github issue]

You need to tell conda/mamba that you want to create an osx-64 environment. There are two ways: 1. set the environment variable CONDA_SUBDIR=osx-64 every time you invoke mamba/conda or 2. run conda config --env --set subdir osx-64 once inside your environment

CONDA_SUBDIR=osx-64 mamba create -c bioconda -c conda-forge -n snakemake snakemake-minimal
conda config --env --set subdir osx-64

This should work. However, make sure you have installed rosetta2, otherwise the osx-64 binaries cannot run.

Your workaround with pip didn't work because pip doesn't know anything about conda environments, pip would use the Python/pip of your active environment and install packages into that environment, but it's a bad idea to mix pip and conda/mamba.

Related questions:

Upvotes: 0

SultanOrazbayev
SultanOrazbayev

Reputation: 16581

If a suitable package is not available for M1, one possible work-around is to use docker and run the workflow inside a container using Intel version:

docker run --rm -it --platform linux/amd64 some_image bash

Note that some_image should be changed to an image containing the workflow. If such an image does not exist, it might be possible to use a default snakemake image.

For further details refer to https://forums.docker.com/t/run-x86-intel-and-arm-based-images-on-apple-silicon-m1-macs/117123/2

Upvotes: 0

Related Questions