doc2graph
doc2graph copied to clipboard
Pydantic problems with dependency mismatches
I get some conflicts where I can't run the main.py script.
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
spacy 3.3.0 requires pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4, but you have pydantic 2.5.3 which is incompatible.
thinc 8.0.17 requires pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4, but you have pydantic 2.5.3 which is incompatible.
doc2graph 0.2.0b0.post7+git.99ac9e69 requires pydantic==1.8.2, but you have pydantic 2.5.3 which is incompatible.
then if I install pydantic 1.8.2
I get
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
dglgo 0.0.2 requires pydantic>=1.9.0, but you have pydantic 1.8.2 which is incompatible.
and back and forth.
[edit] Here is what I get when I run main.py for set-up.
Traceback (most recent call last):
File "/Users/z1ggy/projects/forma/doc2graph/src/main.py", line 4, in <module>
from src.inference import inference
File "/Users/z1ggy/projects/forma/doc2graph/src/inference.py", line 7, in <module>
from src.data.feature_builder import FeatureBuilder
File "/Users/z1ggy/projects/forma/doc2graph/src/data/feature_builder.py", line 3, in <module>
import spacy
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/spacy/__init__.py", line 14, in <module>
from . import pipeline # noqa: F401
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/spacy/pipeline/__init__.py", line 1, in <module>
from .attributeruler import AttributeRuler
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/spacy/pipeline/attributeruler.py", line 6, in <module>
from .pipe import Pipe
File "spacy/pipeline/pipe.pyx", line 8, in init spacy.pipeline.pipe
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/spacy/training/__init__.py", line 11, in <module>
from .callbacks import create_copy_from_base_model # noqa: F401
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/spacy/training/callbacks.py", line 3, in <module>
from ..language import Language
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/spacy/language.py", line 25, in <module>
from .training.initialize import init_vocab, init_tok2vec
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/spacy/training/initialize.py", line 14, in <module>
from .pretrain import get_tok2vec_ref
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/spacy/training/pretrain.py", line 16, in <module>
from ..schemas import ConfigSchemaPretrain
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/spacy/schemas.py", line 216, in <module>
class TokenPattern(BaseModel):
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/pydantic/main.py", line 299, in __new__
fields[ann_name] = ModelField.infer(
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/pydantic/fields.py", line 411, in infer
return cls(
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/pydantic/fields.py", line 342, in __init__
self.prepare()
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/pydantic/fields.py", line 451, in prepare
self._type_analysis()
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/pydantic/fields.py", line 545, in _type_analysis
self._type_analysis()
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/pydantic/fields.py", line 550, in _type_analysis
if issubclass(origin, Tuple): # type: ignore
File "/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/typing.py", line 852, in __subclasscheck__
return issubclass(cls, self.__origin__)
TypeError: issubclass() arg 1 must be a class
any protips here?
I got the same issue!
comment out spacy in requirements.txt file, then run the command pip install -e .
After that conda install spacy
You might get an error with opencv, in that case
pip uninstall opencv-contrib-python
pip uninstall opencv-python
pip uninstall opencv-python-headless
pip install opencv-python====4.6.0.66
After all, run python src/main.py --init
Sorry for the late answer @0000F8 and thank you @VimukthiRandika1997 for the solution! I will try again in local, solve the conflicts and push the changes! Leaving the issue open for now, closing with next commit!
@andreagemelli Thank you very much!
Still get
Traceback (most recent call last):
File "/Users/z1ggy/projects/forma/doc2graph/src/main.py", line 4, in
Sorry for the late answer @0000F8 and thank you @VimukthiRandika1997 for the solution! I will try again in local, solve the conflicts and push the changes! Leaving the issue open for now, closing with next commit!
Any chance of a timeline?
Tried this:
conda install -c conda-forge spacy conda install -c conda-forge pydantic
ended up here:
/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: dlopen(/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/torchvision/image.so, 0x0006): Symbol not found: (__ZN3c106detail19maybe_wrap_dim_slowExxb)
Referenced from: '/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/torchvision/image.so'
Expected in: '/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/torch/lib/libc10.dylib'
warn(f"Failed to load image Python extension: {e}")
DGL backend not selected or invalid. Assuming PyTorch for now.
Setting the default backend to "pytorch". You can change it in the ~/.dgl/config.json file or export the DGLBACKEND environment variable. Valid options are: pytorch, mxnet, tensorflow (all lowercase)
Traceback (most recent call last):
File "/Users/z1ggy/projects/forma/doc2graph/src/main.py", line 4, in
Performed conda install pytorch
finally got to here:
(doc2graph) ➜ doc2graph git:(master) ✗ python src/main.py --init /Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: dlopen(/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/torchvision/image.so, 0x0006): Symbol not found: (__ZN2at4_ops19empty_memory_format4callEN3c108ArrayRefIxEENS2_8optionalINS2_10ScalarTypeEEENS5_INS2_6LayoutEEENS5_INS2_6DeviceEEENS5_IbEENS5_INS2_12MemoryFormatEEE) Referenced from: '/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/torchvision/image.so' Expected in: '/Users/z1ggy/anaconda3/envs/doc2graph/lib/python3.9/site-packages/torch/lib/libtorch_cpu.dylib' warn(f"Failed to load image Python extension: {e}") Namespace(init=True, add_geom=False, add_embs=False, add_hist=False, add_visual=False, add_eweights=False, src_data='FUNSD', data_type='img', edge_type='fully', node_granularity='gt', num_polar_bins=8, model='e2e', gpu=-1, test=False, weights=None, inference=False, docs=None) Downloading FUNSD 100% [..............................................................................] 36590 / 36590Downloading PAU 100% [................................................................................] 7264 / 7264Initialization completed!