1

PyDev with Python3.5 seems unable to recognize imports from c-compiled extensions, including packages compiled via Cython.

I am working on an up-to-date debian/stretch machine with a stripped-down self-installed (in home dir) Eclipse/Neon with PyDev added via update site, if it matters.

I have both "Python 2.7.13" and "Python 3.5.2+" installed.

One of the problematic packages is lxml. I installed the debian packages and also tried installing manually via pip (and re-created the interpreter in eclipse afterwards to ensure full finding). In all cases packages do work.

In Python2 everything works as advertised.

Under Python3 PyDev flags from lxml import etree as error (but resulting program works):

Unresolved import: etree    richiedi_certificato_dispositivo.py /trasmissione-telematica/Serializzazione    line 8  PyDev Problem

Note: I can import lxml with no error, but then any access to lxml.etree... will be flagged in error. Data completion is consistent (i.e.: etree won't be in the offered list).

lxml is installed in the usual location:

mcon@vocore:~$ ls -l /usr/lib/python3/dist-packages/lxml
total 2156
-rw-r--r-- 1 root root    8152 Sep  5  2014 builder.py
-rw-r--r-- 1 root root    3366 May  5  2016 cssselect.py
-rw-r--r-- 1 root root   18387 May  5  2016 doctestcompare.py
-rw-r--r-- 1 root root    7641 Sep 25  2011 ElementInclude.py
-rw-r--r-- 1 root root    9490 Aug 20 06:48 _elementpath.py
-rw-r--r-- 1 root root 1710088 Aug 24 10:14 etree.cpython-35m-x86_64-linux-gnu.so
drwxr-xr-x 3 root root    4096 Jan  3 08:58 html
drwxr-xr-x 3 root root    4096 Jan  3 08:58 includes
-rw-r--r-- 1 root root     551 Oct  7  2012 __init__.py
drwxr-xr-x 4 root root    4096 Jan  3 08:58 isoschematron
-rw-r--r-- 1 root root   17450 Aug 20 06:48 lxml.etree_api.h
-rw-r--r-- 1 root root    8902 Aug 20 06:48 lxml.etree.h
-rw-r--r-- 1 root root  366440 Aug 24 10:14 objectify.cpython-35m-x86_64-linux-gnu.so
drwxr-xr-x 2 root root    4096 Jan  3 08:58 __pycache__
-rw-r--r-- 1 root root      92 Sep  5  2014 pyclasslookup.py
-rw-r--r-- 1 root root    8531 Nov 20  2014 sax.py
-rw-r--r-- 1 root root     230 Sep 25  2011 usedoctest.py
mcon@vocore:~/trasmissione-telematica$

As You can see etree is in a shared lib, as is objectify; a quick check shows also objectify is not handled by PyDev. I checked a few other "c-extension" packages (e.g.: import pycurl and from Crypto.Util import strxor) with the same result, so it seems a problem with "C" extensions.

2
  • Did you ever find a proper solution to this? (I have exactly the same problem, but cannot use xml.etree...) Commented Mar 21, 2017 at 12:36
  • 1
    @TonnyMadsen: unfortunately not. They are still flagged as errors, but everything works (aside from completion, of course). If You are able to find a solution please inform me. Commented May 5, 2017 at 17:27

1 Answer 1

2

Have you tried to put the offending packages in the forced builtins (as described in http://www.pydev.org/manual_101_interpreter.html)?

If that doesn't work, do you have some error in your error log? (see http://www.pydev.org/faq.html#PyDevFAQ-HowdoIReportaBUG%3F for details on getting it)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.