文章目录
- 0. 教训
- 1. 问题:使用conda update更新conda后,anaconda所有环境崩溃
- 1.1 问题描述
- 1.2 我搜索到的全网最相关的问题----也没有解决
- 3 尝试流程记录
- 3.1 重新安装pip
- 3.2 解决anaconda编译问题----没成功
0. 教训
(1) 不要轻易使用conda update
更新conda
----我遇到了解决不了的问题
python
(2) 使用python
时一定要用工具,如anaconda
等,管理自己创建的虚拟环境,不要让自己创建的环境污染系统的base环境,不然就需要重新安装系统了----我这里目前最好的解决方案是删除并重装anaconda
1. 问题:使用conda update更新conda后,anaconda所有环境崩溃
(系统的base没有崩溃)
系统:ubuntu18.04
1.1 问题描述
在创建的虚拟环境中安装包时,提示更新conda
==> WARNING: A newer version of conda exists. <==
current version: 22.9.0
latest version: 23.1.0
Please update conda by running
$ conda update -n base -c defaults conda
我更新后,报错如下:
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Retrieving notices: ...working... failed
Traceback (most recent call last):
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/exceptions.py", line 1129, in __call__
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/cli/main.py", line 86, in main_subshell
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/cli/conda_argparse.py", line 93, in do_call
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/notices/core.py", line 75, in wrapper
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/notices/core.py", line 39, in display_notices
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/notices/http.py", line 36, in get_notice_responses
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/notices/http.py", line 39, in <genexpr>
File "/home/meng/anaconda3/lib/python3.10/concurrent/futures/_base.py", line 621, in result_iterator
File "/home/meng/anaconda3/lib/python3.10/concurrent/futures/_base.py", line 319, in _result_or_cancel
File "/home/meng/anaconda3/lib/python3.10/concurrent/futures/_base.py", line 458, in result
File "/home/meng/anaconda3/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
File "/home/meng/anaconda3/lib/python3.10/concurrent/futures/thread.py", line 58, in run
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/notices/http.py", line 42, in <lambda>
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/notices/cache.py", line 37, in wrapper
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/notices/http.py", line 58, in get_channel_notice_response
File "/home/meng/anaconda3/lib/python3.10/site-packages/requests/sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
File "/home/meng/anaconda3/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/home/meng/anaconda3/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/home/meng/anaconda3/lib/python3.10/site-packages/requests/adapters.py", line 460, in send
self.cert_verify(conn, request.url, verify, cert)
File "/home/meng/anaconda3/lib/python3.10/site-packages/requests/adapters.py", line 263, in cert_verify
raise OSError(
OSError: Could not find a suitable TLS CA certificate bundle, invalid path: /home/meng/anaconda3/lib/python3.10/site-packages/certifi/cacert.pem
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/meng/anaconda3/bin/conda", line 15, in <module>
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/cli/main.py", line 129, in main
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/exceptions.py", line 1429, in conda_exception_handler
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/exceptions.py", line 1132, in __call__
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/exceptions.py", line 1172, in handle_exception
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/exceptions.py", line 1183, in handle_unexpected_exception
File "/home/meng/anaconda3/lib/python3.10/site-packages/conda/exceptions.py", line 1245, in print_unexpected_error_report
ModuleNotFoundError: No module named 'conda.cli.main_info'
重点报错有两条,依次为:
Could not find a suitable TLS CA certificate bundle, invalid path: /home/meng/anaconda3/lib/python3.10/site-packages/certifi/cacert.pem
ModuleNotFoundError: No module named 'conda.cli.main_info'
然后无论是在anaconda
的虚拟环境还是anaconda
的base
环境,运行conda xx
等命令都会报错ModuleNotFoundError: No module named 'tqdm'
meng@meng:~/Downloads/cmake-3.18.0$ conda env list
Traceback (most recent call last):
File "/home/meng/anaconda3/bin/conda", line 13, in <module>
sys.exit(main())
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/cli/main.py", line 101, in main
from ..exceptions import conda_exception_handler
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/exceptions.py", line 30, in <module>
from .common.io import dashlist, timeout
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/common/io.py", line 23, in <module>
from tqdm import tqdm
ModuleNotFoundError: No module named 'tqdm'
使用pip安装tqdm也不行,这里应该是pip在conda更新的过程中被卸载了
meng@meng:~/Downloads/cmake-3.18.0$ pip install tqdm
Traceback (most recent call last):
File "/home/meng/anaconda3/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'
1.2 我搜索到的全网最相关的问题----也没有解决
conda update causes ImportError: No module named tqdm
3 尝试流程记录
(退出anaconda
的虚拟环境,应该是不允许的),另开一个终端,进入anaconda
的base
环境
3.1 重新安装pip
参考:anaconda虚拟环境中误删pip问题(No module named pip)
python -m ensurepip #(这好像是重新安装pip)
python -m pip install --upgrade pip #(这好像是更新pip)
会有比较多红色的报错,但好像安装上了
再运行conda
相关命令,还是报错,主要报错为ImportError: libffi.so.8: cannot open shared object file: No such file or directory
3.2 解决anaconda编译问题----没成功
参考:ImportError: libffi.so.7: cannot open shared object file: No such file or directory解决方法
cd anaconda3/lib
ls | grep "libffi"
ln -s libffi.so.7 libffi.so.8
还是不行,报错如下,主要报错为ImportError: /home/meng/anaconda3/lib/python3.7/lib-dynload/../../libffi.so.8: version
LIBFFI_CLOSURE_8.0’ not found (required by /home/meng/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-x86_64-linux-gnu.so)`
meng@meng:~/Downloads/cmake-3.18.0$ conda env list
KeyError('pkgs_dirs')
Traceback (most recent call last):
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/exceptions.py", line 1124, in __call__
return func(*args, **kwargs)
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/cli/main.py", line 57, in main_subshell
p = generate_parser()
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 41, in generate_parser
description='conda is a tool for managing and deploying applications,'
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 117, in __init__
self._subcommands = context.plugin_manager.get_hook_results("subcommands")
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/base/context.py", line 422, in plugin_manager
from ..plugins.manager import get_plugin_manager
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/plugins/manager.py", line 9, in <module>
from . import solvers, virtual_packages
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/plugins/virtual_packages/__init__.py", line 5, in <module>
from . import archspec, cuda, linux, osx, windows
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/plugins/virtual_packages/cuda.py", line 3, in <module>
import ctypes
File "/home/meng/anaconda3/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: /home/meng/anaconda3/lib/python3.7/lib-dynload/../../libffi.so.8: version `LIBFFI_CLOSURE_8.0' not found (required by /home/meng/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-x86_64-linux-gnu.so)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/exceptions.py", line 1244, in print_unexpected_error_report
message_builder.append(get_main_info_str(error_report['conda_info']))
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/cli/main_info.py", line 236, in get_main_info_str
info_dict['_' + key] = ('\n' + 26 * ' ').join(info_dict[key])
KeyError: 'pkgs_dirs'
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/exceptions.py", line 1124, in __call__
return func(*args, **kwargs)
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/cli/main.py", line 57, in main_subshell
p = generate_parser()
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 41, in generate_parser
description='conda is a tool for managing and deploying applications,'
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/cli/conda_argparse.py", line 117, in __init__
self._subcommands = context.plugin_manager.get_hook_results("subcommands")
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/base/context.py", line 422, in plugin_manager
from ..plugins.manager import get_plugin_manager
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/plugins/manager.py", line 9, in <module>
from . import solvers, virtual_packages
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/plugins/virtual_packages/__init__.py", line 5, in <module>
from . import archspec, cuda, linux, osx, windows
File "/home/meng/anaconda3/lib/python3.7/site-packages/conda/plugins/virtual_packages/cuda.py", line 3, in <module>
import ctypes
File "/home/meng/anaconda3/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: /home/meng/anaconda3/lib/python3.7/lib-dynload/../../libffi.so.8: version `LIBFFI_CLOSURE_8.0' not found (required by /home/meng/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-x86_64-linux-gnu.so)
`$ /home/meng/anaconda3/bin/conda env list`
environment variables:
conda info could not be constructed.
KeyError('pkgs_dirs')
An unexpected error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers? [y/N]: n
No report sent. To permanently opt-out, use
$ conda config --set report_errors false