CentOS6上使用conda的一些问题坑
1 CentOS6上可以安装Anaconda/Miniconda的版本
我习惯用Miniconda,后面都说Miniconda。系统为x86_64的
新版的Miniconda会对系统版本有要求,主要在于系统的GLIBC版本,新版的大都要求最低要求GLIBC_2.17,而CentOS6默认只到GLIBC_2.12。
1.1 CentOS6上能用的最新GLIBC
因为新版的Miniconda都提示要最低GLIBC_2.17,因此直接编译安装。结果2.17与系统不兼容,会导致大部分命令无法使用,恰好断开系统ssh连接的话,糟糕,再也连不上了。。。
经测试,CentOS5最高可以安装GLIBC_2.15,2.16以上不兼容。即便使用LD_PRELOAD,Miniconda新版也无法安装和使用。
1.2 CentOS6上能用的最新Miniconda
- Miniconda3-py38_4.12.0:GLIBC_2.15
- Miniconda3-py38_4.11.0:GLIBC_2.15
- Miniconda3-py38_4.10.3:GLIBC_2.12 但里面有依赖需要2.17,如:zlib==1.2.11=h7b6447c_3 -> libgcc-ng[version=‘>=7.3.0’] -> __glibc[version=‘>=2.17’],未做进一步测试
- Miniconda3-py38_4.9.2 :GLIBC_2.12 可以安装了
结论:系统默认GLIBC_2.12版本下,最新可用Miniconda3-py38_4.9.2
2 CondaSSLError: OpenSSL appears to be unavailable on this machine
conda安装了一次包之后,再运行conda命令都会报错,具体报错如:
(base) [user@centos65 ~]$ conda search numba
Loading channels: failed
CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to
download and install packages.
Exception: HTTPSConnectionPool(host='mirrors.tuna.tsinghua.edu.cn', port=443): Max retries exceeded with url: /anaconda/pkgs/main/linux-64/repodata.json (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
百度没有答案。
于是看问题是SSL方面的问题,因为conda的channel都是https的,我想修改城http应该就可以了,试了下好像可以了。但是这样并没有实际解决问题,于是看报错是openssl方面的,于是运行了一下openssl命令,结果果然报错了:
(base) [user@centos65 ~]$ openssl
openssl: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by openssl)
openssl: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by openssl)
openssl: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /opt/local/miniconda3/bin/../lib/libssl.so.1.1)
openssl: /lib64/libc.so.6: version `GLIBC_2.16' not found (required by /opt/local/miniconda3/bin/../lib/libcrypto.so.1.1)
openssl: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /opt/local/miniconda3/bin/../lib/libcrypto.so.1.1)
openssl: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by /opt/local/miniconda3/bin/../lib/libcrypto.so.1.1)
openssl: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by /opt/local/miniconda3/bin/../lib/libcrypto.so.1.1)
openssl命令无法运行,报GLIBC版本错误(系统默认2.12的)。检查下更新记录,上次安装包的时候更新了openssl:
The following packages will be UPDATED:
openssl 1.1.1h-h7b6447c_0 --> 1.1.1t-h7f8727e_0
openssl 从 1.1.1h 更新到 1.1.1t。
解决办法:既然老版本可以使用,那么每次安装包的时候,都指定不更新openssl即可,如:
conda install openssl==1.1.1h pandas numba
即,每次安装软件加前缀conda install openssl==1.1.1h
。具体是因为什么就没深究了。