Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nameless conda environment gets run by name instead of path #24627

Open
karthiknadig opened this issue Dec 17, 2024 · 4 comments
Open

Nameless conda environment gets run by name instead of path #24627

karthiknadig opened this issue Dec 17, 2024 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team

Comments

@karthiknadig
Copy link
Member

Discussed in #24626

Originally posted by gandhis1 December 17, 2024
In version 2024.16.1, when I run test discovery, or really any command that ultimately invokes conda, I see the following:

2024-12-17 10:09:14.508 [info] > conda run -p ./envs/linux_main --no-capture-output python ~/.vscode-server/extensions/ms-python.python-2024.16.1-linux-x64/python_files/get_output_via_markers.py -m pytest -p vscode_pytest --collect-only .

This works, and this is what I expect, since my environments are nameless and path-based. Here is the anonymized output of conda info --env:

                         /home/myuser/git/myrepo/envs/linux_arctic
                         /home/myuser/git/myrepo/envs/linux_main
base                  *  /opt/miniconda3

In recent versions (this has been ongoing for several weeks I believe), I see this (2024.23.2024121701):

2024-12-17 10:32:03.637 [info] > ~/git/myrepo2/envs/linux_py38/bin/conda run -n linux_main --no-capture-output python ~/.vscode-server/extensions/ms-python.python-2024.23.2024121701-linux-x64/python_files/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2024.23.2024121701-linux-x64/python_files/printEnvVariables.py
2024-12-17 10:32:03.637 [info] shell: bash
2024-12-17 10:32:04.012 [error] getActivatedEnvironmentVariables Error: Command failed: /home/myuser/git/myrepo/envs/linux_py38/bin/conda run -n linux_main --no-capture-output python /home/myuser/.vscode-server/extensions/ms-python.python-2024.23.2024121701-linux-x64/python_files/get_output_via_markers.py /home/myuser/.vscode-server/extensions/ms-python.python-2024.23.2024121701-linux-x64/python_files/printEnvVariables.py

EnvironmentLocationNotFound: Not a conda environment: /home/myuser/git/myrepo/envs/239fb791f5e1df62ec6015e65582c32020a01c5d/envs/linux_main


    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:530:35)
    at maybeClose (node:internal/child_process:1104:16)
    at Socket.<anonymous> (node:internal/child_process:456:11)
    at Socket.emit (node:events:518:28)
    at Pipe.<anonymous> (node:net:343:12) {
  code: 1,
  killed: false,
  signal: null,
  cmd: '/home/myuser/git/myrepo2/envs/linux_py38/bin/conda run -n linux_main --no-capture-output python /home/myuser/.vscode-server/extensions/ms-python.python-2024.23.2024121701-linux-x64/python_files/get_output_via_markers.py /home/myuser/.vscode-server/extensions/ms-python.python-2024.23.2024121701-linux-x64/python_files/printEnvVariables.py'
}

Fundamentally, the issue I see is that this should be using -p and not -n. It's also using a somewhat arbitrary conda executable.

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Dec 17, 2024
@karthiknadig
Copy link
Member Author

karthiknadig commented Dec 17, 2024

@gandhis1 Can you provide the initial part of the logs:
Image

The logs that you shared here don't contain a line that says " Conda env is named/prefix". it comes from the detector.
#24626 (reply in thread)

@gandhis1
Copy link

gandhis1 commented Dec 17, 2024

Here is everything before "discover tests":

