I am experiencing an issue similar to the issue described in this post and this post but which I believe is different (or at least is not answered by any of the answers or comments at those linked articles). I have also found this Google groups reply stating not to use LD_LIBRARY_PATH with Anaconda, but feel it is incorrect.

I set up virtualenv and virtualenvwrapper, as explained here .

I installed Anaconda to /home/usrname/anaconda

I tried to create a virtualenv for Anaconda like this:

mkvirtualenv anaconda -p /home/usrname/anaconda/bin/python

but received the following errors that indicate the whole finding-system-python-instead-of-downloaded-2.7.5-python Acaconda issue:

<a href="/cdn-cgi/l/email-protection" data-cfemail="503523203531222310352320353122237d27">[email protected]</a>:~/anaconda/bin$ mkvirtualenv anaconda -p /home/espears/anaconda/bin/python Running virtualenv with interpreter /home/espears/anaconda/bin/python New python executable in anaconda/bin/python Installing setuptools, pip... Complete output from command /home/espears/anacon.../anaconda/bin/python -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip: Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/virtualenv_support/pip-1.5-py2.py3-none-any.whl/pip/__init__.py", line 3, in <module> File "/home/espears/anaconda/lib/python2.7/optparse.py", line 77, in <module> import textwrap File "/home/espears/anaconda/lib/python2.7/textwrap.py", line 10, in <module> import string, re File "/home/espears/anaconda/lib/python2.7/string.py", line 83, in <module> import re as _re File "/home/espears/anaconda/bin/anaconda/lib/python2.7/re.py", line 105, in <module> import sre_compile File "/home/espears/anaconda/bin/anaconda/lib/python2.7/sre_compile.py", line 14, in <module> import sre_parse File "/home/espears/anaconda/bin/anaconda/lib/python2.7/sre_parse.py", line 17, in <module> from sre_constants import * File "/home/espears/anaconda/bin/anaconda/lib/python2.7/sre_constants.py", line 18, in <module> from _sre import MAXREPEAT ImportError: cannot import name MAXREPEAT ---------------------------------------- ...Installing setuptools, pip...done. Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 2334, in <module> main() File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 820, in main symlink=options.symlink) File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 988, in create_environment install_wheel(to_install, py_executable, search_dirs) File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 956, in install_wheel 'PIP_NO_INDEX': '1' File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 898, in call_subprocess % (cmd_desc, proc.returncode)) OSError: Command /home/espears/anacon.../anaconda/bin/python -c "import sys, pip; pip...ll\"] + sys.argv[1:])" setuptools pip failed with error code 1

I exported /home/espears/anaconda/lib/ to the LD_LIBRARY_PATH and then the virtualenv command worked with no problems at all. I could then do workon anaconda and it correctly located the anaconda 2.7.5 version of Python and everything was great.

But then I tried to launch Emacs, and it appears (as in the linked posts at the top) that somehow Anaconda's placement in LD_LIBRARY_PATH creates a problem for Emacs:

<a href="/cdn-cgi/l/email-protection" data-cfemail="9affe9eafffbe8e9daffe9eafffbe8e9b7ed">[email protected]</a>:~$ emacs Gtk-Message: Failed to load module "canberra-gtk-module" emacs: symbol lookup error: /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0: undefined symbol: cairo_ft_font_options_substitute

So the question is: what's going wrong? If I unset the contents of LD_LIBRARY_PATH then the anaconda virtualenv just uses the system default Python. But if I leave LD_LIBRARY_PATH alone, I cannot launch Emacs.

Added

Here is the output of ldd (which emacs) after exporting the needed things for Anaconda to LD_LIBRARY_PATH :

