Skip to content
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

[Bug] Numpy not available following install instructions #606

Open
yuma-dev opened this issue Jun 18, 2024 · 6 comments
Open

[Bug] Numpy not available following install instructions #606

yuma-dev opened this issue Jun 18, 2024 · 6 comments

Comments

@yuma-dev
Copy link

yuma-dev commented Jun 18, 2024

Describe the bug

after following the install instructions 1 to 1 i get this error:

Expected behavior

devika runs

Screenshots and logs

(devika) PS C:\Users\Fabia\Documents\devika> py devika.py
24.06.18 02:15:35: root: INFO   : Initializing Devika...
24.06.18 02:15:35: root: INFO   : checking configurations...
24.06.18 02:15:35: root: INFO   : Initializing Prerequisites Jobs...

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "C:\Users\Fabia\Documents\devika\devika.py", line 8, in <module>
    init_devika()
  File "C:\Users\Fabia\Documents\devika\src\init.py", line 27, in init_devika
    from src.bert.sentence import SentenceBert
  File "C:\Users\Fabia\Documents\devika\src\bert\sentence.py", line 1, in <module>
    from keybert import KeyBERT
  File "C:\Users\Fabia\Documents\devika\.venv\Lib\site-packages\keybert\__init__.py", line 3, in <module>
    from keybert._llm import KeyLLM
  File "C:\Users\Fabia\Documents\devika\.venv\Lib\site-packages\keybert\_llm.py", line 4, in <module>
    from sentence_transformers import util
  File "C:\Users\Fabia\Documents\devika\.venv\Lib\site-packages\sentence_transformers\__init__.py", line 15, in <module>
    from sentence_transformers.trainer import SentenceTransformerTrainer
  File "C:\Users\Fabia\Documents\devika\.venv\Lib\site-packages\sentence_transformers\trainer.py", line 10, in <module>
    from transformers import EvalPrediction, PreTrainedTokenizerBase, Trainer, TrainerCallback
  File "C:\Users\Fabia\Documents\devika\.venv\Lib\site-packages\transformers\utils\import_utils.py", line 1525, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "C:\Users\Fabia\Documents\devika\.venv\Lib\site-packages\transformers\utils\import_utils.py", line 1535, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "C:\Python312\Lib\importlib\__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\Fabia\Documents\devika\.venv\Lib\site-packages\transformers\trainer.py", line 71, in <module>
    from .optimization import Adafactor, get_scheduler
  File "C:\Users\Fabia\Documents\devika\.venv\Lib\site-packages\transformers\optimization.py", line 27, in <module>
    from .trainer_pt_utils import LayerWiseDummyOptimizer, LayerWiseDummyScheduler
  File "C:\Users\Fabia\Documents\devika\.venv\Lib\site-packages\transformers\trainer_pt_utils.py", line 235, in <module>
    device: Optional[torch.device] = torch.device("cuda"),
C:\Users\Fabia\Documents\devika\.venv\Lib\site-packages\transformers\trainer_pt_utils.py:235: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:84.)
  device: Optional[torch.device] = torch.device("cuda"),
24.06.18 02:15:40: root: INFO   : Loading sentence-transformer BERT models...
Traceback (most recent call last):
  File "C:\Users\Fabia\Documents\devika\devika.py", line 8, in <module>
    init_devika()
  File "C:\Users\Fabia\Documents\devika\src\init.py", line 31, in init_devika
    SentenceBert(prompt).extract_keywords()
  File "C:\Users\Fabia\Documents\devika\src\bert\sentence.py", line 9, in extract_keywords
    keywords = self.kw_model.extract_keywords(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Fabia\Documents\devika\.venv\Lib\site-packages\keybert\_model.py", line 195, in extract_keywords
    doc_embeddings = self.model.embed(docs)
                     ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Fabia\Documents\devika\.venv\Lib\site-packages\keybert\backend\_sentencetransformers.py", line 67, in embed
    embeddings = self.embedding_model.encode(documents, **self.encode_kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Fabia\Documents\devika\.venv\Lib\site-packages\sentence_transformers\SentenceTransformer.py", line 568, in encode
    all_embeddings = np.asarray([emb.numpy() for emb in all_embeddings])
                                 ^^^^^^^^^^^
RuntimeError: Numpy is not available

Configuration

- OS: Windows
- Python version: Python 3.12.2
- Node version: 10.2.4
- bun version: 1.1.13
- search engine: x
- Model: x
@AVcorp
Copy link

AVcorp commented Jun 18, 2024

Arrived here from Google search, have exact same issue with ComfyUI fresh install. If same error occurs in two different repos, can it be package related?

upd: fixed the issue by deleteing current numpy 2.0.0 and installing correct version 1.25.2

@MahmoudZaki1
Copy link

have a look on my comment here if might help and confirm

#603 (comment)

Arrived here from Google search, have exact same issue with ComfyUI fresh install. If same error occurs in two different repos, can it be package related?

upd: fixed the issue by deleteing current numpy 2.0.0 and installing correct version 1.25.2

@colpiche
Copy link

Arrived here from Google search, have exact same issue with ComfyUI fresh install. If same error occurs in two different repos, can it be package related?

upd: fixed the issue by deleteing current numpy 2.0.0 and installing correct version 1.25.2

Had the same bug and this solution worked for me with a uv pip install --force-reinstall -v "numpy==1.25.2"

@edition08
Copy link

Arrived here from Google search, have exact same issue with ComfyUI fresh install. If same error occurs in two different repos, can it be package related?
upd: fixed the issue by deleteing current numpy 2.0.0 and installing correct version 1.25.2

Had the same bug and this solution worked for me with a uv pip install --force-reinstall -v "numpy==1.25.2"

Thank you , thats fixed it !!!

@engmsaleh
Copy link

On trying this I got the following issue

error: Failed to prepare distributions
  Caused by: Failed to fetch wheel: numpy==1.25.2
  Caused by: Failed to build: `numpy==1.25.2`
  Caused by: Build backend failed to determine extra requires with `build_wheel()` with exit status: 1
--- stdout:

--- stderr:
Traceback (most recent call last):
  File "<string>", line 8, in <module>
  File "/Users/zayed/Library/Caches/uv/environments-v0/.tmpor9HWi/lib/python3.12/site-packages/setuptools/__init__.py", line 10, in <module>
    import distutils.core
ModuleNotFoundError: No module named 'distutils'
---

@engmsaleh
Copy link

It was an issue with python version, I have downgraded to 3.11 and it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants