Pytest fails to use the correct conda environment path for testing
See original GitHub issueIssue Type: Bug
Pytest discover tests
I get error: EnvironmentLocationNotFound: Not a conda environment: C:\Conda\envs\swp10\envs\swp10 because the true path is just; C:\Conda\envs\swp10\
Experiment 'pythonaa' is active
Experiment 'pythonTensorboardExperiment' is active
Experiment 'PythonPyTorchProfiler' is active
Experiment 'pythonDeprecatePythonPath' is active
Experiment 'pythonInterpreterInfoPinned' is active
> conda info --json
> C:\Conda\envs\swp10\python.exe ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\interpreterInfo.py
> C:\Conda\python.exe ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\interpreterInfo.py
Python interpreter path: C:\Conda\envs\swp10\python.exe
> conda run -n swp10 --no-capture-output python ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.5.11221002/pythonFiles/printEnvVariables.py
> C:\Conda\envs\flights\python.exe ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\interpreterInfo.py
> C:\Conda\envs\handson\python.exe ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\interpreterInfo.py
> C:\Conda\envs\refining\python.exe ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\interpreterInfo.py
Starting Pylance language server.
> conda run -n swp10 --no-capture-output python ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.5.11221002/pythonFiles/printEnvVariables.py
> conda run -n swp10 --no-capture-output python ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2022.5.11221002\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear tests
cwd: .
[ERROR 2022-4-5 14:48:49.500]: Error discovering pytest tests:
[n [Error]:
EnvironmentLocationNotFound: Not a conda environment: C:\Conda\envs\swp10\envs\swp10
at ChildProcess.<anonymous> (c:\Users\Varo-local_User\.vscode\extensions\ms-python.python-2022.5.11221002\out\client\extension.js:2:228554)
at Object.onceWrapper (node:events:510:26)
at ChildProcess.emit (node:events:390:28)
at maybeClose (node:internal/child_process:1064:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)]
Steps to reproduce:
- Download this repo
- Open the test tab on VSCode
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.10.4
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
- Value of the
python.languageServer
setting: Pylance
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
β’ pylamaEnabled: false
formatting
β’ provider: βyapfβ
testing β’ cwd: β<placeholder>β β’ debugPort: 3000 β’ nosetestArgs: β<placeholder>β β’ nosetestsEnabled: undefined β’ nosetestPath: β<placeholder>β β’ promptToConfigure: true β’ pytestArgs: β<placeholder>β β’ pytestEnabled: true β’ pytestPath: β<placeholder>β β’ unittestArgs: β<placeholder>β β’ unittestEnabled: false β’ autoTestDiscoverOnSaveEnabled: true
terminal β’ activateEnvironment: true
experiments β’ enabled: true β’ optInto: [] β’ optOutFrom: []
</p>
</details>
Extension version: 2022.5.11221002
VS Code version: Code 1.66.2 (dfd34e8260c270da74b5c2d86d61aee4b6d56977, 2022-04-11T07:46:01.075Z)
OS version: Windows_NT x64 10.0.17763
Restricted Mode: No
<details>
<summary>System Info</summary>
|Item|Value|
|---|---|
|CPUs|Intel(R) Xeon(R) CPU E5-2697A v4 @ 2.60GHz (8 x 2600)|
|GPU Status|2d_canvas: unavailable_software<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: disabled_software<br>multiple_raster_threads: enabled_on<br>oop_rasterization: disabled_off<br>opengl: disabled_off<br>rasterization: disabled_software<br>raw_draw: disabled_off_ok<br>skia_renderer: enabled_on<br>video_decode: disabled_software<br>video_encode: disabled_software<br>vulkan: disabled_off<br>webgl: unavailable_software<br>webgl2: unavailable_software|
|Load (avg)|undefined|
|Memory (System)|64.00GB (48.15GB free)|
|Process Argv|D:\\DV\\VAROModule --crash-reporter-id 4258b87b-5f84-49f0-94bb-91ba84a55f17|
|Screen Reader|no|
|VM|100%|
</details><details>
<summary>A/B Experiments</summary>
vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythonvspyl392:30443607 pythontb:30283811 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 pythondataviewer:30285071 vscod805cf:30301675 pythonvspyt200:30340761 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 vsc1dst:30438360 pythonvs932:30410667 wslgetstarted:30449410 pythonvsnew555:30457759 vscscmwlcmt:30465135 cppdebug:30475216
</details>
<!-- generated by issue reporter -->
Issue Analytics
- State:
- Created a year ago
- Comments:41
Top GitHub Comments
I have this same problem, but in wsl. The conda environment name is dev162 located at β/home/aravia1/miniconda3/envs/dev162/β but it is looking for the environment at β/home/aravia1/miniconda3/envs/dev162/envs/dev162β and fails.
As weird as it sounds, i just tried creating a symlink at the path β/home/aravia1/miniconda3/envs/dev162/envs/dev162β and the tests gets discovered π€·.
Symlink:
Successful test discovery:
Created a bug on conda: https://github.com/conda/conda/issues/12082, feel free to upvote that to raise priority. Closing in favor of conda.