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服务器上安装tensorflow,我只是一个没有root权限的用户。当我通过跳转服务器ssh到它时,我无法传输文件。系统如下:
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 2月9日22:46:17 UTC 2016 x86_64 x86_64 x86_64 GNU / Linux
I installed the tensorflow through pip install tensorflow
and a tensorflow program would display the following:
我通过pip install tensorflow安装了tensorflow,tensorflow程序将显示以下内容:
ImportError: /lib64/libc.so.6: version `GLIBC_2.16' not found
ImportError:/lib64/libc.so.6:找不到版本“GLIBC_2.16”
I installed a new version of glibc
我安装了新版本的glibc
git clone git://sourceware.org/git/glibc.git cd glibc git checkout --track -b local_glibc-2.16 origin/release/2.16/master mkdir build cd build ../configure --prefix=/home/MYNAME/dependency/glibc-2.16 make -j4 make install
git clone git://sourceware.org/git/glibc.git cd glibc git checkout --track -b local_glibc-2.16 origin / release / 2.16 / master mkdir build cd build ../configure --prefix = / home / MYNAME /dependency/glibc-2.16 make -j4 make install
Followed the instructions online, I changed the environment variables through:
按照在线说明,我通过以下方式更改了环境变量:
export LD_LIBRARY_PATH=/home/MYNAME/dependency/glibc-2.16/lib
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,它会像这样警告我:
ls: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument
ls:加载共享库时出错:__ docso_time:dlopen()的无效模式:参数无效
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
(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)
/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类似的文件夹,我的gcc显示/ usr / local / sbin / gcc ,但它链接到/usr/local/gcc-5.3.0/bin/gcc,它没有lib64子文件夹)
But then it came with the following warning:
但随后又出现了以下警告:
ls: error while loading shared libraries: ls: cannot open shared object file
ls:加载共享库时出错:ls:无法打开共享对象文件
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!
我知道我可以通过将变量导出为空来再次使用ls。但我仍然无法使用新版本的glibc。谁能帮助我如何正确链接新的glibc?任何建议,将不胜感激!
EDIT: So the progress is as following:
编辑:所以进展情况如下:
-
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
LD_LIBRARY_PATH = / home / MYNAME / dependency / glibc-2.16 / lib python在加载共享库时会导致python:error:__ docso_time:dlopen()的无效模式:无效的参数
-
/home/MYNAME/dependency/glibc-2.16/lib/ld-2.16.so 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:__ docso_time:dlopen()的无效模式:无效的参数
EDIT2 & SUMMARY:
编辑2和摘要:
To make Employed Russian's answer more detailed, I would paste my final solutions here.
为了使Employed Russian的答案更加详细,我会在此处粘贴我的最终解决方案。
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.
我的目标是在我没有root权限的服务器上使用Python中的tensorflow。我被警告导入tensorflow时找不到ImportError:/lib64/libc.so.6:版本'GLIBC_2.16'。
Based on Employed Russian's answer, I used the following to run my command:
根据Employed Russian的回答,我使用以下命令运行我的命令:
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
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。所以/ 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=
- 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
这部分涉及依赖
:意味着分裂
/ lib64 /和/usr/local/gcc-5.3.0/lib64/:我通过find / -name'libgcc_s.so.1'找到了这些文件夹,因为我是
-
/???/glibc-2.17/lib/ld-2.17.so
-
/???/python
the path of your executable. For Python,import sys; print(sys.executable)
to see your Python path.
LD_LIBRARY_PATH =这部分涉及依赖:意味着split ??? / glibc-2.17 / lib / / lib64 /和/usr/local/gcc-5.3.0/lib64/:我通过find / -name'libgcc_s找到了这些文件夹。所以,因为我是
/ ??? / python您的可执行文件的路径。对于Python,导入sys; print(sys.executable)以查看您的Python路径。
Other things:
- 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.
glibc-2.17是从gnu下载。我之所以选择2.17,是因为张量流需要2.17和2.17才能正常工作。
这个解决方案还有另一个问题。我有时需要在Python中调用shell命令,如os.system('ls')或os.system('python xxx.py')。但它警告我如果我以正常方式使用它:sh:加载共享库时出错:__ docso_time:dlopen()的无效模式:无效的参数,我没有找到一个足够好的解决方案。
2 个解决方案
#1
2
export LD_LIBRARY_PATH=/home/MYNAME/dependency/glibc-2.16/lib
This answer explains why LD_LIBRARY_PATH
doesn't work, and what you should do instead.
这个答案解释了为什么LD_LIBRARY_PATH不起作用,以及你应该做什么。
I read your post and tried ...
python: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument
我读了你的帖子并尝试... python:加载共享库时出错:__ docso_time:dlopen()的无效模式:无效的参数
The error usually means that you have a mismatch between ld-linux
and libc.so.6
. They must match.
该错误通常意味着您在ld-linux和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.
如果您通过/home/MYNAME/.../ld-2.16.so使用直接加载器调用,则还必须安排加载/home/MYNAME/.../libc.so.6。
You can do that by passing --library-path ...
to ld-2.16.so
, or setting LD_LIBRARY_PATH
appropriately.
您可以通过将--library-path ...传递给ld-2.16.so或适当地设置LD_LIBRARY_PATH来实现。
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
.
你的命令与ld-2.16 --library-path ... ls几乎是正确的。你缺少的是ld-2.16不会搜索你的PATH。你需要给它完整的路径名:ld-2.16 --library-path ... / bin / ls。
#2
0
In my case it was centos 6 with python for pytorch.
在我的情况下,它是用pytorch的python的centos 6。
I had errors like, etc.:
我有类似的错误:
libraries: __vdso_time: invalid mode for dlopen(): Invalid argument
ImportError: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /home/evaldsu/.conda/envs/conda_env/lib/python3.6/site-
I installed alongside glibc-2.17 in local dir /opt/exp_soft/tools
我在本地目录/ opt / exp_soft / tools中安装了glibc-2.17
then I installed in conda env patching tool (can install using other tools as well):
然后我安装了conda env修补工具(也可以使用其他工具安装):
conda install -c conda-forge patchelf
then I patched binary of python to use different glibc path (you can do this with any binary). Be aware that it will change you pyhton binary.
然后我修补了python的二进制文件以使用不同的glibc路径(你可以用任何二进制文件做到这一点)。请注意它会改变你的pyhton二进制文件。
patchelf --set-rpath /opt/exp_soft/tools/glibc-2.17/lib:$HOME/.conda/envs/conda_inf/lib:/usr/lib64:/lib64:/lib --set-interpreter /opt/exp_soft/tools/glibc-2.17/lib/ld-linux-x86-64.so.2 /home/evaldsu/.conda/envs/conda_inf/bin/python3.6
Another option is just install this script if you have full admin access:
另一个选择是,如果您拥有完全的管理员权限,请安装此脚本:
https://gist.github.com/harv/f86690fcad94f655906ee9e37c85b174
#1
2
export LD_LIBRARY_PATH=/home/MYNAME/dependency/glibc-2.16/lib
This answer explains why LD_LIBRARY_PATH
doesn't work, and what you should do instead.
这个答案解释了为什么LD_LIBRARY_PATH不起作用,以及你应该做什么。
I read your post and tried ...
python: error while loading shared libraries: __vdso_time: invalid mode for dlopen(): Invalid argument
我读了你的帖子并尝试... python:加载共享库时出错:__ docso_time:dlopen()的无效模式:无效的参数
The error usually means that you have a mismatch between ld-linux
and libc.so.6
. They must match.
该错误通常意味着您在ld-linux和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.
如果您通过/home/MYNAME/.../ld-2.16.so使用直接加载器调用,则还必须安排加载/home/MYNAME/.../libc.so.6。
You can do that by passing --library-path ...
to ld-2.16.so
, or setting LD_LIBRARY_PATH
appropriately.
您可以通过将--library-path ...传递给ld-2.16.so或适当地设置LD_LIBRARY_PATH来实现。
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
.
你的命令与ld-2.16 --library-path ... ls几乎是正确的。你缺少的是ld-2.16不会搜索你的PATH。你需要给它完整的路径名:ld-2.16 --library-path ... / bin / ls。
#2
0
In my case it was centos 6 with python for pytorch.
在我的情况下,它是用pytorch的python的centos 6。
I had errors like, etc.:
我有类似的错误:
libraries: __vdso_time: invalid mode for dlopen(): Invalid argument
ImportError: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /home/evaldsu/.conda/envs/conda_env/lib/python3.6/site-
I installed alongside glibc-2.17 in local dir /opt/exp_soft/tools
我在本地目录/ opt / exp_soft / tools中安装了glibc-2.17
then I installed in conda env patching tool (can install using other tools as well):
然后我安装了conda env修补工具(也可以使用其他工具安装):
conda install -c conda-forge patchelf
then I patched binary of python to use different glibc path (you can do this with any binary). Be aware that it will change you pyhton binary.
然后我修补了python的二进制文件以使用不同的glibc路径(你可以用任何二进制文件做到这一点)。请注意它会改变你的pyhton二进制文件。
patchelf --set-rpath /opt/exp_soft/tools/glibc-2.17/lib:$HOME/.conda/envs/conda_inf/lib:/usr/lib64:/lib64:/lib --set-interpreter /opt/exp_soft/tools/glibc-2.17/lib/ld-linux-x86-64.so.2 /home/evaldsu/.conda/envs/conda_inf/bin/python3.6
Another option is just install this script if you have full admin access:
另一个选择是,如果您拥有完全的管理员权限,请安装此脚本:
https://gist.github.com/harv/f86690fcad94f655906ee9e37c85b174