<a href="/cdn-cgi/l/email-protection" data-cfemail="721701021713000132170102171300015f05">[email protected]</a>:~$ export LD_LIBRARY_PATH='/home/espears/anaconda/lib/':$LD_LIBRARY_PATH <a href="/cdn-cgi/l/email-protection" data-cfemail="e98c9a998c889b9aa98c9a998c889b9ac49e">[email protected]</a>:~$ ldd $(which emacs) linux-vdso.so.1 => (0x00007fff0a7fe000) libtiff.so.4 => /usr/lib/x86_64-linux-gnu/libtiff.so.4 (0x00007f504f455000) libjpeg.so.8 => /home/espears/anaconda/lib/libjpeg.so.8 (0x00007f504f21e000) libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f504eff5000) libm.so.6 => /home/espears/anaconda/lib/libm.so.6 (0x00000032b9600000) libgif.so.4 => /usr/lib/x86_64-linux-gnu/libgif.so.4 (0x00007f504edec000) libXpm.so.4 => /usr/lib/x86_64-linux-gnu/libXpm.so.4 (0x00007f504ebda000) libgtk-3.so.0 => /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 (0x00007f504e552000) libgdk-3.so.0 => /usr/lib/x86_64-linux-gnu/libgdk-3.so.0 (0x00007f504e2d4000) libgio-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007f504df84000) libgdk_pixbuf-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007f504dd64000) libpango-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0 (0x00007f504db1b000) libcairo.so.2 => /home/espears/anaconda/lib/libcairo.so.2 (0x00007f504d841000) libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f504d5f2000) libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f504d2fd000) libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007f504d0f4000) libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007f504ceda000) libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f504cba5000) libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f504c99a000) libXft.so.2 => /usr/lib/x86_64-linux-gnu/libXft.so.2 (0x00007f504c785000) libasound.so.2 => /usr/lib/x86_64-linux-gnu/libasound.so.2 (0x00007f504c498000) librsvg-2.so.2 => /usr/lib/x86_64-linux-gnu/librsvg-2.so.2 (0x00007f504c262000) libMagickWand.so.4 => /usr/lib/libMagickWand.so.4 (0x00007f504bf4d000) libMagickCore.so.4 => /usr/lib/libMagickCore.so.4 (0x00007f504baca000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f504b8c1000) libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f504b67d000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f504b460000) libxml2.so.2 => /home/espears/anaconda/lib/libxml2.so.2 (0x00007f504b114000) libgpm.so.2 => /usr/lib/x86_64-linux-gnu/libgpm.so.2 (0x00007f504af0e000) libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f504ace7000) libgconf-2.so.4 => /usr/lib/x86_64-linux-gnu/libgconf-2.so.4 (0x00007f504aab8000) libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f504a899000) libfreetype.so.6 => /home/espears/anaconda/lib/libfreetype.so.6 (0x00007f504a612000) libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f504a3db000) libotf.so.0 => /usr/lib/libotf.so.0 (0x00007f504a1c6000) libm17n-flt.so.0 => /usr/lib/libm17n-flt.so.0 (0x00007f5049fbb000) libm17n-core.so.0 => /usr/lib/libm17n-core.so.0 (0x00007f5049d8d000) libgnutls.so.26 => /usr/lib/x86_64-linux-gnu/libgnutls.so.26 (0x00007f5049ad1000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5049711000) libz.so.1 => /home/espears/anaconda/lib/libz.so.1 (0x00007f50494fb000) libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007f50492f7000) libpangocairo-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 (0x00007f50490ea000) libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007f5048eda000) libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f5048cd4000) libatk-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0 (0x00007f5048ab2000) libcairo-gobject.so.2 => /usr/lib/x86_64-linux-gnu/libcairo-gobject.so.2 (0x00007f50488a8000) libpangoft2-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 (0x00007f504867e000) libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f504846d000) libXinerama.so.1 => /usr/lib/x86_64-linux-gnu/libXinerama.so.1 (0x00007f5048269000) libXrandr.so.2 => /usr/lib/x86_64-linux-gnu/libXrandr.so.2 (0x00007f5048061000) libXcursor.so.1 => /usr/lib/x86_64-linux-gnu/libXcursor.so.1 (0x00007f5047e57000) libXcomposite.so.1 => /usr/lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007f5047c53000) libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f5047a50000) libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f5047833000) libpixman-1.so.0 => /home/espears/anaconda/lib/libpixman-1.so.0 (0x00007f50475b4000) libpng15.so.15 => /home/espears/anaconda/lib/libpng15.so.15 (0x00007f504737d000) libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f5047174000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f5046f37000) libuuid.so.1 => /home/espears/anaconda/lib/libuuid.so.1 (0x00007f5046d33000) libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f5046b14000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f5046910000) libcroco-0.6.so.3 => /usr/lib/x86_64-linux-gnu/libcroco-0.6.so.3 (0x00007f50466d6000) libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f50464c7000) liblcms.so.1 => /usr/lib/x86_64-linux-gnu/liblcms.so.1 (0x00007f5046290000) liblqr-1.so.0 => /usr/lib/liblqr-1.so.0 (0x00007f504607c000) libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f5045e6b000) libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f5045c61000) /lib64/ld-linux-x86-64.so.2 (0x00007f504f6ce000) libdbus-glib-1.so.2 => /usr/lib/x86_64-linux-gnu/libdbus-glib-1.so.2 (0x00007f5045a3a000) libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f5045810000) libthai.so.0 => /usr/lib/x86_64-linux-gnu/libthai.so.0 (0x00007f5045606000) libtasn1.so.3 => /usr/lib/x86_64-linux-gnu/libtasn1.so.3 (0x00007f50453f5000) libgcrypt.so.11 => /lib/x86_64-linux-gnu/libgcrypt.so.11 (0x00007f5045177000) libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f5044f64000) libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f5044d60000) libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f5044b5a000) libdatrie.so.1 => /usr/lib/x86_64-linux-gnu/libdatrie.so.1 (0x00007f5044954000) libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f504474f000)

You can try either of these suggestions:

unset LD_LIBRARY_PATH when you start emacs for instance by defining an alias: alias emacs='LD_LIBRARY_PATH= emacs' (mind the whitespace), or you could

export LD_PRELOAD=$(ldd $(which emacs)|grep libpangocairo|awk '{print $3}') to force the use of the system-wide install libpangocairo library. But this might break anaconda.

本文系统(linux)相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统

主题: RYPython
tags: so,gt,lib,linux,x86,gnu,usr,anaconda,home,espears,lt,File
分页:12
转载请注明
本文标题:Using virtualenv with Anaconda requires LD&amp;lowbar;LIBRARY&amp;lowbar;PAT ...
本站链接:https://www.codesec.net/view/578914.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(linux) | 评论(0) | 阅读(54)