Skip to content

[DEP_ISSUE] issue with sentence-transformers, huggingface_hub => fastembed #558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shiv248 opened this issue Jun 11, 2024 · 8 comments · Fixed by #1133
Closed

[DEP_ISSUE] issue with sentence-transformers, huggingface_hub => fastembed #558

shiv248 opened this issue Jun 11, 2024 · 8 comments · Fixed by #1133
Assignees
Labels
bug Something isn't working

Comments

@shiv248
Copy link

shiv248 commented Jun 11, 2024

Hello!
I have a project for my own llm that uses sentence-transformers and huggingface_hub which have dependency issues with latest version of nemoguardrails.

System:
MacOS Sonoma 14.2.1
conda env
Python 3.10.14
Pip 24.0

at this current time, based on pypi releases latest release is 0.9.0.
when performing:
pip install nemoguardrails==0.9.0 huggingface_hub
or
pip install nemoguardrails==0.9.0 sentence-transformers
I hit issues where the one of Nemo-guardrails dependencies fastembed>=0.2.2 conflicts with both of the stated packages above.

image

since I'm using those packages and latest version of all 3 of them, any way to loosen the package dependencies from pyproject.toml?

@drazvan
Copy link
Collaborator

drazvan commented Jun 14, 2024

@shiv248: I think this is a Conda issue. In a typical venv, the pip install commands you shared work without any issue. We'll try to look into it.

@drazvan drazvan self-assigned this Jun 14, 2024
@drazvan drazvan added the bug Something isn't working label Jun 14, 2024
@shiv248
Copy link
Author

shiv248 commented Jun 14, 2024

@drazvan I have a typical venv just in Python 3.10 through conda, since my default bash is Python 3.12.3 (which causes issues overall in AI/ML dev for me at least) so I can't use Python built in venv module.

here is the entire terminal log for pip install nemoguardrails==0.9.0 huggingface_hub:
I checked if there are any packages already pre-installed as well, and post running the command.

(venv-310) shivgupta@Shivs-MacBook-Pro scratch % pip freeze
(venv-310) shivgupta@Shivs-MacBook-Pro scratch % conda --version
conda 24.4.0
(venv-310) shivgupta@Shivs-MacBook-Pro scratch % python --version
Python 3.10.14
(venv-310) shivgupta@Shivs-MacBook-Pro scratch % pip --version
pip 24.0 from /usr/local/Caskroom/miniconda/base/envs/venv-310/lib/python3.10/site-packages/pip (python 3.10)
(venv-310) shivgupta@Shivs-MacBook-Pro scratch %
(venv-310) shivgupta@Shivs-MacBook-Pro scratch % pip install nemoguardrails==0.9.0 huggingface_hub
Collecting nemoguardrails==0.9.0
  Using cached nemoguardrails-0.9.0-py3-none-any.whl.metadata (21 kB)
Collecting huggingface_hub
  Downloading huggingface_hub-0.23.4-py3-none-any.whl.metadata (12 kB)
Collecting aiohttp>=3.9.2 (from nemoguardrails==0.9.0)
  Using cached aiohttp-3.9.5-cp310-cp310-macosx_10_9_x86_64.whl.metadata (7.5 kB)
Collecting annoy>=1.17.3 (from nemoguardrails==0.9.0)
  Using cached annoy-1.17.3-cp310-cp310-macosx_10_12_x86_64.whl
Collecting fastapi>=0.103.0 (from nemoguardrails==0.9.0)
  Using cached fastapi-0.111.0-py3-none-any.whl.metadata (25 kB)
Collecting fastembed>=0.2.2 (from nemoguardrails==0.9.0)
  Using cached fastembed-0.3.0-py3-none-any.whl.metadata (5.5 kB)
Collecting httpx>=0.24.1 (from nemoguardrails==0.9.0)
  Using cached httpx-0.27.0-py3-none-any.whl.metadata (7.2 kB)
Collecting jinja2>=3.1.3 (from nemoguardrails==0.9.0)
  Using cached jinja2-3.1.4-py3-none-any.whl.metadata (2.6 kB)
Collecting langchain!=0.1.9,<0.2.0,>=0.1.0 (from nemoguardrails==0.9.0)
  Using cached langchain-0.1.20-py3-none-any.whl.metadata (13 kB)
Collecting langchain-core!=0.1.26,>=0.1.0 (from nemoguardrails==0.9.0)
  Downloading langchain_core-0.2.6-py3-none-any.whl.metadata (5.8 kB)
Collecting langchain-community<0.1.0,>=0.0.16 (from nemoguardrails==0.9.0)
  Using cached langchain_community-0.0.38-py3-none-any.whl.metadata (8.7 kB)
Collecting lark~=1.1.7 (from nemoguardrails==0.9.0)
  Using cached lark-1.1.9-py3-none-any.whl.metadata (1.9 kB)
Collecting nest-asyncio>=1.5.6 (from nemoguardrails==0.9.0)
  Using cached nest_asyncio-1.6.0-py3-none-any.whl.metadata (2.8 kB)
Collecting prompt-toolkit>=3.0 (from nemoguardrails==0.9.0)
  Using cached prompt_toolkit-3.0.47-py3-none-any.whl.metadata (6.4 kB)
Collecting pydantic>=1.10 (from nemoguardrails==0.9.0)
  Downloading pydantic-2.7.4-py3-none-any.whl.metadata (109 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 109.4/109.4 kB 1.8 MB/s eta 0:00:00
Collecting pyyaml>=6.0 (from nemoguardrails==0.9.0)
  Using cached PyYAML-6.0.1-cp310-cp310-macosx_10_9_x86_64.whl.metadata (2.1 kB)
Collecting rich>=13.5.2 (from nemoguardrails==0.9.0)
  Using cached rich-13.7.1-py3-none-any.whl.metadata (18 kB)
Collecting simpleeval>=0.9.13 (from nemoguardrails==0.9.0)
  Using cached simpleeval-0.9.13-py2.py3-none-any.whl.metadata (15 kB)
Collecting starlette>=0.27.0 (from nemoguardrails==0.9.0)
  Using cached starlette-0.37.2-py3-none-any.whl.metadata (5.9 kB)
Collecting typer>=0.7.0 (from nemoguardrails==0.9.0)
  Using cached typer-0.12.3-py3-none-any.whl.metadata (15 kB)
Collecting uvicorn>=0.23 (from nemoguardrails==0.9.0)
  Using cached uvicorn-0.30.1-py3-none-any.whl.metadata (6.3 kB)
Collecting watchdog>=3.0.0 (from nemoguardrails==0.9.0)
  Using cached watchdog-4.0.1-cp310-cp310-macosx_10_9_x86_64.whl.metadata (37 kB)
Collecting filelock (from huggingface_hub)
  Downloading filelock-3.15.1-py3-none-any.whl.metadata (2.8 kB)
Collecting fsspec>=2023.5.0 (from huggingface_hub)
  Using cached fsspec-2024.6.0-py3-none-any.whl.metadata (11 kB)
Collecting packaging>=20.9 (from huggingface_hub)
  Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Collecting requests (from huggingface_hub)
  Using cached requests-2.32.3-py3-none-any.whl.metadata (4.6 kB)
Collecting tqdm>=4.42.1 (from huggingface_hub)
  Using cached tqdm-4.66.4-py3-none-any.whl.metadata (57 kB)
Collecting typing-extensions>=3.7.4.3 (from huggingface_hub)
  Using cached typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting aiosignal>=1.1.2 (from aiohttp>=3.9.2->nemoguardrails==0.9.0)
  Using cached aiosignal-1.3.1-py3-none-any.whl.metadata (4.0 kB)
Collecting attrs>=17.3.0 (from aiohttp>=3.9.2->nemoguardrails==0.9.0)
  Using cached attrs-23.2.0-py3-none-any.whl.metadata (9.5 kB)
Collecting frozenlist>=1.1.1 (from aiohttp>=3.9.2->nemoguardrails==0.9.0)
  Using cached frozenlist-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl.metadata (12 kB)
Collecting multidict<7.0,>=4.5 (from aiohttp>=3.9.2->nemoguardrails==0.9.0)
  Using cached multidict-6.0.5-cp310-cp310-macosx_10_9_x86_64.whl.metadata (4.2 kB)
Collecting yarl<2.0,>=1.0 (from aiohttp>=3.9.2->nemoguardrails==0.9.0)
  Using cached yarl-1.9.4-cp310-cp310-macosx_10_9_x86_64.whl.metadata (31 kB)
Collecting async-timeout<5.0,>=4.0 (from aiohttp>=3.9.2->nemoguardrails==0.9.0)
  Using cached async_timeout-4.0.3-py3-none-any.whl.metadata (4.2 kB)
Collecting fastapi-cli>=0.0.2 (from fastapi>=0.103.0->nemoguardrails==0.9.0)
  Using cached fastapi_cli-0.0.4-py3-none-any.whl.metadata (7.0 kB)
Collecting python-multipart>=0.0.7 (from fastapi>=0.103.0->nemoguardrails==0.9.0)
  Using cached python_multipart-0.0.9-py3-none-any.whl.metadata (2.5 kB)
Collecting ujson!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,>=4.0.1 (from fastapi>=0.103.0->nemoguardrails==0.9.0)
  Using cached ujson-5.10.0-cp310-cp310-macosx_10_9_x86_64.whl.metadata (9.3 kB)
Collecting orjson>=3.2.1 (from fastapi>=0.103.0->nemoguardrails==0.9.0)
  Downloading orjson-3.10.5-cp310-cp310-macosx_10_15_x86_64.macosx_11_0_arm64.macosx_10_15_universal2.whl.metadata (49 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.7/49.7 kB 1.4 MB/s eta 0:00:00
Collecting email_validator>=2.0.0 (from fastapi>=0.103.0->nemoguardrails==0.9.0)
  Using cached email_validator-2.1.1-py3-none-any.whl.metadata (26 kB)
Collecting PyStemmer<3.0.0,>=2.2.0 (from fastembed>=0.2.2->nemoguardrails==0.9.0)
  Using cached PyStemmer-2.2.0.1.tar.gz (303 kB)
  Preparing metadata (setup.py) ... done
Collecting loguru<0.8.0,>=0.7.2 (from fastembed>=0.2.2->nemoguardrails==0.9.0)
  Using cached loguru-0.7.2-py3-none-any.whl.metadata (23 kB)
Collecting mmh3<5.0,>=4.0 (from fastembed>=0.2.2->nemoguardrails==0.9.0)
  Using cached mmh3-4.1.0-cp310-cp310-macosx_10_9_x86_64.whl.metadata (13 kB)
Collecting numpy>=1.21 (from fastembed>=0.2.2->nemoguardrails==0.9.0)
  Using cached numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.whl.metadata (61 kB)
Collecting onnx<2.0.0,>=1.15.0 (from fastembed>=0.2.2->nemoguardrails==0.9.0)
  Using cached onnx-1.16.1.tar.gz (12.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
INFO: pip is looking at multiple versions of fastembed to determine which version is compatible with other requirements. This could take a while.
Collecting fastembed>=0.2.2 (from nemoguardrails==0.9.0)
  Using cached fastembed-0.2.7-py3-none-any.whl.metadata (5.3 kB)
Collecting huggingface_hub
  Using cached huggingface_hub-0.20.3-py3-none-any.whl.metadata (12 kB)
Collecting fastembed>=0.2.2 (from nemoguardrails==0.9.0)
  Using cached fastembed-0.2.6-py3-none-any.whl.metadata (4.8 kB)
  Using cached fastembed-0.2.5-py3-none-any.whl.metadata (4.8 kB)
  Using cached fastembed-0.2.4-py3-none-any.whl.metadata (4.8 kB)
  Using cached fastembed-0.2.3-py3-none-any.whl.metadata (4.8 kB)
  Using cached fastembed-0.2.2-py3-none-any.whl.metadata (4.4 kB)
ERROR: Cannot install nemoguardrails because these package versions have conflicting dependencies.

The conflict is caused by:
    fastembed 0.3.0 depends on onnxruntime<2.0.0 and >=1.17.0
    fastembed 0.2.7 depends on onnxruntime<2.0.0 and >=1.17.0
    fastembed 0.2.6 depends on onnxruntime<2.0.0 and >=1.17.0
    fastembed 0.2.5 depends on onnxruntime<2.0.0 and >=1.17.0
    fastembed 0.2.4 depends on onnxruntime<2.0.0 and >=1.17.0
    fastembed 0.2.3 depends on onnxruntime<2.0.0 and >=1.17.0
    fastembed 0.2.2 depends on onnxruntime<2.0.0 and >=1.17.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
(venv-310) shivgupta@Shivs-MacBook-Pro scratch % pip freeze
(venv-310) shivgupta@Shivs-MacBook-Pro scratch % 

@jackkwok
Copy link

I am running into the same issue. Any workaround?

@manikandannp
Copy link

I am also encountering the same issue. Any workaround/ fix

@Pouyanpi
Copy link
Collaborator

@manikandannp are you facing this issue for 0.11.1 versions? If yes, please open a new bug issue and mention this bug there, if not please let us know.

@manikandannp
Copy link

manikandannp commented Feb 14, 2025

@Pouyanpi Thank you for the response. I am facing the issue while trying to upgrade the nemoguardrail to

nemoguardrails==0.8.0 (The one post OpenAI Embedding API fix).
Running this with Python 3.9 image

Image

@Pouyanpi
Copy link
Collaborator

@manikandannp any reason you are not using the latest version (0.11.1)?

@manikandannp
Copy link

manikandannp commented Mar 4, 2025

Hi @Pouyanpi Sorry for the delayed response. Was on business travel. My application requires nemoguardrails==0.8.0 due to other compatibility issues (especially with annoy==1.17.3).

@Pouyanpi Pouyanpi linked a pull request Apr 22, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants