EBIvariation / CMAT

ClinVar Mapping and Annotation Toolkit
Apache License 2.0
18 stars 10 forks source link

Conda recipe #404

Closed apriltuesday closed 9 months ago

apriltuesday commented 10 months ago

The conda directory will be submitted (with updated checksum etc.) to bioconda-recipes, at which point CMAT would be available as usual from the bioconda channel.

If you want to test locally before it's released on bioconda, you should be able to do the following:

  1. Pull the branch and replace the source and build sections in conda/meta.yaml with:
source:
  path: ../

build:
  number: 0
  noarch: generic
  preserve_egg_dir: True
  1. Install conda if you haven't already
  2. Run the following:
    
    # Install conda-build in base environment - see https://docs.conda.io/projects/conda-build/en/stable/install-conda-build.html
    conda activate base
    conda install conda-build

Create new environment called "cmat-test" for testing locally

conda create -n cmat-test python=3.8 conda activate cmat-test

Build and install local recipe - see https://docs.conda.io/projects/conda-build/en/stable/user-guide/tutorials/build-pkgs.html#building-and-installing

cd /path/to/cmat/conda # directory containing the recipe conda build --python 3.8 . conda install --use-local cmat

4. The build will run only minimal tests as per [Bioconda guidelines](https://bioconda.github.io/contributor/guidelines.html#tests), for an end-to-end test you can do this:

mkdir testdir && cd testdir cmat annotate --output_dir . --clinvar /path/to/cmat/tests/output_generation/resources/end2end/input.xml.gz --resume

M-casado commented 10 months ago

Update on the local testing

Failed tests but successful build (?)

$ conda build --python 3.8 .
WARNING: No numpy version specified in conda_build_config.yaml.  Falling back to default numpy value of 1.22
Adding in variants from internal_defaults
Adding in variants from config.variant
Attempting to finalize metadata for cmat
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
BUILD START: ['cmat-3.0.6.dev3-py38_0.tar.bz2']
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /home/mcasado/miniconda3/conda-bld/cmat_1701707488374/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac

The following NEW packages will be INSTALLED:
...
...

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
Copying /mnt/c/Users/mcasado/Documents/GitHub/FORKED-CMAT/eva-opentargets to /home/mcasado/miniconda3/conda-bld/cmat_1701707488374/work/
source tree in: /home/mcasado/miniconda3/conda-bld/cmat_1701707488374/work
export PREFIX=/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac
export BUILD_PREFIX=/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/_build_env
export SRC_DIR=/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/work
Processing $SRC_DIR
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: cmat
  Building wheel for cmat (setup.py): started
  Building wheel for cmat (setup.py): finished with status 'done'
  Created wheel for cmat: filename=cmat-3.0.6.dev3-py3-none-any.whl size=74876 sha256=0e75ececb87ade93d76de21441af4f6febdf16a8e3fb75ba6b99442938ee2a1c
  Stored in directory: /tmp/pip-ephem-wheel-cache-p98354hu/wheels/85/5d/9e/287fe51c87339d3783955109b3d9d030cf7b1504d4c9556ce4
Successfully built cmat
Installing collected packages: cmat
Successfully installed cmat-3.0.6.dev3

Packaging cmat
Packaging cmat-3.0.6.dev3-py38_0
number of files: 77
Fixing permissions
Packaged license file/s.
INFO :: Time taken to mark (prefix)
        0 replacements in 0 files was 0.01 seconds
WARNING: Importing conda-verify failed.  Please be sure to test your packages.  conda install conda-verify to make this message go away.
TEST START: /home/mcasado/miniconda3/conda-bld/noarch/cmat-3.0.6.dev3-py38_0.tar.bz2
Adding in variants from /tmp/tmptvph2k83/info/recipe/conda_build_config.yaml
Renaming /home/mcasado/miniconda3/conda-bld/cmat_1701707488374/_build_env prefix directory '/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/_build_env' to '/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/build_prefix_moved_cmat-3.0.6.dev3-py38_0_linux-64'
shutil.move(/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/_build_env prefix)=/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/_build_env, dest=/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/build_prefix_moved_cmat-3.0.6.dev3-py38_0_linux-64)
Renaming work directory '/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/work' to '/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/work_moved_cmat-3.0.6.dev3-py38_0_noarch'
shutil.move(work)=/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/work, dest=/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/work_moved_cmat-3.0.6.dev3-py38_0_noarch)
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /home/mcasado/miniconda3/conda-bld/cmat_1701707488374/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold

The following NEW packages will be INSTALLED:
...
...

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
export PREFIX=/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold
export SRC_DIR=/home/mcasado/miniconda3/conda-bld/cmat_1701707488374/test_tmp
import: 'cmat'
import: 'cmat'
+ cmat
/usr/bin/env: ‘bash\r’: No such file or directory
WARNING: Tests failed for cmat-3.0.6.dev3-py38_0.tar.bz2 - moving package to /home/mcasado/miniconda3/conda-bld/broken
TESTS FAILED: cmat-3.0.6.dev3-py38_0.tar.bz2

Failed installation

Even when it said that the installation was successful in the previous prompt, I guess since the tests were not passed, it moved everything to the broken directory of conda, and it wasn't found when to be installed:

$ conda install --use-local cmat
Collecting package metadata (current_repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - cmat

Current channels:

  - file:///home/mcasado/miniconda3/conda-bld/linux-64
  - file:///home/mcasado/miniconda3/conda-bld/noarch
  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://conda.anaconda.org/bioconda/linux-64
  - https://conda.anaconda.org/bioconda/noarch
  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.
apriltuesday commented 9 months ago

For your installation error @M-casado, are you using WSL by chance? /usr/bin/env: ‘bash\r’ seems to indicate a problem with line endings, possibly due to how git is handling them (see first answer here). This should only be an issue with this local installation method since conda install won't use git, but you can try the suggestions in that Stack Overflow answer if you like.

@tcezard Btw, did you get it working on Mac?

Documentation. Should we include a remark on how to install it through Conda in the README? Especially if we are expecting all to use a virtual environment.

Yes definitely, I'll add it once it's been actually added to the bioconda channel, since that requires another PR and I'm not sure how long that will take...

M-casado commented 9 months ago

@apriltuesday

are you using WSL by chance? /usr/bin/env: ‘bash\r’ seems to indicate a problem with line endings

You are very right. I encounter that problem from time to time. but normally the errors are more informative. It is probably what you mentioned. I'll wait then till you publish it to test the installation through conda.