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

Christophe de Vienne christophe at unlish.com
Fri Oct 3 16:23:50 CEST 2014


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 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/4e54a9fc/attachment-0186.html>


More information about the Cubicweb mailing list