GEM-benchmark / GEM-metrics

Automatic metrics for GEM tasks
https://gem-benchmark.com
MIT License
61 stars 20 forks source link

Installation errors -- Cython and Questeval #104

Closed ashleylew closed 1 year ago

ashleylew commented 1 year ago

When installing GEM-metrics and running this command:

pip install -r requirements.txt -r requirements-heavy.txt

I run into the following error:

Collecting moverscore@ git+https://github.com/AIPHES/emnlp19-moverscore.git@b9d4144 (from -r requirements-heavy.txt (line 3))
  Cloning https://github.com/AIPHES/emnlp19-moverscore.git (to revision b9d4144) to /tmp/pip-install-bd7eqreb/moverscore_3a90ae24901c4f03a4588ab7fbcf6988
  Running command git clone --filter=blob:none --quiet https://github.com/AIPHES/emnlp19-moverscore.git /tmp/pip-install-bd7eqreb/moverscore_3a90ae24901c4f03a4588ab7fbcf6988
  WARNING: Did not find branch or tag 'b9d4144', assuming revision or ref.
  Running command git checkout -q b9d4144
  Resolved https://github.com/AIPHES/emnlp19-moverscore.git to commit b9d4144
  Preparing metadata (setup.py) ...done
Collecting datasets>=1.2.1 (from -r requirements.txt (line 1))
  Obtaining dependency information for datasets>=1.2.1 from https://files.pythonhosted.org/packages/09/7e/fd4d6441a541dba61d0acb3c1fd5df53214c2e9033854e837a99dd9e0793/datasets-2.14.5-py3-none-any.whl.metadata
  Using cached datasets-2.14.5-py3-none-any.whl.metadata (19 kB)
Collecting diskcache>=5.2.1 (from -r requirements.txt (line 2))
  Obtaining dependency information for diskcache>=5.2.1 from https://files.pythonhosted.org/packages/3f/27/4570e78fc0bf5ea0ca45eb1de3818a23787af9b390c0b0a0033a1b8236f9/diskcache-5.6.3-py3-none-any.whl.metadata
  Using cached diskcache-5.6.3-py3-none-any.whl.metadata (20 kB)
Collecting nltk (from -r requirements.txt (line 3))
  Using cached nltk-3.8.1-py3-none-any.whl (1.5 MB)
Collecting numpy (from -r requirements.txt (line 4))
  Obtaining dependency information for numpy from https://files.pythonhosted.org/packages/c4/36/161e2f8110f8c49e59f6107bd6da4257d30aff9f06373d0471811f73dcc5/numpy-1.26.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
  Using cached numpy-1.26.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (58 kB)
Collecting rouge-score (from -r requirements.txt (line 5))
  Using cached rouge_score-0.1.2-py3-none-any.whl
Collecting logzero (from -r requirements.txt (line 6))
  Using cached logzero-1.7.0-py2.py3-none-any.whl (16 kB)
Collecting pycountry (from -r requirements.txt (line 7))
  Using cached pycountry-22.3.5-py2.py3-none-any.whl
Collecting repro==0.1.4 (from -r requirements.txt (line 8))
  Using cached repro-0.1.4-py3-none-any.whl (639 kB)
Collecting sacrebleu>=2.0.0 (from -r requirements.txt (line 9))
  Using cached sacrebleu-2.3.1-py3-none-any.whl (118 kB)
Collecting sacremoses (from -r requirements.txt (line 10))
  Using cached sacremoses-0.0.53-py3-none-any.whl
Collecting bert_score (from -r requirements-heavy.txt (line 1))
  Using cached bert_score-0.3.13-py3-none-any.whl (61 kB)
Collecting questeval==0.2.4 (from -r requirements-heavy.txt (line 2))
  Using cached questeval-0.2.4.tar.gz (25 kB)
  Preparing metadata (setup.py) ...done
Collecting pyemd (from -r requirements-heavy.txt (line 4))
  Using cached pyemd-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (666 kB)
Collecting docker==5.0.0 (from repro==0.1.4->-r requirements.txt (line 8))
  Using cached docker-5.0.0-py2.py3-none-any.whl (146 kB)
Collecting overrides==3.1.0 (from repro==0.1.4->-r requirements.txt (line 8))
  Using cached overrides-3.1.0-py3-none-any.whl
Collecting pytest==6.2.4 (from repro==0.1.4->-r requirements.txt (line 8))
  Using cached pytest-6.2.4-py3-none-any.whl (280 kB)
Collecting six==1.16.0 (from repro==0.1.4->-r requirements.txt (line 8))
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting transformers==4.8.1 (from questeval==0.2.4->-r requirements-heavy.txt (line 2))
  Using cached transformers-4.8.1-py3-none-any.whl (2.5 MB)
Collecting sentencepiece==0.1.95 (from questeval==0.2.4->-r requirements-heavy.txt (line 2))
  Using cached sentencepiece-0.1.95.tar.gz (508 kB)
  Preparing metadata (setup.py) ...done
Collecting datasets>=1.2.1 (from -r requirements.txt (line 1))
  Using cached datasets-1.7.0-py3-none-any.whl (234 kB)
Collecting bert_score (from -r requirements-heavy.txt (line 1))
  Using cached bert_score-0.3.9-py3-none-any.whl (59 kB)
Collecting Unidecode==1.2.0 (from questeval==0.2.4->-r requirements-heavy.txt (line 2))
  Using cached Unidecode-1.2.0-py2.py3-none-any.whl (241 kB)
Collecting spacy==3.0.6 (from questeval==0.2.4->-r requirements-heavy.txt (line 2))
  Using cached spacy-3.0.6.tar.gz (7.1 MB)
  Installing build dependencies ...done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [167 lines of output]

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          int length

      cdef class Vocab:
          cdef Pool mem
          cpdef readonly StringStore strings
                ^
      ------------------------------------------------------------

      spacy/vocab.pxd:28:10: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

      cdef class Vocab:
          cdef Pool mem
          cpdef readonly StringStore strings
          cpdef public Morphology morphology
                ^
      ------------------------------------------------------------

      spacy/vocab.pxd:29:10: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

      cdef class Vocab:
          cdef Pool mem
          cpdef readonly StringStore strings
          cpdef public Morphology morphology
          cpdef public object vectors
                ^
      ------------------------------------------------------------

      spacy/vocab.pxd:30:10: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      cdef class Vocab:
          cdef Pool mem
          cpdef readonly StringStore strings
          cpdef public Morphology morphology
          cpdef public object vectors
          cpdef public object _lookups
                ^
      ------------------------------------------------------------

      spacy/vocab.pxd:31:10: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef Pool mem
          cpdef readonly StringStore strings
          cpdef public Morphology morphology
          cpdef public object vectors
          cpdef public object _lookups
          cpdef public object writing_system
                ^
      ------------------------------------------------------------

      spacy/vocab.pxd:32:10: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cpdef readonly StringStore strings
          cpdef public Morphology morphology
          cpdef public object vectors
          cpdef public object _lookups
          cpdef public object writing_system
          cpdef public object get_noun_chunks
                ^
      ------------------------------------------------------------

      spacy/vocab.pxd:33:10: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef float prior_prob

      cdef class KnowledgeBase:
          cdef Pool mem
          cpdef readonly Vocab vocab
                ^
      ------------------------------------------------------------

      spacy/kb.pxd:31:10: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.
      Copied /tmp/pip-install-bd7eqreb/spacy_931479f3684d4722903c62eb45cd7226/setup.cfg -> /tmp/pip-install-bd7eqreb/spacy_931479f3684d4722903c62eb45cd7226/spacy/tests/package
      Copied /tmp/pip-install-bd7eqreb/spacy_931479f3684d4722903c62eb45cd7226/pyproject.toml -> /tmp/pip-install-bd7eqreb/spacy_931479f3684d4722903c62eb45cd7226/spacy/tests/package
      Cythonizing sources
      Compiling spacy/training/example.pyx because it changed.
      Compiling spacy/parts_of_speech.pyx because it changed.
      Compiling spacy/strings.pyx because it changed.
      Compiling spacy/lexeme.pyx because it changed.
      Compiling spacy/vocab.pyx because it changed.
      Compiling spacy/attrs.pyx because it changed.
      Compiling spacy/kb.pyx because it changed.
      Compiling spacy/ml/parser_model.pyx because it changed.
      Compiling spacy/morphology.pyx because it changed.
      Compiling spacy/pipeline/dep_parser.pyx because it changed.
      Compiling spacy/pipeline/morphologizer.pyx because it changed.
      Compiling spacy/pipeline/multitask.pyx because it changed.
      Compiling spacy/pipeline/ner.pyx because it changed.
      Compiling spacy/pipeline/pipe.pyx because it changed.
      Compiling spacy/pipeline/trainable_pipe.pyx because it changed.
      Compiling spacy/pipeline/sentencizer.pyx because it changed.
      Compiling spacy/pipeline/senter.pyx because it changed.
      Compiling spacy/pipeline/tagger.pyx because it changed.
      Compiling spacy/pipeline/transition_parser.pyx because it changed.
      Compiling spacy/pipeline/_parser_internals/arc_eager.pyx because it changed.
      Compiling spacy/pipeline/_parser_internals/ner.pyx because it changed.
      Compiling spacy/pipeline/_parser_internals/nonproj.pyx because it changed.
      Compiling spacy/pipeline/_parser_internals/_state.pyx because it changed.
      Compiling spacy/pipeline/_parser_internals/stateclass.pyx because it changed.
      Compiling spacy/pipeline/_parser_internals/transition_system.pyx because it changed.
      Compiling spacy/pipeline/_parser_internals/_beam_utils.pyx because it changed.
      Compiling spacy/tokenizer.pyx because it changed.
      Compiling spacy/training/align.pyx because it changed.
      Compiling spacy/training/gold_io.pyx because it changed.
      Compiling spacy/tokens/doc.pyx because it changed.
      Compiling spacy/tokens/span.pyx because it changed.
      Compiling spacy/tokens/token.pyx because it changed.
      Compiling spacy/tokens/span_group.pyx because it changed.
      Compiling spacy/tokens/graph.pyx because it changed.
      Compiling spacy/tokens/morphanalysis.pyx because it changed.
      Compiling spacy/tokens/_retokenize.pyx because it changed.
      Compiling spacy/matcher/matcher.pyx because it changed.
      Compiling spacy/matcher/phrasematcher.pyx because it changed.
      Compiling spacy/matcher/dependencymatcher.pyx because it changed.
      Compiling spacy/symbols.pyx because it changed.
      Compiling spacy/vectors.pyx because it changed.
      [ 1/41] Cythonizing spacy/attrs.pyx
      [ 2/41] Cythonizing spacy/kb.pyx
      Traceback (most recent call last):
        File "/users/PAS1647/ashleylewis/.conda/envs/GEM/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/users/PAS1647/ashleylewis/.conda/envs/GEM/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/users/PAS1647/ashleylewis/.conda/envs/GEM/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6h6ptrev/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6h6ptrev/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-6h6ptrev/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 224, in <module>
        File "<string>", line 211, in setup_package
        File "/tmp/pip-build-env-6h6ptrev/overlay/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
          cythonize_one(*args)
        File "/tmp/pip-build-env-6h6ptrev/overlay/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: spacy/kb.pyx
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess,

I'm able to run the regular metrics by installing the missing dependencies first, but when I try to run heavy metrics I run into: ModuleNotFoundError: No module named 'questeval'

When I try to install questeval, I get the same error as above (Cython.Compiler.Errors.CompileError). I've been googling around and haven't been able to find any solutions.

ashleylew commented 1 year ago

Was able to fix this problem by downgrading my python version to 3.8