vim / vim

The official Vim repository
https://www.vim.org
Vim License
36.75k stars 5.47k forks source link

Python3 lib-dynlib import issue #2426

Open justandrey opened 6 years ago

justandrey commented 6 years ago

I receive ImportError: ...../lib/python3.6/lib-dynload/math.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyFloat_Type when trying to import most of python standard libraries through py3 import ... Python3.6.3 and vim 8.0.1376 are build in directories on the separate hard drive, python3 is configured with --enable-shared flag vim is configured with --enable-python3interp=yes --with-python3-config-dir=/..../lib/python3.6/config-3.6m-x86_64-linux-gnu/ additionally in the src/auto/config.cache I redefined following variables: vi_cv_path_python3_plibs=${vi_cv_path_python3_plibs='-I/.../include/python3.6m -L/.../lib/python3.6/config-3.6m-x86_64-linux-gnu/ -lpython3.6m -lpthread -ldl -lutil -lm'} vi_cv_path_python3=${vi_cv_path_python3=/srg/a1/work/andrey/python/bin/python3} vi_cv_path_python3_conf=${vi_cv_path_python3_conf=/srg/a1/work/andrey/python/lib/python3.6/config-3.6m-x86_64-linux-gnu/} vi_cv_path_python3_epfx=${vi_cv_path_python3_epfx=/srg/a1/work/andrey/python} vi_cv_path_python3_pfx=${vi_cv_path_python3_pfx=/srg/a1/work/andrey/python}

in vim I can execute without errors following commands py3 print("test") py3 import sys; print(sys.executable) (return blank line) py3 import sys; print(sys.path) (return ['/.../lib/python36.zip', '/.../lib/python3.6', '/.../lib/python3.6/lib-dynload', '/.../lib/python3.6/site-packages', 'vim path_', '/home/andrey/.vim/bundle/vim-virtualenv/autoload']

and receive errors when importing any from python/lib/python3.6/lib-dynload vim was compiled without error messages,

py3 config part: checking --enable-python3interp argument... yes checking for python3... (cached) /srg/a1/work/andrey/python/bin/python3 checking Python version... (cached) 3.6 checking Python is 3.0 or better... yep checking Python's abiflags... (cached) m checking Python's install prefix... (cached) /srg/a1/work/andrey/python checking Python's execution prefix... (cached) /srg/a1/work/andrey/python (cached) checking Python's configuration directory... (cached) /srg/a1/work/andrey/python/lib/python3.6/config-3.6m-x86_64-linux-gnu/ (cached) checking Python3's dll name... (cached) libpython3.6m.a checking if -pthread should be used... yes checking if compile and link flags for Python 3 are sane... yes checking if -fPIE can be added for Python3... yes

geblanco commented 6 years ago

+1, same problem here, almost identical setup.

geblanco commented 6 years ago

@justandrey I think this solution may actually work, it is possible that your setup differs from mine, but this solved me for some libraries (numpy, but not tensorflow).

Hope this helps :)

user202729 commented 2 weeks ago

I uncomment the CONF_OPT_PYTHON3 = --enable-python3interp=dynamic line in the makefile instead of CONF_OPT_PYTHON3 = --enable-python3interp and it works.

user202729 commented 2 weeks ago

Duplicate of https://github.com/vim/vim/issues/3629