Closed cjdxhjj closed 4 months ago
For the issue with installing onnxruntime
using Poetry in Dify version 0.6.12, here are a few steps you can try:
Check Python Version: Ensure you are using Python 3.10, as recommended for Dify version 0.6.12.
poetry env use 3.10
Update Poetry: Make sure you are using the latest version of Poetry.
poetry self update
Add onnxruntime Manually: Sometimes, adding the package manually can help resolve the issue.
poetry add onnxruntime==1.18.0
Check System Requirements: Ensure your system meets the requirements for onnxruntime
. This package may have specific dependencies or system requirements that need to be met.
Use a Different Source: If the default source is not providing the package, you can try using a different source or mirror.
poetry config repositories.testpypi https://test.pypi.org/simple/
poetry add --source testpypi onnxruntime==1.18.0
Installation FAQ: Refer to the installation FAQ for common issues and troubleshooting steps [1].
If these steps do not resolve the issue, you may want to check the Dify community discussions for any similar issues or additional support [2].
To continue talking to Dosu, mention @dosu.
can't run the api project when i try to add pydantic_settings, poetry report it already installed the poetry show result is
Please change that package in poetry.lock
to 1.16.3
. It should resolve your problem.
the issure has not resolved [root@dify02 api]# /usr/local/python-3.10/bin/python3 -m venv .venv [root@dify02 api]# source .venv/bin/activate (.venv) [root@dify02 api]# pip install poetry Collecting poetry Using cached poetry-1.8.3-py3-none-any.whl (249 kB) Collecting trove-classifiers>=2022.5.19 Using cached trove_classifiers-2024.7.2-py3-none-any.whl (13 kB) Collecting virtualenv<21.0.0,>=20.23.0 Using cached virtualenv-20.26.3-py3-none-any.whl (5.7 MB) Collecting platformdirs<5,>=3.0.0 Using cached platformdirs-4.2.2-py3-none-any.whl (18 kB) Collecting crashtest<0.5.0,>=0.4.1 Using cached crashtest-0.4.1-py3-none-any.whl (7.6 kB) Collecting dulwich<0.22.0,>=0.21.2 Using cached dulwich-0.21.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (514 kB) Collecting cleo<3.0.0,>=2.1.0 Using cached cleo-2.1.0-py3-none-any.whl (78 kB) Collecting pyproject-hooks<2.0.0,>=1.0.0 Using cached pyproject_hooks-1.1.0-py3-none-any.whl (9.2 kB) Collecting keyring<25.0.0,>=24.0.0 Using cached keyring-24.3.1-py3-none-any.whl (38 kB) Collecting shellingham<2.0,>=1.5 Using cached shellingham-1.5.4-py2.py3-none-any.whl (9.8 kB) Collecting pkginfo<2.0,>=1.10 Using cached pkginfo-1.11.1-py3-none-any.whl (31 kB) Collecting poetry-plugin-export<2.0.0,>=1.6.0 Using cached poetry_plugin_export-1.8.0-py3-none-any.whl (10 kB) Collecting requests<3.0,>=2.26 Using cached requests-2.32.3-py3-none-any.whl (64 kB) Collecting tomlkit<1.0.0,>=0.11.4 Using cached tomlkit-0.12.5-py3-none-any.whl (37 kB) Collecting installer<0.8.0,>=0.7.0 Using cached installer-0.7.0-py3-none-any.whl (453 kB) Collecting build<2.0.0,>=1.0.3 Using cached build-1.2.1-py3-none-any.whl (21 kB) Collecting packaging>=23.1 Using cached packaging-24.1-py3-none-any.whl (53 kB) Collecting tomli<3.0.0,>=2.0.1 Using cached tomli-2.0.1-py3-none-any.whl (12 kB) Collecting requests-toolbelt<2.0.0,>=1.0.0 Using cached requests_toolbelt-1.0.0-py2.py3-none-any.whl (54 kB) Collecting poetry-core==1.9.0 Using cached poetry_core-1.9.0-py3-none-any.whl (309 kB) Collecting fastjsonschema<3.0.0,>=2.18.0 Using cached fastjsonschema-2.20.0-py3-none-any.whl (23 kB) Collecting pexpect<5.0.0,>=4.7.0 Using cached pexpect-4.9.0-py2.py3-none-any.whl (63 kB) Collecting cachecontrol[filecache]<0.15.0,>=0.14.0 Using cached cachecontrol-0.14.0-py3-none-any.whl (22 kB) Collecting msgpack<2.0.0,>=0.5.2 Using cached msgpack-1.0.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (385 kB) Collecting filelock>=3.8.0 Using cached filelock-3.15.4-py3-none-any.whl (16 kB) Collecting rapidfuzz<4.0.0,>=3.0.0 Using cached rapidfuzz-3.9.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.4 MB) Collecting urllib3>=1.25 Using cached urllib3-2.2.2-py3-none-any.whl (121 kB) Collecting importlib-metadata>=4.11.4 Using cached importlib_metadata-8.0.0-py3-none-any.whl (24 kB) Collecting jaraco.classes Using cached jaraco.classes-3.4.0-py3-none-any.whl (6.8 kB) Collecting jeepney>=0.4.2 Using cached jeepney-0.8.0-py3-none-any.whl (48 kB) Collecting SecretStorage>=3.2 Using cached SecretStorage-3.3.3-py3-none-any.whl (15 kB) Collecting ptyprocess>=0.5 Using cached ptyprocess-0.7.0-py2.py3-none-any.whl (13 kB) Collecting idna<4,>=2.5 Using cached idna-3.7-py3-none-any.whl (66 kB) Collecting certifi>=2017.4.17 Using cached certifi-2024.6.2-py3-none-any.whl (164 kB) Collecting charset-normalizer<4,>=2 Using cached charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (142 kB) Collecting distlib<1,>=0.3.7 Using cached distlib-0.3.8-py2.py3-none-any.whl (468 kB) Collecting zipp>=0.5 Using cached zipp-3.19.2-py3-none-any.whl (9.0 kB) Collecting cryptography>=2.0 Using cached cryptography-42.0.8-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.8 MB) Collecting more-itertools Using cached more_itertools-10.3.0-py3-none-any.whl (59 kB) Collecting cffi>=1.12 Using cached cffi-1.16.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (443 kB) Collecting pycparser Using cached pycparser-2.22-py3-none-any.whl (117 kB) Installing collected packages: trove-classifiers, ptyprocess, fastjsonschema, distlib, zipp, urllib3, tomlkit, tomli, shellingham, rapidfuzz, pyproject-hooks, pycparser, poetry-core, platformdirs, pkginfo, pexpect, packaging, msgpack, more-itertools, jeepney, installer, idna, filelock, crashtest, charset-normalizer, certifi, virtualenv, requests, jaraco.classes, importlib-metadata, dulwich, cleo, cffi, build, requests-toolbelt, cryptography, cachecontrol, SecretStorage, keyring, poetry-plugin-export, poetry Successfully installed SecretStorage-3.3.3 build-1.2.1 cachecontrol-0.14.0 certifi-2024.6.2 cffi-1.16.0 charset-normalizer-3.3.2 cleo-2.1.0 crashtest-0.4.1 cryptography-42.0.8 distlib-0.3.8 dulwich-0.21.7 fastjsonschema-2.20.0 filelock-3.15.4 idna-3.7 importlib-metadata-8.0.0 installer-0.7.0 jaraco.classes-3.4.0 jeepney-0.8.0 keyring-24.3.1 more-itertools-10.3.0 msgpack-1.0.8 packaging-24.1 pexpect-4.9.0 pkginfo-1.11.1 platformdirs-4.2.2 poetry-1.8.3 poetry-core-1.9.0 poetry-plugin-export-1.8.0 ptyprocess-0.7.0 pycparser-2.22 pyproject-hooks-1.1.0 rapidfuzz-3.9.4 requests-2.32.3 requests-toolbelt-1.0.0 shellingham-1.5.4 tomli-2.0.1 tomlkit-0.12.5 trove-classifiers-2024.7.2 urllib3-2.2.2 virtualenv-20.26.3 zipp-3.19.2
[notice] A new release of pip is available: 23.0.1 -> 24.1.1 [notice] To update, run: pip install --upgrade pip (.venv) [root@dify02 api]# poetry install Installing dependencies from lock file
Package operations: 301 installs, 7 updates, 0 removals
Installing onnxruntime (1.18.0): Failed
RuntimeError
Unable to find installation candidates for onnxruntime (1.18.0)
at .venv/lib/python3.10/site-packages/poetry/installation/chooser.py:74 in choose_for
Installing onnxruntime (1.18.0): Failed
RuntimeError
Unable to find installation candidates for onnxruntime (1.18.0)
at .venv/lib/python3.10/site-packages/poetry/installation/chooser.py:74 in choose_for
Installing onnxruntime (1.18.0): Failed
RuntimeError
Unable to find installation candidates for onnxruntime (1.18.0)
at .venv/lib/python3.10/site-packages/poetry/installation/chooser.py:74 in choose_for 70│ 71│ links.append(link) 72│ 73│ if not links: → 74│ raise RuntimeError(f"Unable to find installation candidates for {package}") 75│ 76│ # Get the best link 77│ chosen = max(links, key=lambda link: self._sort_key(package, link)) 78│
Cannot install onnxruntime.
Installing onnxruntime (1.18.0): Failed
RuntimeError
Unable to find installation candidates for onnxruntime (1.18.0)
at .venv/lib/python3.10/site-packages/poetry/installation/chooser.py:74 in choose_for 70│ 71│ links.append(link) 72│ 73│ if not links: → 74│ raise RuntimeError(f"Unable to find installation candidates for {package}") 75│ 76│ # Get the best link 77│ chosen = max(links, key=lambda link: self._sort_key(package, link)) 78│
Cannot install onnxruntime.
Installing onnxruntime (1.18.0): Failed
RuntimeError
Unable to find installation candidates for onnxruntime (1.18.0)
at .venv/lib/python3.10/site-packages/poetry/installation/chooser.py:74 in choose_for 70│ 71│ links.append(link) 72│ 73│ if not links: → 74│ raise RuntimeError(f"Unable to find installation candidates for {package}") 75│ 76│ # Get the best link 77│ chosen = max(links, key=lambda link: self._sort_key(package, link)) 78│
Cannot install onnxruntime.
Installing onnxruntime (1.18.0): Failed
RuntimeError
Unable to find installation candidates for onnxruntime (1.18.0)
at .venv/lib/python3.10/site-packages/poetry/installation/chooser.py:74 in choose_for 70│ 71│ links.append(link) 72│ 73│ if not links: → 74│ raise RuntimeError(f"Unable to find installation candidates for {package}") 75│ 76│ # Get the best link 77│ chosen = max(links, key=lambda link: self._sort_key(package, link)) 78│
Cannot install onnxruntime.
Installing onnxruntime (1.18.0): Failed
RuntimeError
Unable to find installation candidates for onnxruntime (1.18.0)
at .venv/lib/python3.10/site-packages/poetry/installation/chooser.py:74 in choose_for 70│ 71│ links.append(link) 72│ 73│ if not links: → 74│ raise RuntimeError(f"Unable to find installation candidates for {package}") 75│ 76│ # Get the best link 77│ chosen = max(links, key=lambda link: self._sort_key(package, link)) 78│
Cannot install onnxruntime.
Installing onnxruntime (1.18.0): Failed
RuntimeError
Unable to find installation candidates for onnxruntime (1.18.0)
at .venv/lib/python3.10/site-packages/poetry/installation/chooser.py:74 in choose_for 70│ 71│ links.append(link) 72│ 73│ if not links: → 74│ raise RuntimeError(f"Unable to find installation candidates for {package}") 75│ 76│ # Get the best link 77│ chosen = max(links, key=lambda link: self._sort_key(package, link)) 78│
Cannot install onnxruntime.
Installing onnxruntime (1.18.0): Failed
RuntimeError
Unable to find installation candidates for onnxruntime (1.18.0)
at .venv/lib/python3.10/site-packages/poetry/installation/chooser.py:74 in choose_for 70│ 71│ links.append(link) 72│ 73│ if not links: → 74│ raise RuntimeError(f"Unable to find installation candidates for {package}") 75│ 76│ # Get the best link 77│ chosen = max(links, key=lambda link: self._sort_key(package, link)) 78│
Cannot install onnxruntime.
Error: While importing 'app', an ImportError was raised:
Traceback (most recent call last):
File "/data0/temp/dify/api/.venv/lib/python3.10/site-packages/flask/cli.py", line 245, in locate_app
import(module_name)
File "/data0/temp/dify/api/app.py", line 3, in
(.venv) [root@dify02 api]# poetry add pydantic_settings The following packages are already present in the pyproject.toml and will be skipped:
If you want to update it to the latest compatible version, you can use poetry update package
.
If you prefer to upgrade it to the latest available version, you can use poetry add package@latest
.
Nothing to add. (.venv) [root@dify02 api]#
@crazywoola
i use the poetry add onnxruntime==1.16.3 it works
Self Checks
Dify version
0.6.12
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
clone the source and install deps
✔️ Expected Behavior
No response
❌ Actual Behavior