Am Mittwoch, 11. März 2020, 18:54:43 CET schrieb Grant Edwards: > Background: a utility written in Python that I use regularly > (weasyprint) was out-of-date and is being dropped from Gentoo's > package database. I tried (and faield) to creaate an ebuild for a > more recent version. So I ended up doing > > $ pip3 install --user weasyprint > > That installed weasyprint and a few depdendancies (tinycss2, > defusedxml, ciarocffi) under ~/.local/{bin,lib64}. > > Question: > > Can those dependancies installed under ~/.local cause problems for > things that were installed using standard ebuilds which require > older/other versions of those libraries (which were installed using > standard ebuilds)? > > For example, weasyprint requires cairosvg 2.4, and 2.4.2 was installed > under .local via the pip3 command shown above. > > My stable cairosvg is 2.0.3 and it is installed in the usual "system" > location /usr/lib64/python3.6/site-packages by the normal "emerge" > process. [IIRC, at one point I tried unmasking 2.4.2, but that caused > a cascade of other problems.] > > Q: Under what conditions will having a second installation of a Python > library under .local cause problems?
IIUC you shouldn't have any problems, simply because ~/.local/ is not part of the system python's module search path: % python3 Python 3.6.10 (default, Feb 26 2020, 01:09:02) [GCC 9.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path ['', '/usr/lib64/python36.zip', '/usr/lib64/python3.6', '/usr/lib64/python3.6/ lib-dynload', '/usr/lib64/python3.6/site-packages'] So whatever uses the system Python will not see your local packages unless it manipulates sys.path appropriately (which I don't think any sane software ever does). A virtualenv, as suggested by Mark, would have its own module search paths. I don't know if those ever *can* include the system paths (because they normally use their own Python binary with its own standard library and site-packages), but none of the environments I have do, e.g.: % conda activate base % python (base) Python 3.7.4 (default, Aug 13 2019, 20:35:49) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path ['', '/home/marcec/.miniconda3/lib/python37.zip', '/home/marcec/.miniconda3/ lib/python3.7', '/home/marcec/.miniconda3/lib/python3.7/lib-dynload', '/home/ marcec/.miniconda3/lib/python3.7/site-packages'] >>> (Granted it's conda and not plain virtualenv, but I think the principles are the same.) HTH -- Marc Joliet -- "People who think they know everything really annoy those of us who know we don't" - Bjarne Stroustrup
signature.asc
Description: This is a digitally signed message part.