HibiKier / zhenxun_bot

基于 Nonebot2 开发,非常可爱的绪山真寻bot
GNU Affero General Public License v3.0
3.35k stars 605 forks source link

[已解决] poetry install 命令安装依赖报错,无法安装部分依赖 #1217

Closed text233 closed 1 year ago

text233 commented 1 year ago

系统版本:Ubuntu 22.04

真寻版本:0.1.6.5

python版本:3.10.6

pip版本:22.3.1

日志截图


(zhenxun-bot-py3.10) root@TimeServer:/home/software/zhenxun/zhenxun_bot-main# poetry install
Installing dependencies from lock file

Package operations: 61 installs, 15 updates, 0 removals

  • Installing pyparsing (3.0.9): Failed

  DBusErrorResponse

  [org.freedesktop.DBus.Error.UnknownMethod] ('对象在路径“/org/freedesktop/secrets/collection/login”处不存在',)

  at /usr/lib/python3/dist-packages/jeepney/wrappers.py:214 in unwrap_msg
      210│     This is to be used with replies to method_call messages, which may be
      211│     method_return or error.
      212│     """
      213│     if msg.header.message_type == MessageType.error:
    → 214│         raise DBusErrorResponse(msg)
      215│ 
      216│     return msg.body
      217│ 

The following error occurred when trying to handle this error:

  ItemNotFoundException

  Item does not exist!

  at /usr/lib/python3/dist-packages/secretstorage/util.py:49 in send_and_get_reply
       45│      try:
       46│          return self._connection.send_and_get_reply(msg, unwrap=True)
       47│      except DBusErrorResponse as resp:
       48│          if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
    →  49│              raise ItemNotFoundException('Item does not exist!') from resp
       50│          elif resp.name in (DBUS_SERVICE_UNKNOWN, DBUS_EXEC_FAILED,
       51│                             DBUS_NO_REPLY):
       52│              data = resp.data
       53│              if isinstance(data, tuple):

The following error occurred when trying to handle this error:

  PromptDismissedException

  Prompt dismissed.

  at /usr/lib/python3/dist-packages/secretstorage/collection.py:145 in create_collection
      141│  if len(collection_path) > 1:
      142│      return Collection(connection, collection_path, session=session)
      143│  dismissed, result = exec_prompt(connection, prompt)
      144│  if dismissed:
    → 145│      raise PromptDismissedException('Prompt dismissed.')
      146│  signature, collection_path = result
      147│  assert signature == 'o'
      148│  return Collection(connection, collection_path, session=session)
      149│ 

The following error occurred when trying to handle this error:

  InitError

  Failed to create the collection: Prompt dismissed..

  at /usr/local/lib/python3.10/dist-packages/keyring/backends/SecretService.py:63 in get_preferred_collection
       59│                 collection = secretstorage.Collection(bus, self.preferred_collection)
       60│             else:
       61│                 collection = secretstorage.get_default_collection(bus)
       62│         except exceptions.SecretStorageException as e:
    →  63│             raise InitError("Failed to create the collection: %s." % e)
       64│         if collection.is_locked():
       65│             collection.unlock()
       66│             if collection.is_locked():  # User dismissed the prompt
       67│                 raise KeyringLocked("Failed to unlock the collection!")

  • Installing tzdata (2022.6): Failed

  DBusErrorResponse

  [org.freedesktop.DBus.Error.UnknownMethod] ('对象在路径“/org/freedesktop/secrets/collection/login”处不存在',)

  at /usr/lib/python3/dist-packages/jeepney/wrappers.py:214 in unwrap_msg
      210│     This is to be used with replies to method_call messages, which may be
      211│     method_return or error.
      212│     """
      213│     if msg.header.message_type == MessageType.error:
    → 214│         raise DBusErrorResponse(msg)
      215│ 
      216│     return msg.body
      217│ 

The following error occurred when trying to handle this error:

  ItemNotFoundException

  Item does not exist!

  at /usr/lib/python3/dist-packages/secretstorage/util.py:49 in send_and_get_reply
       45│      try:
       46│          return self._connection.send_and_get_reply(msg, unwrap=True)
       47│      except DBusErrorResponse as resp:
       48│          if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
    →  49│              raise ItemNotFoundException('Item does not exist!') from resp
       50│          elif resp.name in (DBUS_SERVICE_UNKNOWN, DBUS_EXEC_FAILED,
       51│                             DBUS_NO_REPLY):
       52│              data = resp.data
       53│              if isinstance(data, tuple):

The following error occurred when trying to handle this error:

  PromptDismissedException

  Prompt dismissed.

  at /usr/lib/python3/dist-packages/secretstorage/collection.py:145 in create_collection
      141│  if len(collection_path) > 1:
      142│      return Collection(connection, collection_path, session=session)
      143│  dismissed, result = exec_prompt(connection, prompt)
      144│  if dismissed:
    → 145│      raise PromptDismissedException('Prompt dismissed.')
      146│  signature, collection_path = result
      147│  assert signature == 'o'
      148│  return Collection(connection, collection_path, session=session)
      149│ 

