question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to launch python when using conda and micromamba.

See original GitHub issue

Issue 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:

  1. Install conda as usual
  2. Get miniconda and create an environment in miniconda (don’t put it in the path).
  3. Set the python from a miniconda environment as the default python interpreter
  4. 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:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
fabiozcommented, Mar 31, 2022

This issue should be fixed in the latest version of the extension.

Thank you for the prompt fix!

Btw, can you help with how to differentiate a micromamba environment from a normal conda environment by looking at the environment? Is conda-meta/history file any different?

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 a conda 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.

0reactions
karrtikrcommented, Apr 6, 2022

Closing as the original issue was fixed.

When I open any terminal, it’s also trying to auto-activate the terminal to that unrelated environment (which fails), so, it’d be nice if that’s also not done in this case…

Can you please open another issue for this with details, that way we can direct it to the right person.

Read more comments on GitHub >

github_iconTop Results From Across the Web

micromamba: package ___ requires python >=3.8,<3.9.0a0 ...
I am using mambaorg/micromamba:0.8.2 docker image and run my CI on ... that: RUN micromamba install -y -n base python=3.7 -c conda-forge COPY...
Read more >
Micromamba - Mamba's documentation!
micromamba is a small, pure-C++ executable with enough functionalities to bootstrap fully functional conda-environments. Still at early stage, it's main usage ...
Read more >
Standalone Python Conda envs without installing Conda ...
We will make an isolated directory to run a simple numpy benchmark with an env created with micromamba. Create a directory using a...
Read more >
conda-pack 0.7.0 documentation - GitHub Pages
Packaging a conda environment for use with Apache Spark when deploying on YARN ... Run python from in the environment (my_env) $ python...
Read more >
Python - NixOS Wiki
To install, say Python 3 with pandas and requests , define a new package ... so you can't use pip to install packages...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found