Closed gredin closed 9 months ago
How did you set up that env?
This happens for my base env and any empty env created by micromamba create -n
.
Usually (not sure it's always true), an additional micromamba install X
adds a specific Python dependency and a ~/micromamba/envs/env-test/bin/python
symlink.
Hm, I can't reproduce this
$ micromamba -p /tmp/test create python -y
...
$ file /tmp/test/bin/python
/tmp/test/bin/python: Mach-O 64-bit executable arm64
Here's a Docker-based reproducible example.
Run docker build . -t micromamba-python-test
against this Dockerfile:
FROM ubuntu:23.10
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update \
&& apt -y install python3 curl
RUN bash -c '"${SHELL}" <(curl -L micro.mamba.pm/install.sh)'
RUN bash -c ". /root/.bashrc"
Then run it:
$ docker run --rm -it micromamba-python-test bash
root@container:/# micromamba create -n python-test
Empty environment created at prefix: /root/micromamba/envs/python-test
root@container:/# micromamba activate python-test
(python-test) root@container:/# python
bash: python: command not found
(python-test) root@container:/# python3
Python 3.11.6 (main, Oct 8 2023, 05:06:43) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
You didn't install Python into the env
My env:
PyCharm failed to load a micromamba env, so I logged commands sent by PyCharm to your conda executable. I saw this one:
conda run -p /home/myuser/micromamba/envs/myenv --no-capture-output python -c 'import sys; print(sys.executable)'
The problem is that
python
is unavailable (only python3 exists) in the environment.I've fixed this with:
sys.argv = ["python3" if arg == "python" else arg for arg in sys.argv]
but there might be a cleaner and universal way.Thanks for your work anyway, it's great.