codelldb icon indicating copy to clipboard operation
codelldb copied to clipboard

Why does the python version is locked as 3.6 only for Windows?

Open yumetodo opened this issue 7 years ago • 6 comments

Latest stable python version is 3.7.4. However, only for windows env, this plugin watches python 3.6 only. For other env, as far as I know, there is no version checking code.

https://github.com/vadimcn/vscode-lldb/blob/70e5a20e4af6d55a1cb5adbe75788233f03db8e1/extension/novsc/adapter.ts#L197-L223

https://github.com/vadimcn/vscode-lldb/blob/70e5a20e4af6d55a1cb5adbe75788233f03db8e1/extension/novsc/adapter.ts#L29-L47

As a result, for the people who install python via chocolatey, CodeLLDB requires Python 3.6(64bit), but looks like it is not installed on this machine will be printed.

C:\WINDOWS\system32>reg query HKLM\Software\Python\PythonCore\3.6\InstallPath /reg:64
エラー: 指定されたレジストリ キーまたは値が見つかりませんでした

C:\WINDOWS\system32>reg query HKLM\Software\Python\PythonCore\3.7\InstallPath /reg:64

HKEY_LOCAL_MACHINE\Software\Python\PythonCore\3.7\InstallPath
    (既定)    REG_SZ    C:\Python37\
    ExecutablePath    REG_SZ    C:\Python37\python.exe
    WindowedExecutablePath    REG_SZ    C:\Python37\pythonw.exe

Why does the python version is locked as 3.6 only for Windows?

Also, there is another strange point.

The code shown below means that python can be executable when the python path is included inPATH env or registry.

https://github.com/vadimcn/vscode-lldb/blob/70e5a20e4af6d55a1cb5adbe75788233f03db8e1/extension/novsc/adapter.ts#L68-L73

However, the next code shows that this plugin always requests registry value.

https://github.com/vadimcn/vscode-lldb/blob/70e5a20e4af6d55a1cb5adbe75788233f03db8e1/extension/diagnostics.ts#L139-L155

In my opinion, python path should be configuratable via VSCode setting.json.

yumetodo avatar Aug 26 '19 12:08 yumetodo

Python ABI is not compatible between its versions. If a binary had been compiled with Python 3.6 library, it cannot use Python 3.5 or Python 3.7.
It's the same on all platforms, actually; it's just that on Linux and MacOS LLDB can still use Python 2, and Python 2's version had been frozen at 2.7 for many years now. Once Python 2 starts being phased out of Linux distros and MacOS, I'll have no choice but to switch to Python 3, and then it'll be the same there too.

Also, there is another strange point.

Not sure I understand your question. That code reads Python installation location from the registry and adds it to the PATH, so that Windows module loader would search that directory for Python .dlls.

vadimcn avatar Aug 26 '19 17:08 vadimcn

Python ABI is not compatible between its versions

I'm not familiar with python. I know there are too many breaking changes from python2 to python3. But I didn't know that there is ABI change in a minor version change.

Just now, I finish to build python 3.6.9 from source and install. Then, this plugin works fine.

Not sure I understand your question

As far as I know, currently, python checking logic and actually needed to find python dll is below, I think.

image

yumetodo avatar Aug 27 '19 10:08 yumetodo

How many versions of Python do we all expect users to have installed?

mmanyen avatar Sep 23 '19 20:09 mmanyen

How many versions of Python do we all expect users to have installed?

Right now it is expected that plugin users will have install the same Python version as it was built with (in addition to other versions they've installed). I understand this is inconvenient, but currently that's the best I can do.

vadimcn avatar Sep 23 '19 22:09 vadimcn

Would it make sense to package a python environment with the extension? This will increase the extension size, but the user will not required to have some arbitrary (from the users perspective) version of python installed.

XenonTRX avatar Oct 13 '19 08:10 XenonTRX

As of v1.4.0, codelldb will use whatever Python 3 (>=3.3) you've got.

vadimcn avatar Nov 25 '19 04:11 vadimcn