Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import conda-based environment with pip (requirements.txt) dependencies #1993

Open
pierrepo opened this issue Sep 6, 2024 · 5 comments
Open
Labels
🐍 pypi Issue related to PyPI dependencies ✨ enhancement Feature request 👋 good first issue Good for newcomers

Comments

@pierrepo
Copy link

pierrepo commented Sep 6, 2024

Problem description

This feature request is related to issue #1410

Currently, it is possible to create a new Pixi environment based on a Conda YAML file:

pixi init --import environment.yml

This command works nicely if the environment contains both conda and pip dependencies, for instance:

name: test
channels:
  - conda-forge
  - nodefaults
dependencies:
  - python=3.12
  - pip
  - pandas
  - matplotlib
  - pip:
    - watermark

However, it does not work if pip dependencies are in an external file, for example:

environment.yml

name: test
channels:
  - conda-forge
  - nodefaults
dependencies:
  - python=3.12
  - pip
  - pandas
  - matplotlib
  - pip:
    - -r requirements.txt

requirements.txt

watermark
$ pixi init --import environment.yml 
  × Can't parse '-r requirements.txt' as pypi dependency
  ╰─▶ Expected package name starting with an alphanumeric character, found `-`
      -r requirements.txt
      ^

Feature request: could we please import conda YAML file with pip dependencies listed in an external file?

@pierrepo pierrepo added the ✨ enhancement Feature request label Sep 6, 2024
@tdejager
Copy link
Contributor

tdejager commented Sep 6, 2024

This seems very useful indeed, thanks for reporting!

@ruben-arts ruben-arts added 👋 good first issue Good for newcomers 🐍 pypi Issue related to PyPI dependencies labels Sep 18, 2024
@ruben-arts
Copy link
Contributor

Added good first issue.

We already have requirement parsing in the code base so it's basically just reading the file if there is a -r requirements.txt and adding the requirements to the pypi-dependencies.

@LiamConnors
Copy link
Contributor

I'd like to work on this if that's ok.

@ruben-arts
Copy link
Contributor

@LiamConnors Please go ahead!

@LiamConnors
Copy link
Contributor

@ruben-arts I started looking at this and have a draft here #2883
I wasn't 100% sure at which stage would be best to handle the dependencies within the external requirements.txt. I'd love your feedback. Is there an issue with parsing the external dependencies as if they were directly in the environment.yml file? and if so, and what stage instead do you think those external dependencies should be handled? Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐍 pypi Issue related to PyPI dependencies ✨ enhancement Feature request 👋 good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants