ImportError: cannot import name ‘get_installed_distributions‘ from ‘pip._internal.utils.misc‘【已解决】
·
问题描述
在aistudio中,使用默认的paddlehub模型时,报错。
报错信息
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/__init__.py:107: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import MutableMapping
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/rcsetup.py:20: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import Iterable, Mapping
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/colors.py:53: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import Sized
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/tmp/ipykernel_165/1674323594.py in <module>
3 import paddlehub as hub
4
----> 5 model = hub.Module(name='realsr')
6 model.predict('sfsf.jpg')
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/module/module.py in __new__(cls, name, directory, version, source, update, branch, **kwargs)
170 if name:
171 module = cls.init_with_name(
--> 172 name=name, version=version, source=source, update=update, branch=branch, **kwargs)
173 CacheUpdater("update_cache", module=name, version=version).start()
174 elif directory:
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/module/module.py in init_with_name(cls, name, version, source, update, branch, **kwargs)
257 **kwargs) -> Union[RunModule, ModuleV1]:
258 '''Initialize Module according to the specified name.'''
--> 259 from paddlehub.module.manager import LocalModuleManager
260 manager = LocalModuleManager()
261 user_module_cls = manager.search(name, source=source, branch=branch)
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/module/manager.py in <module>
26 from paddlehub.module.module import Module as HubModule
27 from paddlehub.server import module_server
---> 28 from paddlehub.utils import xarfile, log, utils, pypi
29
30
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/utils/pypi.py in <module>
16 import os
17 import subprocess
---> 18 from pip._internal.utils.misc import get_installed_distributions
19 from typing import IO
20
ImportError: cannot import name 'get_installed_distributions' from 'pip._internal.utils.misc' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pip/_internal/utils/misc.py)
Paddlehu版本
Name: paddlehub
Version: 2.0.4
Summary: A toolkit for managing pretrained models of PaddlePaddle and helping user getting started with transfer learning more efficiently.
Home-page: https://github.com/PaddlePaddle/PaddleHub
Author: PaddlePaddle Author
Author-email: UNKNOWN
License: Apache 2.0
Location: /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages
Requires: colorama, colorlog, easydict, filelock, flask, gitpython, gunicorn, matplotlib, numpy, opencv-python, packaging, paddlenlp, Pillow, pyyaml, pyzmq, rarfile, tqdm, visualdl
Required-by:
解决方案
升级paddlehub
pip install -U paddlehub==2.2.0
更多推荐
所有评论(0)