问题描述
我正在尝试在Linux服务器上安装tensorflow,而我只是一个没有root许可的用户.而且,当我通过跳转服务器SSH传输到文件时,无法与文件传输文件.系统如下:
I am trying to install tensorflow on a linux server where I am just a user without the root permission. And I cannot transfer files to/from it as I ssh to it through a jump server. The system is as following :
Linux THENAME_OF_SURVER 2.6.32-573.18.1.el6.x86_64 #1 SMP Tue Feb 9 22:46:17 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Linux THENAME_OF_SURVER 2.6.32-573.18.1.el6.x86_64 #1 SMP Tue Feb 9 22:46:17 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
我通过pip install tensorflow
安装了tensorflow,一个tensorflow程序将显示以下内容:
I installed the tensorflow through pip install tensorflow
and a tensorflow program would display the following:
ImportError: /lib64/libc.so.6: version `GLIBC_2.16' not found
ImportError: /lib64/libc.so.6: version `GLIBC_2.16' not found
我安装了新版本的glibc
I installed a new version of glibc
git clone git://sourceware.org/git/glibc.gitcd glibcgit checkout --track -b local_glibc-2.16 origin/release/2.16/mastermkdir buildcd build../configure --prefix=/home/MYNAME/dependency/glibc-2.16make -j4make install
git clone git://sourceware.org/git/glibc.gitcd glibcgit checkout --track -b local_glibc-2.16 origin/release/2.16/mastermkdir buildcd build../configure --prefix=/home/MYNAME/dependency/glibc-2.16make -j4make install
按照在线说明进行操作后,我通过以下方式更改了环境变量:
Followed the instructions online, I changed the environment variables through:
export LD_LIBRARY_PATH=/home/MYNAME/dependency/glibc-2.16/lib
但这会导致我遇到一个问题:我无法使用任何命令.例如,我打电话给ls
,它会这样警告我:
BUT this leads me to a problem: I cannot use any command. For example, I called ls
and it would warn me like this:
ls: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument
ls: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument
然后我按照另一条指令运行命令,如下所示:
I then followed another instruction to run the command as following:
/home/MYNAME/dependency/glibc-2.16/lib/ld-linux-x86-64.so.2 --library-path /home/MYNAME/dependency/glibc-2.16/lib:$LD_LIBRARY_PATH:/path/to/gcc-5.2.0/lib64:/usr/lib64/:/usr/lib64/ ls
(我不知道在哪里可以找到与gcc-5.2.0
类似的文件夹,我的which gcc
显示/usr/local/sbin/gcc
,但它链接到/usr/local/gcc-5.3.0/bin/gcc
,后者没有lib64子文件夹)
/home/MYNAME/dependency/glibc-2.16/lib/ld-linux-x86-64.so.2 --library-path /home/MYNAME/dependency/glibc-2.16/lib:$LD_LIBRARY_PATH:/path/to/gcc-5.2.0/lib64:/usr/lib64/:/usr/lib64/ ls
(I do not know where to find the similar folder as gcc-5.2.0
, my which gcc
shows /usr/local/sbin/gcc
, but it links to /usr/local/gcc-5.3.0/bin/gcc
, which doesn't have a lib64 subfolder)
但是随后出现了以下警告:
But then it came with the following warning:
ls: error while loading shared libraries: ls: cannot open shared object file
ls: error while loading shared libraries: ls: cannot open shared object file
我知道可以通过将变量导出为空来再次使用ls
.但是我仍然不能使用新版本的glibc.谁能帮助我正确链接新的glibc?任何建议,将不胜感激!
I know that I can use ls
again by export the variable to empty. But I still cannot use the new version of glibc. Could anyone help me with how to correctly link the new glibc? Any suggestions would be appreciated!
因此进度如下:
-
LD_LIBRARY_PATH=/home/MYNAME/dependency/glibc-2.16/lib python
会导致python: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument
LD_LIBRARY_PATH=/home/MYNAME/dependency/glibc-2.16/lib python
would result inpython: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument
/home/MYNAME/dependency/glibc-2.16/lib/ld-2.16.so python
会导致python: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument
/home/MYNAME/dependency/glibc-2.16/lib/ld-2.16.so python
would result in python: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument
EDIT2&摘要:
EDIT2 & SUMMARY:
要使俄罗斯雇主"的答案更加详细,我将在此处粘贴最终解决方案.
To make Employed Russian's answer more detailed, I would paste my final solutions here.
我的目标是在我没有root权限的服务器上使用tensorflow.当导入张量流时,我被警告ImportError: /lib64/libc.so.6: version 'GLIBC_2.16' not found
.
My goal is to use tensorflow in Python on a server that I do not have the root permission. I was warned that ImportError: /lib64/libc.so.6: version 'GLIBC_2.16' not found
when import tensorflow.
基于俄文就业"的回答,我使用以下命令运行命令:
Based on Employed Russian's answer, I used the following to run my command:
LD_LIBRARY_PATH=/home/USERNAME/dependency/glibc-2.17/lib/:/lib64/:/usr/local/gcc-5.3.0/lib64/ /home/USERNAME/dependency/glibc-2.17/lib/ld-2.17.so /home/USERNAME/anaconda2/bin/python
将命令分为以下几部分(我将使用???
来代表对于不同人而言不同的路径.):
Split the command into the following parts (I would use ???
to represent the paths that are different for different people.):
-
LD_LIBRARY_PATH=
- 这部分处理依赖项
-
:
表示拆分 -
???/glibc-2.17/lib/
-
/lib64/
和/usr/local/gcc-5.3.0/lib64/
:我在find / -name 'libgcc_s.so.1'
时找到了这些文件夹,因为我是
LD_LIBRARY_PATH=
- this part deals with dependencies
:
means split???/glibc-2.17/lib/
/lib64/
and/usr/local/gcc-5.3.0/lib64/
: I found these folders byfind / -name 'libgcc_s.so.1'
because I was
其他事项:
- 可从 gnu 下载
- glibc-2.17.我选择2.17是因为tensorflow需要2.17,而2.17可以正常工作.
- 此解决方案还有另一个问题.有时我需要在Python中调用
os.system('ls')
或os.system('python xxx.py')
之类的shell命令.但是,如果我按常规方式使用它,它会警告我如下:sh: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument
,但我还没有找到足够好的解决方案.
- glibc-2.17 is download from gnu. I chose 2.17 because tensorflow needs 2.17 and 2.17 works fine.
- There is another problem of this solution. I sometimes need to call shell command in Python like
os.system('ls')
oros.system('python xxx.py')
. But it warned me as following if I used it in its normal way:sh: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument
and I haven't found a good enough solution for this.
推荐答案
此答案解释了LD_LIBRARY_PATH
不起作用的原因,以及您应该怎么做.
This answer explains why LD_LIBRARY_PATH
doesn't work, and what you should do instead.
该错误通常表示您在ld-linux
和libc.so.6
之间存在不匹配.他们必须匹配.
The error usually means that you have a mismatch between ld-linux
and libc.so.6
. They must match.
如果您正在通过/home/MYNAME/.../ld-2.16.so
使用直接加载程序调用,则还必须安排/home/MYNAME/.../libc.so.6
加载.
If you are using direct loader invocation via /home/MYNAME/.../ld-2.16.so
, you must also arrange for /home/MYNAME/.../libc.so.6
to be loaded.
您可以通过将--library-path ...
传递到ld-2.16.so
或适当地设置LD_LIBRARY_PATH
来实现.
You can do that by passing --library-path ...
to ld-2.16.so
, or setting LD_LIBRARY_PATH
appropriately.
您使用ld-2.16 --library-path ... ls
的命令几乎是 正确.您缺少的是ld-2.16
不会 搜索您的PATH
.您需要给它 full 路径名:ld-2.16 --library-path ... /bin/ls
.
Your command with ld-2.16 --library-path ... ls
is almost correct. The thing you are missing is that ld-2.16
will not search your PATH
. You need to give it full pathname: ld-2.16 --library-path ... /bin/ls
.
这篇关于使用较新版本的glibc时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!