[Cubicweb] Cubicweb is not compatible with virtualenv --system-site-package

Yann Cointepas yann at cointepas.net
Fri Oct 3 17:14:46 CEST 2014


Hi Christophe,

In fact I used logilab to make the example shorter but I did my first tests
with logilab.common. It is the same problem :

$ ~/cubicweb/bin/python -c 'import logilab.common; print
logilab.common.__file__'
/usr/lib/python2.7/dist-packages/logilab/common/__init__.pyc

There cannot be a problem for cubicweb in my example because it has not
been installed on the system (AFAIK there is no Cubicweb package for Ubuntu
14.04 yet). Anyway, you are right, cubicweb import is ok otherwise the
problem would be different on Ubuntu 12.04 (both cubicweb and logilab would
be on the system importing cubicweb would probably work). Sorry for this
mistake.

      Yann


On Fri, Oct 3, 2014 at 4:23 PM, Christophe de Vienne <christophe at unlish.com>
wrote:

>  Hello Yann,
>
> Mind that 'logilab' is a namespace, hence 'logilab.__file__' is not always
> the base path of submodules of logilab.
>
> Could you check, in your last example, what is "logilab.common.__file__" ?
>
> Also, the problem you outline seems only to concern the logilab module,
> not 'cubicweb'.
>
> Christophe
>
> Le 03/10/2014 15:26, Yann Cointepas a écrit :
>
>  Hi,
>
> If the following assumption is true, there is an import bug in Logilab and
> Cubicweb Python modules.
>
> *The assumption:*
>
> Using virtualenv with --system-site-package option make it possible to use
> system packages that are not installed in virtualenv. If a module is
> installed both on virtualenv and on system, the virtualenv version will be
> used.
>
> *The problem*
>
> The assumption works for all modules I tried except the ones from logilab
> or cubicweb. If these modules are installed in both virtualenv and system,
> the system version is used. The following proof shows the difference
> between lxml module and logilab module. It also show a tricky situation
> where cubicweb was installed on a virtualenv and work perfectly until
> someone install pylint on the system. The consequence (of the dependency on
> logilab.common of pylint) is that cubicweb will be taken from virtualenv
> but logilab.* will be in the system. The actual versions can be more or
> less incompatible. For instance, today (i.e. with today pip version of
> cubicweb) it is still possible on Ubuntu 14.04 to import cubicweb (but one
> may have surprise at runtime) but it is not possible on Ubuntu 12.04
> (logilab.common.registry does not exist on the system version but is
> expected on recent cubicweb version).
>
> *The proof*
>
> Starting from a brain new installation of Ubuntu 14.04.
> Installation of cubicweb and lxml in virtualenv:
>
> $ sudo apt-get install libxml2-dev libxslt1-dev libpq-dev libgecode-dev
> $ virtualenv --system-site-package ~/cubicweb
> $ ~/cubicweb/bin/pip install cubicweb
> $ ~/cubicweb/bin/pip install lxml
>
> Check that, lxml, logilab and cubicweb modules are all imported from
> virtualenv
>
> $ ~/cubicweb/bin/python -c 'import lxml; print lxml.__file__'
> /home/yann/cubicweb/local/lib/python2.7/site-packages/lxml/__init__.pyc
> $ ~/cubicweb/bin/python -c 'import logilab; print logilab.__file__'
> /home/yann/cubicweb/local/lib/python2.7/site-packages/logilab/__init__.pyc
> $ ~/cubicweb/bin/python -c 'import cubicweb; print cubicweb.__file__'
> /home/yann/cubicweb/local/lib/python2.7/site-packages/cubicweb/__init__.pyc
>
> Install pylint that may seem to have nothing to do with cubicweb but
> depends on logilab.common
>
> $ sudo apt-get install pylint
>
> Now, lxml and cubicweb are imported from virtualenv but logilab is
> imported from system.
>
> $ ~/cubicweb/bin/python -c 'import lxml; print lxml.__file__'
> /home/yann/cubicweb/local/lib/python2.7/site-packages/lxml/__init__.pyc
> $ ~/cubicweb/bin/python -c 'import logilab; print logilab.__file__'
> /usr/lib/python2.7/dist-packages/logilab/__init__.pyc
> $ ~/cubicweb/bin/python -c 'import cubicweb; print cubicweb.__file__'
> /home/yann/cubicweb/local/lib/python2.7/site-packages/cubicweb/__init__.pyc
>
>        Yann
>
>
> _______________________________________________
> Cubicweb mailing listCubicweb at lists.cubicweb.orghttp://lists.cubicweb.org/mailman/listinfo/cubicweb
>
>
>
> _______________________________________________
> Cubicweb mailing list
> Cubicweb at lists.cubicweb.org
> http://lists.cubicweb.org/mailman/listinfo/cubicweb
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20141003/0499eeff/attachment-0186.html>


More information about the Cubicweb mailing list