Closed skywind3000 closed 2 years ago
It is using python3.6. Have you tried first testing for python3 before python 2?
I have called has('python3')
at the very beginning, I knows they will conflicts.
And the system vim (the ubuntu apt package) can use +python3
with the same config.
Maybe it is just expecting libpython3.6.so
and can't link to my libpython3.8.so
??
no sure, perhaps setting 'pythonthreedll' to your libpython3.8.so
works?
I put this in my vimrc before everything:
set pythonthreedll=/lib/x86_64-linux-gnu/libpython3.8.so
call has('python3')
and
:echo has('python3')
returns 1 now, but when I input a simple python command:
:py3 print(1234)
the command was executed but with a warning:
:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
I found the root cause:
PY_VERSION_HEX
at the compiling time is defined as 0x03060000
or something.and line 6937 to 6968 from if_py_both.h
are affected by this:
see the url:
the importlib module was introduced early in python3.1
and imp module exists from python2 and got deprecated in python3.4
this seems to be too strict:
#if PY_VERSION_HEX >= 0x030700f0
if (!(imp = PyImport_ImportModule("importlib.machinery")))
return -1;
...
#else
if (!(imp = PyImport_ImportModule("imp")))
return -1;
....
#endif
hm, you may want to create a PR at vim/vim then.
Also, I wonder if we should enable python3.8 for the appimage. Not sure if the following patch would be sufficient:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 6e9baac..f51b2d4 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -79,7 +79,7 @@ jobs:
libcanberra-dev \
libperl-dev \
python-dev \
- python3-dev \
+ python3.8-dev \
liblua5.3-dev \
lua5.3 \
ruby-dev \
Also, I wonder if we should enable python3.8 for the appimage. Not sure if the following patch would be sufficient:
It is sufficient for this. changing appimage to python3.8 would be a better choice, since:
1) ubuntu 20.04 (released in 2020) ships with python3.8 2) ubuntu 22.04 (released in 2022) ships with python3.10 3) debian 12 (scheduled in the middle of 2023) will ship with python3.11
changing appimage to python3.8 will have better compatibility in the next few years.
Hmm this is interesting. FWIW it's not 100% safe to load pythonthreedll
with a different Python version from the one Vim was compiled with (in this case 3.8) since they aren't guaranteed to be binary compatible. My PR (https://github.com/vim/vim/pull/12032) is supposed to fix this though with using stable ABI (which you would need to turn on using a configure flag, which I think AppImage builds may want to do).
Even with stable ABI though the issue here would still have happened, so I guess it's not a panacea (stable ABI only guarantees binary interface compatibility, but there are other wayrs to have incompatibility).
I downloaded this appimage in Ubuntu 22.04 and found that only
python2
was available, whilehas('python3')
returned0
.Is this a version mismatch problem ?
The python3 package version in ubuntu 22.04 is
3.8.10