The following error occurred when trying to handle this error:

  InitError

  Failed to create the collection: Prompt dismissed..

  at /usr/local/lib/python3.10/dist-packages/keyring/backends/SecretService.py:63 in get_preferred_collection
       59│                 collection = secretstorage.Collection(bus, self.preferred_collection)
       60│             else:
       61│                 collection = secretstorage.get_default_collection(bus)
       62│         except exceptions.SecretStorageException as e:
    →  63│             raise InitError("Failed to create the collection: %s." % e)
       64│         if collection.is_locked():
       65│             collection.unlock()
       66│             if collection.is_locked():  # User dismissed the prompt
       67│                 raise KeyringLocked("Failed to unlock the collection!")

(zhenxun-bot-py3.10) root@TimeServer:/home/software/zhenxun/zhenxun_bot-main# 

错误说明

poetry install安装依赖报错,无法安装部分依赖

起初觉得是python版本的问题,更换python3.9.9和pip后发现报错更多了,切换回来还是这些报错 看了部分issue,删除poetry.lock,直接报错Failed to create the collection: Prompt dismissed.. 无法进行依赖安装了

退出虚拟环境的情况下,或者重新部署,也会同样报错

text233 commented 1 year ago

换python3.9.6还是同样报错,基本确定不是python和pip版本的原因

text233 commented 1 year ago

已解决

曲线救国,直接用requiremen.txt来在虚拟环境安装依赖即可 适用于poetry install安装依赖时的报错的情况

先删除poetry的虚拟环境所在的文件夹 ubuntu下为/root/.cache/pypoetry/virtualenvs

把所需要的’requirements.txt‘放入真寻机器人的文件夹 执行poetry shell进入虚拟环境

用pip在虚拟环境下安装依赖pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

等待依赖安装完成即可


关于如何获取的requirements.txt文件

在真寻机器人的文件夹执行poetry show会显示已安装和未安装的依赖以及版本 一个一个添加到requirements.txt即可


下面附上0.1.6.5版本的requirements.txt内容

aiofiles==0.8.0
aiohttp==3.7.4.post0
anyio==3.6.2
apscheduler==3.9.1.post1
async-timeout==3.0.1
asyncpg==0.27.0
attrs==22.1.0
beautifulsoup4==4.9.3
bilireq==0.2.3.post0
black==22.10.0
certifi==2022.9.24
chardet==4.0.0
click==8.1.3
cn2an==0.5.19
commonmark==0.9.1
contourpy==1.0.6
cycler==0.11.0
dateparser==1.1.3
ecdsa==0.18.0
emoji==1.7.0
fastapi==0.79.1
feedparser==6.0.10
fonttools==4.38.0
gino==1.0.1
greenlet==1.1.3
grpcio==1.50.0
h11==0.12.0
httpcore==0.15.0
httptools==0.5.0
httpx==0.23.0
idna==3.4
imagehash==4.3.1
jieba==0.42.1
kiwisolver==1.4.4
loguru==0.6.0
lxml==4.6.5
matplotlib==3.6.2
msgpack==1.0.4
multidict==6.0.2
mypy-extensions==0.4.3
nonebot-adapter-onebot==2.1.5
nonebot-plugin-apscheduler==0.2.0
nonebot2==2.0.0rc1
numpy==1.23.4
opencv-python==4.6.0.66
packaging==21.3
pathspec==0.10.2
pillow==9.3.0
platformdirs==2.5.4
playwright==1.27.1
proces==0.1.3
protobuf==4.21.9
psutil==5.9.4
pyasn1==0.4.8
pydantic==1.9.2
pyee==8.1.0
pygments==2.13.0
pygtrie==2.5.0
pyparsing==3.0.9
pypinyin==0.46.0
python-dateutil==2.8.2
python-dotenv==0.21.0
python-jose==3.3.0
python-multipart==0.0.5
pytz==2022.6
pytz-deprecation-shim==0.1.0.post0
pywavelets==1.4.1
pyyaml==5.4.1
regex==2022.3.2
retrying==1.3.3
rfc3986==1.5.0
rich==12.6.0
rsa==4.9
ruamel-yaml==0.17.21
ruamel-yaml-clib==0.2.7
scipy==1.9.3
setuptools-scm==7.0.5
sgmllib3k==1.0.0
six==1.16.0
sniffio==1.3.0
soupsieve==2.3.2.post1
sqlalchemy==1.3.24
starlette==0.19.1
tomli==2.0.1
tomlkit==0.11.6
typing-extensions==4.4.0
tzdata==2022.6
tzlocal==4.2
ujson==5.5.0
uvicorn== 0.18.3
uvloop==0.17.0
watchfiles==0.18.1
websockets==10.4
wordcloud==1.8.2.2
yarl=1.8.1
Karmau-Git commented 1 year ago

感谢感谢

walle1768 commented 1 year ago

最后一行==