conda-lock icon indicating copy to clipboard operation
conda-lock copied to clipboard

when using a pyproject.toml why isn't the package installed

Open leeleavitt opened this issue 2 years ago • 2 comments

I'm using a pyproject.toml to install my package and its requirements. I am also using the pyproject.toml with the specification for conda-lock.

When I specify the conda-lock.yml, which was made using the pyproject.toml it doesn't install the package that the pyproject.toml also describes. Instead I need to follow the workflow below. Am i missing a feature?

conda-lock install --name my_wacky_env mrd/conda-lock.yml
conda activate my_wacky_env
pip install -e mrd/

The mrd directory contains the pyproject.toml and is a python package.

I would expect that using the pyproject.toml which is used for both conda-lock as well as my package installation via pip, would install my package into the conda environment created from conda-lock

leeleavitt avatar Jan 04 '23 21:01 leeleavitt

Nope, thats not really how it works.

The pyproject support is mostly used for a convenience to allow creating dev / test environments for a python project.

For your use case you can use conda-lock to get a consistent environment created and just pip install --no-deps . your library after creating the env (which should not change any of the other dependencies you have installed.

mariusvniekerk avatar Jan 04 '23 21:01 mariusvniekerk

Another option i explored was to specify the path to the python package. This works for a traditional environment.yaml

name: devernator
channels:
  - conda-forge
  - bioconda
dependencies:
  - python=3.10
  - pip
  - poetry
  - pybedlite
  - pip:
    - ./

In that root directory i have my pyproject.toml which contains my dependencies listed out for poetry.

I have success when using conda env create --file environmnet.yaml, but i receive an error message when i use conda-lock,

pkg_resources.RequirementParseError: Invalid requirement, parse error at "'./'"

Am I missing anything here in my approach?

leeleavitt avatar Jan 05 '23 17:01 leeleavitt