When I was using Anaconda to install tensorflow on Linux server yesterday, I found that I cannot update, install, uninstall packages as well as create new conda environment. All of them returned the same error when collecting package metadata:
(base) user@servername:~$ conda update condaChannels: - defaultsPlatform: linux-64Collecting package metadata (repodata.json): \ Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1006)'))': /pkgs/r/noarch/repodata.jsonfailedCondaSSLError: Encountered an SSL error. Most likely a certificate verification issue.Exception: HTTPSConnectionPool(host='repo.anaconda.com', port=443): Max retries exceeded with url: /pkgs/main/linux-64/repodata.json (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1006)')))
FYI, I am a temporary user of the server, and I cannot use sudo. And I cannot use pip because it also needs sudo to install. I’m using Anaconda 24.1.2 and ubuntu 20.04.3.Everything works fine before yesterday. Here are some approaches I tried to solve the problem:
- I connected to the server with and without VPN (the one that bypass internet cencorship), but it showed no difference.
- I deleted and installed Anaconda a few times but not working.
- Switched to Tsinghua mirror repository and still no difference. My .condarc file is as follows. Since there’s no difference, I changed back to the default repository.
channels:- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64show_channel_urls: true
- I specified my ssl certificate according to KWABut still, the error stayed the same.
- Then, I tried to set ssl_verify to false by
conda config --set ssl_verify False
. The error message was changed to UnicodeDecoderError. The detailed error report is as follows.
(base) user@servername:~$ conda update condaChannels: - defaultsPlatform: linux-64Collecting package metadata (repodata.json): failed# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "/home/user/anaconda3/lib/python3.11/site-packages/conda/exception_handler.py", line 17, in __call__ return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^...... ^^^^^^^^^^^^^^^^^^^ File "/home/user/anaconda3/lib/python3.11/site-packages/conda/gateways/repodata/__init__.py", line 858, in fetch_latest raw_repodata = self.cache_path_json.read_text() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/anaconda3/lib/python3.11/pathlib.py", line 1059, in read_text return f.read() ^^^^^^^^ File "<frozen codecs>", line 322, in decode UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc9 in position 465: invalid continuation byte
- I tried cleaning the cache by
conda clean --all
- I specified the encoding method by
export PYTHONIOENCODING=utf-8
- The above two methods didn’t change the error report. Then, I reached the file /home/user/anaconda3/lib/python3.11/pathlib.py and changed the decoding method in the original file from
def read_text(self, encoding=None, errors=None):""" Open the file in text mode, read it, and close the file.""" encoding = io.text_encoding(encoding) with self.open(mode='r', encoding=encoding, errors=errors) as f: return f.read()
to (also tried “latin-1” )
def read_text(self, encoding="gbk", errors=None):""" Open the file in text mode, read it, and close the file.""" encoding = io.text_encoding(encoding) with self.open(mode='r', encoding=encoding, errors=errors) as f: return f.read()
It returns the error
(base) user@servername:~$ conda update condaChannels: - defaultsPlatform: linux-64Collecting package metadata (repodata.json): failed# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<< Traceback (most recent call last): File "/home/user/anaconda3/lib/python3.11/site-packages/conda/exception_handler.py", line 17, in __call__ return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^...... File "/home/user/anaconda3/lib/python3.11/site-packages/conda_libmamba_solver/index.py", line 337, in _load_channels info = self._json_path_to_repo_info(url, jsons[url]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/anaconda3/lib/python3.11/site-packages/conda_libmamba_solver/index.py", line 293, in _json_path_to_repo_info repo = api.Repo(self._pool, noauth_url, str(path_to_use), escape_channel_url(noauth_url)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: Unable to read repodata JSON file 'https://repo.anaconda.com/pkgs/main/linux-64', error was: repository does not start with an object
Are there any other methods to enable my conda to install packages and create virtual environment? Any insights will be appreciated. Thanks a lot!
As I stated before, I'd like to use my conda to install and uninstall packages and create virtual environment as usual.