Sunday, March 31, 2019

Re: pip install (python3) requires some development libraries

On 2019/03/31 20:28, Kent Watsen wrote:
> [CC-ing Remi, "python2.7" package maintainer]
> [Stuart, already CC-ed, is maintainer of the "openldap-client" package]
>
> The subject line of this email says "python3", but the same issue occurs
> with python2.7 (this on OpenBSD 6.4).
>
> I filed an report for the broken `pip install python-ldap` issue (technically a
> `python setup.py build` issue) on GitHub here:
>
> https://github.com/python-ldap/python-ldap/issues/273
>
> They claim it's an OpenBSD's issue:
>
> It's either a problem with OpenBSD, compiler settings, OpenBSD's
> package manager, or Python on OpenBSD. The build system should
> pick up default locations for headers and libraries.

You are bypassing packages by using pip so package manager is irrelevant
here. I think it is a bad choice to do this though because if libldap or
or some other libraries on the system are updated, your local installation
of py-ldap may break.

Anyway, if you need to do this, OpenBSD compilers intentionally do not
include /usr/local/lib / /usr/local/include in the default lib/header
search path - you need to pass them via LDFLAGS/CPPFLAGS or another
method. This is normal for building anything using libraries from
packages.

> /usr/local/include/lber.h comes from the "openldap-client" package but, as
> the report below shows, the `cc` flags are passing "/usr/local/include/python*",
> where '*' in "2.7" in my case and "3.6m" below.
>
> So who's right? Is this a "python-ldap" package issue or an OpenBSD issue?
>
> FWIW, I am able to install python-ldap using Stuart's instructions below, but
> doing so is inconvenient when the dependency comes when trying to `pip
> install` an even higher-level Python package.

The easiest way: update to OpenBSD -current where there is a newer
version of py-ldap / py3-ldap in packages (we had to patch dependent
ports to cope with API changes in py-ldap).

General recommendation even if you are installing python things from
outside packages, is to use packages for any compiled extensions. Here's
a nice example of the approach, using virtualenv to install netbox.
https://blog.jasper.la/setting-up-netbox-on-openbsd.html

If you need things which aren't already in packages (or are too old)
then write a port or update (and test existing dependent ports) and send
it to ports@.

No comments:

Post a Comment