You are not logged in.

#1 2017-12-21 14:06:12

easysid
Member
From: India
Registered: 2013-01-01
Posts: 256

[SOLVED] pip installed greenlet package fails import in vim

I did a fresh install today, and I configured nvim-completion-manager, which requires neovim python module. So I ran a

$ pip install --user neovim

, which also installed greenlet (0.4.12) as a dependency. However, this locally installed greenlet fails under vim.

The import works fine under python interpreter

$  python
Python 3.6.3 (default, Oct 24 2017, 14:48:20) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import greenlet
>>>  <works as expected. No errors>

But under vim, it gives the following error

:pythonx import greenlet
ImportError: /home/easysid/.local/lib/python3.6/site-packages/greenlet.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyExc_ValueError

I then installed the repo version of greenlet using pacman -S python-greenlet, and everything worked as expected, even with vim. I removed the repo version, and copied the greenlet.so library from pacman cache to my local site package, and everything still worked normally.

I then extracted the  greenlet.so library from the .whl downloaded from PyPI (greenlet-0.4.12-cp36-cp36m-manylinux1_x86_64.whl) , and replaced the repo version with it, and the errors were back

ImportError: /home/easysid/.local/lib/python3.6/site-packages/greenlet.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyExc_ValueError

Any ideas as to why this is happening. pip feteches the exact same version as mentioned in the upstream url of the arch package, yet it does not work, but only under vim.

Last edited by easysid (2017-12-21 14:32:22)

Offline

#2 2017-12-21 14:11:37

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] pip installed greenlet package fails import in vim

You are always going to run into trouble trying to mix and match repo packages with pip user installed packages.  Pick one and only one.  Why not use the repo packages: they work.

As the the actual cause, I'd suspect that the pip version may be linked differently.  Check with `ldd`.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2017-12-21 14:28:31

easysid
Member
From: India
Registered: 2013-01-01
Posts: 256

Re: [SOLVED] pip installed greenlet package fails import in vim

Thanks. This seems to be the case.

PyPI version

$ ldd greenlet.cpython-36m-x86_64-linux-gnu.so 
	linux-vdso.so.1 (0x00007ffd37bfc000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f5a1d1d9000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f5a1ce21000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f5a1d5fe000)

repo version

$ ldd ~/.local/lib/python3.6/site-packages/greenlet.cpython-36m-x86_64-linux-gnu.so 
	 linux-vdso.so.1 (0x00007ffcaeff5000)
	 libpython3.6m.so.1.0 => /usr/lib/libpython3.6m.so.1.0 (0x00007f98edfc6000)
	 libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f98edda8000)
	 libc.so.6 => /usr/lib/libc.so.6 (0x00007f98ed9f0000)
	 libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f98ed7ec000)
	 libutil.so.1 => /usr/lib/libutil.so.1 (0x00007f98ed5e9000)
	 libm.so.6 => /usr/lib/libm.so.6 (0x00007f98ed29d000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f98ee72a000)

I am coming from Debian, and this setup with local modules worked perfectly there. I'll drop them in favour of the repo versions.

I was confused by the fact that only this import failed, that too only under vim. I'll mark this as solved.

Last edited by easysid (2017-12-21 14:30:22)

Offline

#4 2017-12-21 16:14:42

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] pip installed greenlet package fails import in vim

For what it's worth, you can configure your ~/.config/pip/pip.conf to automatically fix this.

[install]
user = yes
no-binary = :all:

Then pip will default to --user, and it will also default to --no-binary. So it won't use the precompiled wheel, and will instead download the sources and compile it (properly!) on your system.

...

Yes, you should always try to use repo packages, but if for some reason you end up needing --user, or more likely needing to use venv, then at least do isolated user installs properly. smile


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2017-12-21 16:43:11

easysid
Member
From: India
Registered: 2013-01-01
Posts: 256

Re: [SOLVED] pip installed greenlet package fails import in vim

Eschwartz wrote:

For what it's worth, you can configure your ~/.config/pip/pip.conf to automatically fix this.

[install]
user = yes
no-binary = :all:

Then pip will default to --user, and it will also default to --no-binary. So it won't use the precompiled wheel, and will instead download the sources and compile it (properly!) on your system.

...

Yes, you should always try to use repo packages, but if for some reason you end up needing --user, or more likely needing to use venv, then at least do isolated user installs properly. smile

Thank you so much. I wasn't aware of the config options. It works perfectly now, even with local modules.

Offline

Board footer

Powered by FluxBB