nleguillarme / taxonerd

TaxoNERD : recognizing taxonomic entities using deep models
MIT License
39 stars 8 forks source link

Error with gbif_backbone: TypeError: unsupported operand type(s) for |: 'type' and '_GenericAlias' #24

Closed lubianat closed 2 months ago

lubianat commented 7 months ago

Hello! I am trying to run TaxoNERD (from command line, Ubuntu 22)

I am getting this error:

(schwann_taxa_venv) (base) ➜  schwann_taxa  taxonerd ask -m en_core_eco_md -f Microscopical_Researches.txt -l gbif_backbone -o ann
Your CPU supports instructions that this binary was not compiled to use: SSE3 SSE4.1 SSE4.2 AVX AVX2
For maximum performance, you can install NMSLIB from sources 
pip install --no-binary :all: nmslib
Traceback (most recent call last):
  File "/home/lubianat/Documents/lab_related/schwann_taxa/schwann_taxa_venv/bin/taxonerd", line 8, in <module>
    sys.exit(main())
  File "/home/lubianat/Documents/lab_related/schwann_taxa/schwann_taxa_venv/lib/python3.9/site-packages/taxonerd/cli.py", line 111, in main
    cli()
  File "/home/lubianat/Documents/lab_related/schwann_taxa/schwann_taxa_venv/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/lubianat/Documents/lab_related/schwann_taxa/schwann_taxa_venv/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/lubianat/Documents/lab_related/schwann_taxa/schwann_taxa_venv/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/lubianat/Documents/lab_related/schwann_taxa/schwann_taxa_venv/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/lubianat/Documents/lab_related/schwann_taxa/schwann_taxa_venv/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/lubianat/Documents/lab_related/schwann_taxa/schwann_taxa_venv/lib/python3.9/site-packages/taxonerd/cli.py", line 84, in ask
    nerd.load(ner_model, exclude=exclude, linker=link_to, threshold=thresh)
  File "/home/lubianat/Documents/lab_related/schwann_taxa/schwann_taxa_venv/lib/python3.9/site-packages/taxonerd/taxonerd.py", line 67, in load
    from taxonerd.linking.candidate_generation import CandidateGenerator
  File "/home/lubianat/Documents/lab_related/schwann_taxa/schwann_taxa_venv/lib/python3.9/site-packages/taxonerd/linking/candidate_generation.py", line 21, in <module>
    class LinkerPaths(NamedTuple):
  File "/home/lubianat/Documents/lab_related/schwann_taxa/schwann_taxa_venv/lib/python3.9/site-packages/taxonerd/linking/candidate_generation.py", line 34, in LinkerPaths
    ann_index: str | Tuple[str, str]
TypeError: unsupported operand type(s) for |: 'type' and '_GenericAlias'

ChatGPT tells me this error has to do with Python version and this is a syntax issue. StackOverflow seems to indicate the same (https://stackoverflow.com/questions/76712720/typeerror-unsupported-operand-types-for-type-and-nonetype)

Have you encountered that recently? The package was supposed to be compatible with Python 3.9, from the README, right?

lubianat commented 7 months ago

(thanks for the work, btw)

lubianat commented 7 months ago

Same happens with taxref and ncbi_taxonomy by the way.

nleguillarme commented 6 months ago

Hi @lubianat, thank you for using TaxoNERD. You are right, the problem seems to be linked to the use of python 3.9. Is it possible for you to switch to python 3.10 ? I'll try to take some time to update TaxoNERD, and clean up the README at the same time.

lubianat commented 6 months ago

@nleguillarme As I was just running a prototype, I gave up on entity linking for the moment. If I get funded, I will switch to Python 3.10 to run it, no worries.

Thanks for the tool again!