HPCを利用するため、急いで環境を設定する。
$ which git
/usr/bin/git
$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
OK.
$ tail .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
# [2021/06/17]
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
$ source ~/.bash_profile
No error messages.
$ pyenv install anaconda3-5.2.0
$ pyenv rehash
$ pyenv global anaconda3-5.2.0
$ echo 'alias activate="source $PYENV_ROOT/versions/anaconda3-5.2.0/bin/activate"' >> ~/.bash_profile
$ source ~/.bash_profile
# ここまではOK
$ conda update conda
# これが全然うまくいかない。
conda create Collecting package metadata (current_repodata.json): failed
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
File "/home/[user_01]/.pyenv/versions/anaconda3-5.2.0/lib/python3.7/ssl.py", line 807, in _create
raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname
のようなエラーが出るので、SSLに関することだとあたりがつく。
マシンのセキュリティが厳しいため?
そこでいろいろ調べるうちに、以下のやり方でうまくいった。
https://stackoverflow.com/questions/66642705/why-requests-raise-this-exception-check-hostname-requires-server-hostname
https://askubuntu.com/questions/831266/find-proxy-server-using-command-line
まず、
$ echo "$https_proxy"
https://AAA.BB.CC.DD:EEEE
であることから、
$ more ~/.condarc
proxy_servers: {https: AAA.BB.CC.DD:EEEE}
のように設定する。
一旦ログアウトして、再度ログインする。そしてすぐに
$ conda create -n py37_hvs python=3.7 anaconda
を実行する。
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate py37_hvs
#
# To deactivate an active environment, use
#
# $ conda deactivate
$ source activate py37_hvs
(py37_hvs)$ python
Python 3.7.10 (default, Feb 26 2021, 18:47:35)
[GCC 7.3.0] :: Anaconda, Inc. on linux
>>> import numpy
>>>
これでOK
gala
$ conda install -c conda-forge gala
だと、openblas.so.0がないと言われてインストール後にロードできない。
$ python -m pip install gala
などのやり方だと、SSLのエラーでインストールできず。
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1091)'))': /simple/gala/
Could not fetch URL https://pypi.org/simple/gala/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/gala/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1091)'))) - skipping
ERROR: Could not find a version that satisfies the requirement gala
ERROR: No matching distribution found for gala
conda install -y -c conda-forge astro-gala
conda install -y -c conda-forge openblas==0.3.3
python -c "import gala"
これで解決した。
mwdust
いつもどおり。