Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95427

Re: Detecting if a library has native dependency

Path csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'resulting': 0.04; '(python': 0.05; 'dependency': 0.07; 'imported': 0.09; 'logic': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'reliably': 0.09; 'subject:library': 0.09; 'python': 0.10; 'importing': 0.15; '(either': 0.16; 'code?': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:Detecting': 0.16; 'detect': 0.18; 'library': 0.20; 'versions': 0.20; 'libraries': 0.22; 'seems': 0.23; 'installation': 0.23; 'second': 0.24; 'import': 0.24; 'module': 0.25; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'skip:" 20': 0.26; 'addition,': 0.27; 'external': 0.27; '(e.g.': 0.27; 'system?': 0.29; 'thus,': 0.29; 'code': 0.30; 'problem': 0.33; 'library.': 0.35; 'problem.': 0.35; 'but': 0.36; 'there': 0.36; 'tool': 0.36; '(and': 0.36; 'cases': 0.36; 'depends': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'received:org': 0.37; 'missing': 0.37; 'charset:us-ascii': 0.37; 'presence': 0.38; 'version': 0.38; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'some': 0.40; 'determine': 0.61; 'binding': 0.66; 'received:217': 0.66
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From dieter <dieter@handshake.de>
Subject Re: Detecting if a library has native dependency
Date Mon, 17 Aug 2015 08:04:20 +0200
References <CA+D2wW3jxcJZCfk2jEeZ+XzRpS7qVE+QMtHY-4_GVJbU=6r=pw@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Gmane-NNTP-Posting-Host pd9e095df.dip0.t-ipconnect.de
User-Agent Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux)
Cancel-Lock sha1:MAwT6OyuBWmQpD9Wp/4Z5lO8+QI=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.52.1439791471.4764.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1439791471 news.xs4all.nl 2940 [2001:888:2000:d::a6]:49972
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:95427

Show key headers only | View raw


Harish Vishwanath <harish.shastry@gmail.com> writes:

> Is there a reliable way to detect if a python library has native dependency
> or native code? For ex. can I programmatically determine that "lxml"
> package has native code and depends on the presence of libxml on the system?

I do not expect a tool that in all cases can reliably determine such
dependencies.


In simple cases (and "lxml" might be such a case), an import of the
package might reveal a potential problem -- usually, via an "ImportError",
resulting from the fact that the Python module binding to the external
C library cannot be imported (either because it was not built or
because it cannot be initialized). Under "*nix", you can often
use "ldd" to determine on which external C libraries a "shared object"
depends on. Thus, in the second case (Python binding available, but
not initializable), you can often find out what is missing.

However, the import of the Python binding might be delayed. Then,
importing the package will not directly reveal the missing dependencies.

In addition, some packages (e.g. "dm.xmlsec.binding") not only
have an external dependency but depend on specific versions of
a native library. Thus, even if a dependency seems to be satisfied,
there might be a version problem.


Thus, I recommend not to rely on program logic but read the installation
instructions.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Detecting if a library has native dependency dieter <dieter@handshake.de> - 2015-08-17 08:04 +0200

csiph-web