Unable to launch python when using conda and micromamba.
See original GitHub issueIssue Type: Bug
Behaviour
I have a case where I have a conda installation and a micromamba installation (which is another manager to manage conda installations).
The conda installation is on the PATH, whereas the micromamba is not (I use both depending on the situation).
When I set the python extension to use an environment created by the micromamba installation it’s not possible to make a launch (it seems like the environment detects that the micromamba install is a conda environment and tries to manage it with conda, which isn’t possible in this case because it’s a completely independent install).
Expected vs. Actual
When I try to make a launch with the icon in the upper-right dropdown (Run Python File
) to run the current file what I have is something as:
conda run -n <env_from_micromamba_not_usable_in_conda> --no-capture-output --live-stream python <path/to/myfile.py>
and the output is something as:
EnvironmentLocationNotFound: Not a conda environment: C:\bin\Conda\envs\<env_from_micromamba_not_usable_in_conda>
Which is expected as that environment is not a conda environment, it’s a micromamba environment, which is actually already activated manually (I start VSCode from a shell with that environment or configure the terminal properly before the launch), so, I’d like the extension to simply do:
c:\bin\micromamba\envs\<env_from_micromamba_not_usable_in_conda>\python.exe <path/to/myfile.py>
without doing anything special.
Is there any setting I could toggle to workaround this? I don’t really need the extension to try to do anything smart (I can manage the environments manually just fine…).
Steps to reproduce:
- Install conda as usual
- Get miniconda and create an environment in miniconda (don’t put it in the path).
- Set the python from a miniconda environment as the default python interpreter
- Try to launch a file
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.7.5
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda/micromamba
- Value of the
python.languageServer
setting: Pylance
User Settings
defaultLS: {"defaultLSType":"Pylance"}
downloadLanguageServer: true
envFile: "<placeholder>"
venvPath: "<placeholder>"
venvFolders: "<placeholder>"
condaPath: "<placeholder>"
pipenvPath: "<placeholder>"
poetryPath: "<placeholder>"
languageServer: "Pylance"
linting
• enabled: true
• cwd: "<placeholder>"
• Flake8Args: "<placeholder>"
• flake8Enabled: false
• flake8Path: "<placeholder>"
• lintOnSave: true
• banditArgs: "<placeholder>"
• banditEnabled: false
• banditPath: "<placeholder>"
• mypyArgs: "<placeholder>"
• mypyEnabled: false
• mypyPath: "<placeholder>"
• pycodestyleArgs: "<placeholder>"
• pycodestyleEnabled: false
• pycodestylePath: "<placeholder>"
• prospectorArgs: "<placeholder>"
• prospectorEnabled: false
• prospectorPath: "<placeholder>"
• pydocstyleArgs: "<placeholder>"
• pydocstyleEnabled: false
• pydocstylePath: "<placeholder>"
• pylamaArgs: "<placeholder>"
• pylamaEnabled: false
• pylamaPath: "<placeholder>"
• pylintArgs: "<placeholder>"
• pylintPath: "<placeholder>"
sortImports
• args: "<placeholder>"
• path: "<placeholder>"
formatting
• autopep8Args: "<placeholder>"
• autopep8Path: "<placeholder>"
• provider: "autopep8"
• blackArgs: "<placeholder>"
• blackPath: "<placeholder>"
• yapfArgs: "<placeholder>"
• yapfPath: "<placeholder>"
testing
• cwd: "<placeholder>"
• debugPort: 3000
• nosetestArgs: "<placeholder>"
• nosetestsEnabled: undefined
• nosetestPath: "<placeholder>"
• promptToConfigure: false
• pytestArgs: "<placeholder>"
• pytestEnabled: false
• pytestPath: "<placeholder>"
• unittestArgs: "<placeholder>"
• unittestEnabled: false
• autoTestDiscoverOnSaveEnabled: true
terminal
• activateEnvironment: true
• executeInFileDir: "<placeholder>"
• launchArgs: "<placeholder>"
experiments
• enabled: true
• optInto: ["pythonDeprecatePythonPath"]
• optOutFrom: []
insidersChannel: "off"
tensorBoard
• logDirectory: "<placeholder>"
Extension version: 2022.2.1924087327 VS Code version: Code 1.65.2 (c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1, 2022-03-10T14:33:55.248Z) OS version: Windows_NT x64 10.0.19044 Restricted Mode: No
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i7-8750H CPU @ 2.20GHz (12 x 2208) |
GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
Load (avg) | undefined |
Memory (System) | 31.75GB (16.08GB free) |
Process Argv | –crash-reporter-id 20e2463c-382b-4460-97c8-fa433dc19d7a |
Screen Reader | no |
VM | 0% |
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
pythonvspyl392:30443607
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vsclayoutctrt:30451275
dsvsc009:30452663
pythonvsnew555:30457759
vscscmwlcmc:30438804
vscaat:30438848
pynewfile477:30450038
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top GitHub Comments
Thank you for the prompt fix!
I don’t think there’s anything different. From what I know
mamba
itself could even be used to install additional packages on top of aconda
environment (and if the mamba environment was inside of a CONDA_PREFIX managed by conda, conda could activate it properly).I personally like to keep them separated (I’m more and more using micromamba due to its speed), but I don’t think this would be always required.
Closing as the original issue was fixed.
Can you please open another issue for this with details, that way we can direct it to the right person.