Skip to content

Cannot persuade Black Formatter to forget old anaconda-based setup. #552

@njlivesey

Description

@njlivesey

Diagnostic Data

  • Python version (& distribution if applicable, e.g., Anaconda): python 3.12 via miniforge/conda version 24.7.1
  • Type of virtual environment used (e.g., conda, venv, virtualenv, etc.): miniforge mamba
  • Operating system (and version): Local is MacOS 14.7.2. Remote is Linux (Oracle I think, 4.18.0-553.27.1.el8_10.x86_64)
  • Version of tool extension you are using: 2024.4.0

Behaviour

Expected Behavior

Black formatter to work as before (though I recall having problems making it work under anaconda)

Actual Behavior

I switched from anaconda to miniforge on my remote linux machine and the black-formatter doesn't work. When I do "Black Formatter: Restart Server" a window pops up saying:

Command 'Black Formatter: Restart Server' resulted in an error
Failed to resolve env "/users/livesey/anaconda3/envs/njl-base-3.10-18oct23/bin/python"

The above path is the outdated (and removed) anaconda environment. I've tried switching from useBundled to fromEnvironment, no impact.

I've pasted the logs from when I do the "Restart Server" below. They seem clean and error-free enough to me.

Reproduction Steps:

Logs:

2025-01-02 17:21:27.723 [info] No interpreter found from setting black-formatter.interpreter
2025-01-02 17:21:27.723 [info] Getting interpreter from ms-python.python extension for workspace /users/livesey/python/lxgp
2025-01-02 17:21:27.725 [info] Interpreter from ms-python.python extension for /users/livesey/python/lxgp: /users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/python
2025-01-02 17:21:27.725 [info] Workspace settings for /users/livesey/python/lxgp (client side): {
"cwd": "/users/livesey/python/lxgp",
"workspace": "file:///users/livesey/python/lxgp",
"args": [],
"path": [
"/users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/black"
],
"interpreter": [
"/users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/python"
],
"importStrategy": "useBundled",
"showNotifications": "off"
}
2025-01-02 17:21:27.725 [info] No interpreter found from setting black-formatter.interpreter
2025-01-02 17:21:27.725 [info] Getting interpreter from ms-python.python extension for workspace /users/livesey/a-smls/asmls-gds
2025-01-02 17:21:27.725 [info] No interpreter found from setting black-formatter.interpreter
2025-01-02 17:21:27.726 [info] Getting interpreter from ms-python.python extension for workspace /users/livesey/python/dualpy
2025-01-02 17:21:27.727 [info] No interpreter found from setting black-formatter.interpreter
2025-01-02 17:21:27.727 [info] Getting interpreter from ms-python.python extension for workspace /users/livesey/proposals/roses-uaco-2024/figures-source
2025-01-02 17:21:27.727 [info] No interpreter found from setting black-formatter.interpreter
2025-01-02 17:21:27.727 [info] Getting interpreter from ms-python.python extension for workspace /users/livesey/python/lxgp
2025-01-02 17:21:27.727 [info] No interpreter found from setting black-formatter.interpreter
2025-01-02 17:21:27.727 [info] Getting interpreter from ms-python.python extension for workspace /users/livesey/python/madart
2025-01-02 17:21:27.728 [info] No interpreter found from setting black-formatter.interpreter
2025-01-02 17:21:27.728 [info] Getting interpreter from ms-python.python extension for workspace /users/livesey/python/mls-scf-tools
2025-01-02 17:21:27.728 [info] No interpreter found from setting black-formatter.interpreter
2025-01-02 17:21:27.728 [info] Getting interpreter from ms-python.python extension for workspace /users/livesey/python/moepy
2025-01-02 17:21:27.733 [info] Interpreter from ms-python.python extension for /users/livesey/a-smls/asmls-gds: /users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/python
2025-01-02 17:21:27.733 [info] Workspace settings for /users/livesey/a-smls/asmls-gds (client side): {
"cwd": "/users/livesey/a-smls/asmls-gds",
"workspace": "file:///users/livesey/a-smls/asmls-gds",
"args": [],
"path": [
"/users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/black"
],
"interpreter": [
"/users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/python"
],
"importStrategy": "useBundled",
"showNotifications": "off"
}
2025-01-02 17:21:27.733 [info] Interpreter from ms-python.python extension for /users/livesey/proposals/roses-uaco-2024/figures-source: /users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/python
2025-01-02 17:21:27.733 [info] Workspace settings for /users/livesey/proposals/roses-uaco-2024/figures-source (client side): {
"cwd": "/users/livesey/proposals/roses-uaco-2024/figures-source",
"workspace": "file:///users/livesey/proposals/roses-uaco-2024/figures-source",
"args": [],
"path": [
"/users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/black"
],
"interpreter": [
"/users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/python"
],
"importStrategy": "useBundled",
"showNotifications": "off"
}
2025-01-02 17:21:27.733 [info] Interpreter from ms-python.python extension for /users/livesey/python/lxgp: /users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/python
2025-01-02 17:21:27.733 [info] Workspace settings for /users/livesey/python/lxgp (client side): {
"cwd": "/users/livesey/python/lxgp",
"workspace": "file:///users/livesey/python/lxgp",
"args": [],
"path": [
"/users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/black"
],
"interpreter": [
"/users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/python"
],
"importStrategy": "useBundled",
"showNotifications": "off"
}
2025-01-02 17:21:27.733 [info] Interpreter from ms-python.python extension for /users/livesey/python/madart: /users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/python
2025-01-02 17:21:27.733 [info] Workspace settings for /users/livesey/python/madart (client side): {
"cwd": "/users/livesey/python/madart",
"workspace": "file:///users/livesey/python/madart",
"args": [],
"path": [
"/users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/black"
],
"interpreter": [
"/users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/python"
],
"importStrategy": "fromEnvironment",
"showNotifications": "off"
}
2025-01-02 17:21:27.733 [info] Interpreter from ms-python.python extension for /users/livesey/python/moepy: /users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/python
2025-01-02 17:21:27.733 [info] Workspace settings for /users/livesey/python/moepy (client side): {
"cwd": "/users/livesey/python/moepy",
"workspace": "file:///users/livesey/python/moepy",
"args": [],
"path": [
"/users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/black"
],
"interpreter": [
"/users/livesey/.conda/envs/njl-base-3.12-02jan25/bin/python"
],
"importStrategy": "useBundled",
"showNotifications": "off"
}

Outcome When Attempting Debugging Steps:

When I type "black <filename.py>" on the remote machine it runs fine.

Extra Details

As I say, I recall having to do something hard-coding like when I was running anaconda. Perhaps that's got stuck in its memory. However, I can find no references to the anaconda path in any of my settings.json files. Is there somewhere else I should look?

I installed this extension after having run an older black-like extension (I forget whose). Perhaps there's something lingering from that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bugtriage-neededIssue is not triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions