SapienzaNLP / relik

Retrieve, Read and LinK: Fast and Accurate Entity Linking and Relation Extraction on an Academic Budget (ACL 2024)
284 stars 14 forks source link

On relik import, OverflowError: Python int too large to convert to C long #14

Closed stevereiner closed 1 week ago

stevereiner commented 1 week ago

After pip install relik in a virtual env

With just from relik import Relik or import relik Get OverflowError: Python int too large to convert to C long

python 3.12.6 Windows11

stevereiner commented 1 week ago

worked on ubuntu 22.04 with virt env python 3.10.12

on ubuntu non virt env python 3.12.4 error can't import name _imaging onnx config File "/home/steve/.local/lib/python3.12/site-packages/transformers/onnx/config.py", line 36, in from PIL import Image File "/usr/lib/python3/dist-packages/PIL/Image.py", line 89, in from . import _imaging as core ImportError: cannot import name '_imaging' from 'PIL' (/usr/lib/python3/dist-packages/PIL/init.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/steve/newdev/relik/test.py", line 2, in from relik import Relik File "/home/steve/.local/lib/python3.12/site-packages/relik/init.py", line 1, in from relik.inference.annotator import Relik File "/home/steve/.local/lib/python3.12/site-packages/relik/inference/annotator.py", line 16, in from relik.inference.data.objects import ( File "/home/steve/.local/lib/python3.12/site-packages/relik/inference/data/objects.py", line 8, in from relik.retriever.indexers.document import Document File "/home/steve/.local/lib/python3.12/site-packages/relik/retriever/init.py", line 1, in from relik.retriever.pytorch_modules.model import GoldenRetriever File "/home/steve/.local/lib/python3.12/site-packages/relik/retriever/pytorch_modules/model.py", line 28, in from relik.retriever.pytorch_modules.hf import GoldenRetrieverModel File "/home/steve/.local/lib/python3.12/site-packages/relik/retriever/pytorch_modules/hf.py", line 6, in from transformers.models.bert.modeling_bert import BertModel File "/home/steve/.local/lib/python3.12/site-packages/transformers/models/bert/modeling_bert.py", line 57, in from .configuration_bert import BertConfig File "/home/steve/.local/lib/python3.12/site-packages/transformers/models/bert/configuration_bert.py", line 21, in from ...onnx import OnnxConfig File "", line 1412, in _handle_fromlist File "/home/steve/.local/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 1525, in getattr module = self._get_module(self._class_to_module[name]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/steve/.local/lib/python3.12/site-packages/transformers/utils/import_utils.py", line 1537, in _get_module raise RuntimeError( RuntimeError: Failed to import transformers.onnx.config because of the following error (look up to see its traceback): cannot import name '_imaging' from 'PIL' (/usr/lib/python3/dist-packages/PIL/init.py)

Riccorl commented 1 week ago

Hi! Thanks for reporting the issue! It appears to be related to Python 3.12, as seen in similar issues on StackOverflow. Specifically, the problem seems to involve the wandb module. I recommend using Python 3.11 until the dependencies are updated.

We will enforce the Python version to be lower than 3.12 for the next releases until the issue is fixed.