我正在尝试通过SSH在以前在直接登录的计算机上创建的virtualenv中运行ipython notebook(无SSH)。这样做时,ipython笔记本失败了:
(venv2) [host]user: ipython notebook --nobrowser
Traceback (most recent call last):
File ".../venv2/bin/ipython", line 11, in <module>
sys.exit(start_ipython())
File ".../venv2/lib/python2.7/site-packages/IPython/__init__.py", line 118, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File ".../venv2/lib/python2.7/site-packages/traitlets/config/application.py", line 591, in launch_instance
app.initialize(argv)
File "<decorator-gen-111>", line 2, in initialize
File ".../venv2/lib/python2.7/site-packages/traitlets/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File ".../venv2/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 305, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File ".../venv2/lib/python2.7/site-packages/traitlets/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File ".../venv2/lib/python2.7/site-packages/IPython/core/application.py", line 386, in initialize
self.parse_command_line(argv)
File ".../venv2/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 300, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<decorator-gen-4>", line 2, in parse_command_line
File ".../venv2/lib/python2.7/site-packages/traitlets/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File ".../venv2/lib/python2.7/site-packages/traitlets/config/application.py", line 487, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<decorator-gen-3>", line 2, in initialize_subcommand
File ".../venv2/lib/python2.7/site-packages/traitlets/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File ".../venv2/lib/python2.7/site-packages/traitlets/config/application.py", line 418, in initialize_subcommand
subapp = import_item(subapp)
File ".../venv2/lib/python2.7/site-packages/ipython_genutils/importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
File ".../venv2/lib/python2.7/site-packages/notebook/notebookapp.py", line 32, in <module>
from zmq.eventloop import ioloop
File ".../venv2/lib/python2.7/site-packages/zmq/__init__.py", line 44, in <module>
_libsodium = ctypes.CDLL(bundled_sodium[0], mode=ctypes.RTLD_GLOBAL)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /lib64/libc.so.6: version 'GLIBC_2.14' not found (required by .../venv2/lib/python2.7/site-packages/zmq/libsodium.so)
linux-vdso.so.1 => (0x00007ffc957cf000)
libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0 (0x00007ffa27a84000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ffa27867000)
libc.so.6 => /lib64/libc.so.6 (0x00007ffa274d2000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007ffa272ce000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007ffa270cb000)
libm.so.6 => /lib64/libm.so.6 (0x00007ffa26e46000)
/lib64/ld-linux-x86-64.so.2 (0x0000003f10400000)
symbol memcpy, version GLIBC_2.14 not defined in file libc.so.6 with link time reference (.../venv2/lib/python2.7/site-packages/zmq/libsodium.so)
并且ldd给出:
(venv2) [host]user: ldd -r -v .../venv2/lib/python2.7/site-packages/zmq/libsodium.so
.../venv2/lib/python2.7/site-packages/zmq/libsodium.so: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by .../venv2/lib/python2.7/site-packages/zmq/libsodium.so)
linux-vdso.so.1 => (0x00007ffd835e7000)
libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0 (0x00007f229227b000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f229205e000)
libc.so.6 => /lib64/libc.so.6 (0x00007f2291cc9000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f2291ac5000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007f22918c2000)
libm.so.6 => /lib64/libm.so.6 (0x00007f229163d000)
/lib64/ld-linux-x86-64.so.2 (0x0000003f10400000)
symbol memcpy, version GLIBC_2.14 not defined in file libc.so.6 with link time reference (.../venv2/lib/python2.7/site-packages/zmq/libsodium.so)
Version information:
.../venv2/lib/python2.7/site-packages/zmq/libsodium.so:
libpthread.so.0 (GLIBC_2.2.5) => /lib64/libpthread.so.0
libc.so.6 (GLIBC_2.14) => not found
libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/usr/lib64/libpython2.7.so.1.0:
libdl.so.2 (GLIBC_2.2.5) => /lib64/libdl.so.2
libutil.so.1 (GLIBC_2.2.5) => /lib64/libutil.so.1
libpthread.so.0 (GLIBC_2.2.5) => /lib64/libpthread.so.0
libm.so.6 (GLIBC_2.2.5) => /lib64/libm.so.6
libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libpthread.so.0:
ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_2.2.5) => /lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
libc.so.6 (GLIBC_2.3.2) => /lib64/libc.so.6
libc.so.6 (GLIBC_PRIVATE) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libc.so.6:
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
/lib64/libdl.so.2:
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
libc.so.6 (GLIBC_PRIVATE) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libutil.so.1:
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libm.so.6:
libc.so.6 (GLIBC_PRIVATE) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
当通过普通桌面登录使用ipython笔记本时,一切正常,但通过SSH使用它总是会出现此错误。通过SSH重新安装venv没有帮助。我没有root权限,也没有sudo。
任何想法如何让它发挥作用?
非常感谢!
答案 0 :(得分:1)
来自https://docs.python.org/3/library/venv.html:
The venv module provides support for creating lightweight “virtual environments”
with their own site directories, optionally isolated from system
site directories.
显然,您的虚拟环境与系统隔离,以及使用旧版本的GLIBC。问题的SSH部分可能是红色鲱鱼,导致问题的是venv
,而不是ssh。
您可以通过运行/lib64/libc.so.6
在venv内外找到glibc的版本。
确认libc.so.6
内的venv
早于2.14时...您无法解决此问题。
您可以与维护venv
的任何人合作,让其中的GLIBC更新以匹配系统1,或者您可以尝试创建不需要GLIBC-2.14
的二进制文件。
后一种解决方案并非易事。两种常见的方法是在chroot
环境中编译/链接二进制文件,或者使用linux-to-old-linux交叉编译器。
更可行的方法可能是始终在<{em> venv
内构建二进制文件。然后他们将在内部和外部工作。