Ruff fails for conda environment
jrom99 opened this issue · comments
Ruff: restart server
fails when I'm using one of my conda envs.
One of my environments shows as this in VSCode (I don't know why, since it's actually using Python 3.11)
$ find ~/.local/share/conda/envs -name 'python3.*' -type d,l
./[OTHER-ENV]/lib/pkgconfig/python3.pc
./[OTHER-ENV]/lib/python3.11
./[OTHER-ENV]/lib/python3.1
./[OTHER-ENV]/include/python3.11
./[OTHER-ENV]/share/man/man1/python3.1
./[OTHER-ENV]/bin/python3.1
./[ENV]/lib/pkgconfig/python3.pc
./[ENV]/lib/python3.11
./[ENV]/lib/python3.1
./[ENV]/include/python3.11
./[ENV]/share/man/man1/python3.1
./[ENV]/bin/python3.1
My user settings:
{
"workbench.colorTheme": "Default Dark Modern",
"terminal.integrated.inheritEnv": false,
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoFormatStrings": true,
"python.experiments.enabled": false,
"files.associations": {
"*.toml": "toml"
},
"git.autofetch": true,
"terminal.integrated.cursorBlinking": true,
"terminal.integrated.cursorStyle": "line",
"git.confirmSync": false,
"python.analysis.logLevel": "Warning",
"editor.minimap.enabled": false,
"autoDocstring.docstringFormat": "google-notypes"
}
On my pyproject.toml
:
[tool.ruff]
line-length = 100
select = ["ALL"]
On my environment.yml
:
channels:
- defaults
- conda-forge
- pytorch
- dglteam
- nvidia
dependencies:
- python=3.11
- pytorch-cuda=11.8
- torchvision
- torchaudio
- pandas
- pytorch
- torchaudio
- torchdata
- torchvision
- dgl
- pip
- pip:
- -e .
2024-03-12 14:11:58.032 [error] Python version 3.1 is not supported.
2024-03-12 14:11:58.034 [error] Selected python path: [USER]/.local/share/conda/envs/[ENV]/bin/python
2024-03-12 14:11:58.034 [error] Supported versions are 3.7 and above.
2024-03-12 14:11:58.034 [error] Python interpreter missing:
[Option 1] Select Python interpreter using the ms-python.python.
[Option 2] Set an interpreter using "ruff.interpreter" setting.
Please use Python 3.7 or greater.
System information
Version: 1.87.0
Commit: 019f4d1419fbc8219a181fab7892ebccf7ee29a2
Date: 2024-02-27T23:42:16.599Z
Electron: 27.3.2
ElectronBuildId: 26836302
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Linux x64 6.5.0-25-generic (Ubuntu 23.10)
Ruff extension version: v2024.16.0
$ ruff --version # installed via pip
ruff 0.3.2
Changing python's version works, but I still needed to work with this environment, which always shows "3.1.x". At the end I used an external terminal with ruff check --watch .
and deleted the environment as soon as I was done.
I understand. I suspect that that environment is indeed Python 3.1
which we don't support. Can you try to run
[USER]/.local/share/conda/envs/[ENV]/bin/python -V
I'm not sure what [USER]
and [ENV]
means. You might need to replace those variables with something useful.
The strange thing is that the environment is actually python3.11, it runs as expected and uses the features available for it, such as type hints. [USER]
and [ENV]
were just placeholders for the actual directories names. I'll recreate the environment and try again.
Do other Python extensions work as expected in that environment (e.g., Black, or isort, or anything else that's published by Microsoft)?
That's great news. Thanks @jrom99 for getting back to us. Enjoy your weekend.