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

Allow pip installation of packages into base #28

Open
skwde opened this issue Dec 12, 2024 · 2 comments
Open

Allow pip installation of packages into base #28

skwde opened this issue Dec 12, 2024 · 2 comments

Comments

@skwde
Copy link

skwde commented Dec 12, 2024

Consider following environment file:

---
name: base
channels:
  - conda-forge
  - nodefaults
dependencies:
  - python
  - pip>=10.0
  - pip:
      - pymarkdownlnt

To my understanding installing this base environment is not possible by just using the feature.

A postCreateCommand has to be used.

Related: #14

@maresb
Copy link
Collaborator

maresb commented Dec 12, 2024

Hi @skwde! It's been a while since I've touched this repo, so my memory is not so great here.

If I'm remembering correctly, the issue is the following error:

$ docker run --rm -it mambaorg/micromamba
(base) mambauser@da4ec6b19c03:/tmp$ cat >> environment.yaml
name: base
channels:
  - conda-forge
  - nodefaults
dependencies:
  - python
  - pip>=10.0
  - pip:
      - pymarkdownlnt
(base) mambauser@da4ec6b19c03:/tmp$ micromamba create -n base -f environment.yaml 
error    libmamba Overwriting root prefix is not permitted
critical libmamba Aborting.

(Note: I used Ctrl+D to gracefully exit from the cat command after pasting.)

If I run micromamba create -n not-base -f environment.yaml then it succeeds. Conversely, if I run micromamba install -n not~base -f environment.yaml without creating it, then I get:

error    libmamba No prefix found at: /opt/conda/envs/not~base
error    libmamba Environment must first be created with "micromamba create -n {env_name} ..."
critical libmamba Aborting.

Rather than tackling this here, I wonder if it would make more sense to request adding a --create-if-not-exists flag upstream to micromamba install since otherwise this seems like an awful chunk of logic to implement.,

@skwde, would you be interested in tackling this?

@skwde
Copy link
Author

skwde commented Dec 13, 2024

@maresb thanks for you reply.

I created the corresponding issue in the mamba repo: mamba-org/mamba#3689

For now I have a workaround, i.e. I simply do the required installation in a postCreateCommand.

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

No branches or pull requests

2 participants