2024-12-17 11:38:46.030 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-12-17 11:38:46.030 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-12-17 11:38:46.030 [info] Experiment 'pythonTestAdapter' is active
2024-12-17 11:38:46.030 [info] Native locator: Refresh started
2024-12-17 11:38:47.511 [info] > pyenv which python
2024-12-17 11:38:47.511 [info] cwd: .
2024-12-17 11:38:47.534 [info] Conda environment manager found at: /opt/miniconda3/bin/conda
2024-12-17 11:38:47.550 [info] Conda environment manager found at: /home/myuser/git/myrepo2/envs/linux_py311/bin/conda
2024-12-17 11:38:47.555 [info] Conda environment manager found at: /home/myuser/git/myrepo2/envs/linux_py38/bin/conda
2024-12-17 11:38:47.562 [info] Native locator: Refresh finished in 1862 ms
2024-12-17 11:38:48.168 [info] > ~/git/myrepo2/envs/linux_py38/bin/conda info --json
2024-12-17 11:38:50.380 [info] Python interpreter path: ./envs/linux_main/bin/python

I don't see a line saying "Conda env is named"

@karthiknadig karthiknadig self-assigned this Dec 17, 2024
@karthiknadig karthiknadig added the bug Issue identified by VS Code Team member as probable bug label Dec 17, 2024
@karthiknadig
Copy link
Member Author

Can you ~/git/myrepo2/envs/linux_py38/bin/conda info --json ? That seems like your in project conda binary, as opposed to running conda info --json that uses your global conda binary.

@gandhis1
Copy link

gandhis1 commented Dec 17, 2024

Here is the output of that. As a clarification, note that linux_py38, linux_main, etc. are symbolic links to an environment using a hash as the name.

