15

I compiled the development version of Vim with both Python 2 and Python 3 support. The output of vim --version has +python/dyn and +python3/dyn in it. I ran the configure file with g ./configure --enable-pythoninterp --enable-python3interp --with-python-config-dir=/usr/lib64/python2.7/config --with-python3-config-dir=/usr/lib64/python3.3/config --with-x --with-features=huge

However when I run :python import sys; print(sys.version) I get

E448: Could not load library function _PyArg_Parse_SizeT  
E263: Sorry, this command is disabled, the Python library could not be loaded.

Why would this be? I found out because of YouCompleteMe stating that it requires Vim compiled with 2.x support.

Thanks

7
  • Is it possible it was compiled for a different version of 2.x that what you're using? It's only a guess, but C extensions definately need to be compiled for the specific version.
    – Tom Dalton
    Commented Apr 12, 2014 at 0:16
  • 1
    I have the same problem before in Windows, and the reason is the version of my python/python3 is 64bit. After I installed 32bit python/python3, everything's fine.
    – Marslo
    Commented Apr 12, 2014 at 2:17
  • 1
    Why would it matter if it's 64 vs 32 bit? Commented Apr 12, 2014 at 3:42
  • Vim is 32 bit so it can't load your 64 bit python library. It's that simple.
    – romainl
    Commented Apr 12, 2014 at 9:21
  • Ah I see, that makes sense. So I need the 32bit Python installation to use with Vim. Thanks! Commented Apr 12, 2014 at 18:16

1 Answer 1

21

I had a similar issue on my Debian box. If you're using a Debian-based system, you will not be able to load both Python libraries simultaneously. That's why when you set --enable-python-interp and --enable-python3-interp they always load with the /dyn suffix.

If your vim plugins don't need both versions, you should just pick one of the versions and stick with it. The links below provide more info.

Explained by Debian maintainer

Vim Python Support

P.S. - In case you tried this on Windows as well, loading either Python version will work, so the /dyn isn't an issue there.

3
  • @chirinosky If I'm reading this (and the links) right, there isn't any fix for this, and we have to live with whichever Python is loaded first. Am I getting this right?
    – batbrat
    Commented Apr 2, 2019 at 16:17
  • 1
    @batbrat Yes, you basically have to pick one or the other.
    – chirinosky
    Commented Apr 4, 2019 at 0:12
  • 1
    I'm going ahead and compiling against just one version of Python. Since Python 2 support is coming to an end, I've picked Python 3, although arguments can be made for the opposite. Thanks for your help.
    – batbrat
    Commented Apr 4, 2019 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.