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

fix(conda): add support pip deps for environment.yml files #6675

Merged
merged 3 commits into from
May 13, 2024

Conversation

DmitriyLewen
Copy link
Contributor

Description

Conda supports installing dependencies using pip - https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#using-pip-in-an-environment
In these cases - dependency is map.
e.g.:

name: test-environment
dependencies:
  - python==3.10.*
  - pip==23.2.*
  - scikit-learn==1.3.*
  - pip:
    - pandas==2.1.*

Add maps parsing from Dependencies.

Related issues

Related PRs

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@DmitriyLewen DmitriyLewen self-assigned this May 13, 2024
// e.g. dependencies:
// - pip:
// - pandas==2.1.4
if node.Content[1].Tag == "!!seq" { // Conda supports only map[string][]string format.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(myenv) root@ccc79e13e62e:/app# cat environment.yml 
name: myenv2
channels:
  - defaults
dependencies:
  - wheel=0.43.0=py312hd43f75c_0
  - xz=5.4.6=h998d150_1
  - pip: asgiref==3.8.1
prefix: /opt/conda/envs/myenv

(myenv) root@ccc79e13e62e:/app# conda env create -f environment.yml
...

Pip subprocess error:
ERROR: Invalid requirement: '=' (from line 8 of /app/condaenv.c8eq_o_y.requirements.txt)
Hint: = is not a valid operator. Did you mean == ?

failed

CondaEnvException: Pip failed

@DmitriyLewen DmitriyLewen marked this pull request as ready for review May 13, 2024 07:36
@DmitriyLewen DmitriyLewen requested a review from knqyf263 as a code owner May 13, 2024 07:36
@knqyf263 knqyf263 added this pull request to the merge queue May 13, 2024
Merged via the queue into aquasecurity:main with commit 150a773 May 13, 2024
12 checks passed
@DmitriyLewen DmitriyLewen deleted the fix-conda/dep-as-map branch August 2, 2024 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(conda): pip dependencies are not supported in new Conda integration
2 participants