{
  "GID": 1339600513,
  "UID": 1339615977,
  "active_prefix": "/home/myuser/git/myrepo/envs/linux_main",
  "active_prefix_name": "/home/myuser/git/myrepo/envs/linux_main",
  "av_data_dir": "/home/myuser/git/myrepo2/envs/239fb791f5e1df62ec6015e65582c32020a01c5d/etc/conda",
  "av_metadata_url_base": null,
  "channels": [
    "https://repo.anaconda.com/pkgs/main/linux-64",
    "https://repo.anaconda.com/pkgs/main/noarch",
    "https://repo.anaconda.com/pkgs/r/linux-64",
    "https://repo.anaconda.com/pkgs/r/noarch"
  ],
  "conda_build_version": "24.5.0",
  "conda_env_version": "24.7.1",
  "conda_location": "/home/myuser/git/myrepo2/envs/239fb791f5e1df62ec6015e65582c32020a01c5d/lib/python3.8/site-packages/conda",
  "conda_prefix": "/home/myuser/git/myrepo2/envs/239fb791f5e1df62ec6015e65582c32020a01c5d",
  "conda_shlvl": 2,
  "conda_version": "24.7.1",
  "config_files": [],
  "default_prefix": "/home/myuser/git/myrepo/envs/linux_main",
  "env_vars": {
    "CIO_TEST": "<not set>",
    "CONDA_ALLOW_SOFTLINKS": "false",
    "CONDA_DEFAULT_ENV": "linux_main",
    "CONDA_EXE": "/opt/miniconda3/bin/conda",
    "CONDA_PREFIX": "/home/myuser/git/myrepo/envs/linux_main",
    "CONDA_PREFIX_1": "/opt/miniconda3",
    "CONDA_PREFIX_2": "/home/myuser/git/myrepo/envs/linux_main",
    "CONDA_PROMPT_MODIFIER": "(linux_main) ",
    "CONDA_PYTHON_EXE": "/opt/miniconda3/bin/python",
    "CONDA_ROOT": "/opt/miniconda3",
    "CONDA_SHLVL": "2",
    "CURL_CA_BUNDLE": "<not set>",
    "JAVA_LD_LIBRARY_PATH": "/home/myuser/git/myrepo/envs/linux_main/lib/jvm/lib/server",
    "LD_PRELOAD": "<not set>",
    "PATH": "/home/myuser/.vscode-server/cli/servers/Stable-138f619c86f1199955d53b4166bef66ef252935c/server/bin/remote-cli:/opt/miniconda3/condabin:/home/myuser/git/myrepo/envs/linux_main/bin:/opt/miniconda3/condabin:/home/myuser/.local/bin:/home/myuser/bin:/opt/miniconda3/condabin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/myuser/micromamba:/opt/miniconda3/condabin:/home/myuser/.vscode-server/cli/servers/Stable-138f619c86f1199955d53b4166bef66ef252935c/server/bin/remote-cli:/opt/miniconda3/condabin:/opt/miniconda3/bin:/opt/miniconda3/condabin:/home/myuser/.local/bin:/home/myuser/bin:/opt/miniconda3/condabin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/myuser/micromamba:/home/myuser/.vscode-server/cli/servers/Stable-138f619c86f1199955d53b4166bef66ef252935c/server/bin/remote-cli:/opt/miniconda3/bin:/opt/miniconda3/condabin:/home/myuser/.local/bin:/home/myuser/bin:/opt/miniconda3/condabin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/myuser/micromamba",
    "REQUESTS_CA_BUNDLE": "<not set>",
    "SE_MANAGER_PATH": "/home/myuser/git/myrepo/envs/linux_main/bin/selenium-manager",
    "SSL_CERT_FILE": "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem"
  },
  "envs": [
    "/home/myuser/git/myrepo2/envs/239fb791f5e1df62ec6015e65582c32020a01c5d",
    "/home/myuser/git/myrepo2/envs/linux_py311",
    "/home/myuser/git/myrepo2/envs/linux_py38",
    "/home/myuser/git/myrepo-systematic/envs/linux_arctic",
    "/home/myuser/git/myrepo/envs/linux_arctic",
    "/home/myuser/git/myrepo/envs/linux_main"
  ],
  "envs_dirs": [
    "/home/myuser/git/myrepo2/envs/239fb791f5e1df62ec6015e65582c32020a01c5d/envs",
    "/home/myuser/.conda/envs"
  ],
  "netrc_file": null,
  "offline": false,
  "pkgs_dirs": [
    "/home/myuser/git/myrepo2/envs/239fb791f5e1df62ec6015e65582c32020a01c5d/pkgs",
    "/home/myuser/.conda/pkgs"
  ],
  "platform": "linux-64",
  "python_version": "3.8.20.final.0",
  "rc_path": "/home/myuser/.condarc",
  "requests_version": "2.32.3",
  "root_prefix": "/home/myuser/git/myrepo2/envs/239fb791f5e1df62ec6015e65582c32020a01c5d",
  "root_writable": true,
  "site_dirs": [],
  "solver": {
    "default": true,
    "name": "libmamba",
    "user_agent": "solver/libmamba conda-libmamba-solver/24.9.0 libmambapy/1.5.8"
  },
  "sys.executable": "/home/myuser/git/myrepo2/envs/239fb791f5e1df62ec6015e65582c32020a01c5d/bin/python",
  "sys.prefix": "/home/myuser/git/myrepo2/envs/239fb791f5e1df62ec6015e65582c32020a01c5d",
  "sys.version": "3.8.20 | packaged by conda-forge | (default, Sep 30 2024, 17:52:49) \n[GCC 13.3.0]",
  "sys_rc_path": "/home/myuser/git/myrepo2/envs/239fb791f5e1df62ec6015e65582c32020a01c5d/.condarc",
  "user_agent": "conda/24.7.1 requests/2.32.3 CPython/3.8.20 Linux/5.14.0-362.24.1.el9_3.x86_64 rhel/9.3 glibc/2.34 solver/libmamba conda-libmamba-solver/24.9.0 libmambapy/1.5.8",
  "user_rc_path": "/home/myuser/.condarc",
  "virtual_pkgs": [
    [
      "__archspec",
      "1",
      "cascadelake"
    ],
    [
      "__conda",
      "24.7.1",
      "0"
    ],
    [
      "__glibc",
      "2.34",
      "0"
    ],
    [
      "__linux",
      "5.14.0",
      "0"
    ],
    [
      "__unix",
      "0",
      "0"
    ]
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants