Repository navigation
Add support for micromamba environments #20919
Copy link
Copy link
Closed
Labels
area-environmentsFeatures relating to handling interpreter environmentsFeatures relating to handling interpreter environmentscommunity askFeature request that the community expressed interest inFeature request that the community expressed interest infeature-requestRequest for new features or functionalityRequest for new features or functionality
Description
Type: Bug
Behaviour
Expected vs. Actual
I expect the python: conda path setting to be used everywhere conda is called.
As can be seen from the logs, a plain conda call is used many times, and something tries to find python installations under ~\Miniconda3\..., which does not exist.
This results in that no environments are found, and pylance cannot find locally installed packages.
Steps to reproduce:
- Uninstall conda if you have it.
- Install micromamba
- Set the conda path to point to micromamba
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.11.0
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
- Value of the
python.languageServersetting: Pylance
Output for Python in the Output panel
User Settings
condaPath: "C:\Users\carl4189\micromamba\condabin\micromamba.bat"
languageServer: "Pylance"
linting
• flake8Args: "<placeholder>"
• flake8Enabled: true
• pycodestyleArgs: "<placeholder>"
• pycodestyleEnabled: true
• pydocstyleEnabled: true
terminal
• activateEnvironment: false
Extension version: 2023.5.10791008
VS Code version: Code 1.76.2 (ee2b180d582a7f601fa6ecfdad8d9fd269ab1884, 2023-03-14T17:55:54.936Z)
OS version: Windows_NT x64 10.0.19044
Modes:
Sandboxed: No
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz (8 x 2112) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 15.78GB (6.73GB free) |
| Process Argv | |
| Screen Reader | no |
| VM | 0% |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-environmentsFeatures relating to handling interpreter environmentsFeatures relating to handling interpreter environmentscommunity askFeature request that the community expressed interest inFeature request that the community expressed interest infeature-requestRequest for new features or functionalityRequest for new features or functionality
Activity
karrtikr commentedon Mar 27, 2023
Thanks for the bug report! We just wanted to quickly acknowledge we received it and we will triage this as soon as we can.
psobolewskiPhD commentedon Apr 5, 2023
Would love to see this work. Mamba works, because conda is still present. But micromamba doesn't have a base env with conda.
[-]Using micromamba instead of conda[/-][+]Improve micromamba support[/+]karrtikr commentedon May 8, 2023
Turning this into a feature request as we currently don't support micromamba, to resolve this we need to support identifying micromamba version correctly.
Currently if version is below
4.7, we do not useconda/micromamba run, so environment is not activated before it is used leading to import errors.github-actions commentedon May 8, 2023
Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.
[-]Improve micromamba support[/-][+]Improve micromamba support by allowing use of micromamba run where applicable[/+]CarlAndersson commentedon May 11, 2023
micromamba runexists at least in micromamba version 1.0.0. The changelog indicates that is has existed since version 0.21.0.The output from
conda info --jsonandmicromamba info --jsonmight be a good place to find out if the command iscondaormircomambawithout resorting to inspecting the command name. E.g.,conda info --jsonhas a'conda_version', whilemicromamba info --jsonhas a'micromamba version'.Let me know if there's anything more I can do to assist!
brettcannon commentedon May 25, 2023
Thank you to everyone who upvoted this issue! Since the community showed interest in this feature request we will leave this issue open as something to consider implementing at some point in the future.
We do encourage people to continue 👍 the first/opening comment as it helps us prioritize our work based on what the community seems to want the most.
22 remaining items
stessaris commentedon Feb 9, 2024
On unix based systems I'm using direnv with this direnv vscode extension. It has the advantage that works with any backend, e.g.
nix, or more complex setups; e.g., in some projects I layer acondaenvironment on top of anix shell. I guess that it should work with Windows as well, but I never tried it.To use
micromambayou could modify the defaultanacondalayout by changing the command"$conda" shell.bash activate "$env_loc"to"${MAMBA}" shell activate -s bash -p "${env_loc}"in theevalcommand.In alternative, you can use your own shell script. E.g. I use something like this (it'd be better refactored into a function, though):
specter119 commentedon Apr 28, 2024
Kartik Raj (@kartikrajjj) any update now?
Misaka-No-10032 commentedon May 2, 2024
I figured it out in this way:
activatein the same folder as your micromamba executable.python.condaPath, set the value to the path of your micromamba executable.python.venvPathto<YOUR MAMBA_ROOT_PREFIX>/envs/With these steps, VS Code should be able to identify and activate micromamba environments.
Note that
micromamba runwon't work with the Python extension because the extension checks the availability ofconda runbased on the conda version (conda info). Since our micromamba executable replaces conda,micromamba inforeturns the version 1.5.8. As a result, conda <= 4.12.x does not supportconda run. Therefore, the extension assumes thatconda runis not available.suimong commentedon May 31, 2024
Here's my workaround: https://github.com/suimong/micromamba-vscode-compat
Looking at the source code, I believe the key incompability between
micromambaandcondathat this extension cares about is the output fromconda info --json. the keys of the output json frommicromamba info --jsonis completely different fromconda info --json, therefore it is impossible forvscode-pythonto extract any information from that json output. The solution is a making a shell script as the micromamba wrapper, which modifies the keys ofmicromamba info --jsonbefore sending to stdout.After this pr lands, micromamba will be able to output conda compatible
info --jsonand vscode should be trivially able to support micromamba.Misaka-No-10032 commentedon Jun 2, 2024
You are right. I found a similar solution at https://github.com/jonashaag/micromamba-pycharm, but this one is implemented in Python.
specter119 commentedon Jun 11, 2024
Karthik Nadig (@karthiknadig) can add somebody follow this issue?
the behavior of micromamba is quite similar with conda currently.
brettcannon commentedon Jun 12, 2024
We actively rewriting our discovery code (driven by Don Jayamanne (@DonJayamanne) ) as well as working towards an API to make so people can create an e.g. micromamba extension that feeds interpreter info to the extension (being driven by Karthik Nadig (@karthiknadig) ). There's no ETA on any of this, but do know that micromamba support will be possible at some point.
liushapku commentedon Aug 22, 2024
I confirmed this method works with the following change to the
activatefile:etc/profile.d/micromamba.shever existed..should not be escaped to representsourceactivateshould be put in the same dir as the executable. (Maybe It is also recommended to adddeactivate)${SHELL}is usually the full path like/usr/bin/bash, but micromamba only acceptsbash.YouJiacheng commentedon Sep 7, 2024
Hey guys! I think we can just switch from
micromambatopixi.I think
pixiis a bettermicromamba, and it has been supported byvscode-pythonsince 9 Jul 2024!https://github.com/microsoft/vscode-python/releases/tag/v2024.10.0
#22968
Why
pixi: https://prefix.dev/blog/pixi_a_fast_conda_alternativebaseEnvironment Needed!Transitioning Guide: https://pixi.sh/latest/switching_from/conda/
rkimura47 commentedon Oct 8, 2024
I figured out a version of Misaka-No-10032 and liushapku's method that worked for me on Windows using PowerShell as the default terminal. I haven't tested it extensively and the setup can probably be improved, but hopefully it can at least serve as a starting point. (Note: this requires PowerShell to be initialized with the hook installed by
mamba shell initin your profile.)micromamba.exeexecutable file into theScriptsdirectory of your mamba root prefix, and rename it toconda.exe.#region mamba initialize), modify theMAMBA_EXEenvironment variable to point to the path of the copied overconda.exeexecutable.python.condaPathto the path of the copied overconda.exeexecutable.python.venvPathto<YOUR MAMBA_ROOT_PREFIX>/envs/.symzn commentedon Oct 10, 2025
Hello,
I've developed a simple extension using the vscode-python-envs API that allows VS Code to discover and use your micromamba environments.
This is my first time coding in TypeScript, so any feedback is welcome. It's tested on Windows but should work on Linux as well.
You can find it on the Marketplace here:
https://marketplace.visualstudio.com/items?itemName=symzn.vscode-micromamba-env
https://github.com/symzn/vscode-micromamba-env
Note: I am still using the micromamba 1.5.10. But as the extension only relies on MAMBA_ROOT_PREFIX env var value & ~/.conda/environments.txt, I assume that it shall work with newer version of micromamba
symzn commentedon Dec 5, 2025
Hello,
I wanted to follow up on my previous message.
I apologize, but the extension I mentioned earlier (based on the ms-python-envs API) does not work properly yet.
There are still pending issues with the Environment Provider API that need to be resolved before it can be fully operational.
Since fixing these API issues might take some time, I decided to take a different, more straightforward approach.
I have developed a new extension:
Instead of relying on the Provider API, this new version works autonomously by:
environments.txt..envfile and updatingpython.defaultInterpreterPathworkspace settings for smooth integration.It is much more stable and is available now if anyone needs a temporary solution while waiting for the native API to mature.
Note: I haven't had time to test it on Linux yet (I will do so ASAP), but I am quite confident that it will work or require very small adaptations.
Update: minor fix since this message : extension works also on Linux (with bash)
eleanorjboyd commentedon Dec 8, 2025
Hello everyone! We are now moving to the cool, new Python Environments Extension for all things environments! From here anyone can create an extension to handle different environments like micromamba! Feel free to reach out via this repo if you want to contribute support! https://github.com/microsoft/vscode-python-environments