jianlins / PyRuSH

init
MIT License
11 stars 9 forks source link

unable to install PyRush from requirements.txt: missing cython and numpy dependencies #8

Closed DSLituiev closed 2 years ago

DSLituiev commented 2 years ago

I am trying to package up an environment that includes pyrush. Here is the requirements.txt:

Cython>=0.29.32
setuptools>=65.5.0
numpy
spacy==3.4.1
PyRuSH # git+https://github.com/jianlins/PyRuSH.git@master
medspacy==1.0.0
medspacy-quickumls==2.6
scispacy==0.5.1
spacy-legacy==3.0.10
spacy-loggers==1.0.3
scikit-learn==0.20.3
en-core-sci-lg @ https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.5.1/en_core_sci_lg-0.5.1.tar.gz

When I try executing it with pip install -r inst/requirements.txt, I am getting:

pip install -r inst/requirements.txt
Collecting en-core-sci-lg@ https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.5.1/en_core_sci_lg-0.5.1.tar.gz
  Using cached en_core_sci_lg-0.5.1-py3-none-any.whl
Requirement already satisfied: Cython>=0.29.32 in /Users/dlituiev/Library/r-miniconda-arm64/envs/clinspacy/lib/python3.8/site-packages (from -r inst/requirements.txt (line 1)) (0.29.32)
Requirement already satisfied: setuptools>=65.5.0 in /Users/dlituiev/Library/r-miniconda-arm64/envs/clinspacy/lib/python3.8/site-packages (from -r inst/requirements.txt (line 2)) (65.5.0)
Collecting numpy
  Using cached numpy-1.23.4-cp38-cp38-macosx_11_0_arm64.whl (13.3 MB)
Collecting spacy==3.4.1
  Using cached spacy-3.4.1-cp38-cp38-macosx_11_0_arm64.whl (6.3 MB)
Collecting PyRuSH
  Using cached PyRuSH-1.0.7.tar.gz (45 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/qz/tt8wl6hn2cs6rw77r5mcmll00000gp/T/pip-install-hx7vz597/pyrush_8a90de7c1c414752bdcd9fab85ad4eaf/setup.py", line 6, in <module>
          import numpy
      ModuleNotFoundError: No module named 'numpy'
      [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

Obviously numpy is in, before the pyrush.

Also I see that numpy and cython are not declared in the pyrush's own requirements.txt

DSLituiev commented 2 years ago

exactly same error pops up with a direct pip based installation

pip install git+https://github.com/jianlins/PyRuSH.git@master
DSLituiev commented 2 years ago

Here is a walk through some workarounds for this issue: https://luminousmen.com/post/resolve-cython-and-numpy-dependencies

DSLituiev commented 2 years ago

please include this into a pyproject.toml file the root directory:

[build-system]
requires = ["setuptools>=65.5.0", "wheel", 'Cython>=0.29.32', 'numpy>=1.10', "spacy>=3.0.0", "cymem", "preshed"]

This enables independent installation into a fresh environment. Thank you

jianlins commented 2 years ago

Thanks for the suggestions. It seems the toml file will do the trick. I set up the setup.py following https://github.com/explosion/spaCy/blob/master/setup.py They did import numpy and Cython at the beginning of setup.py without causing problems. Just tried, it seems working. Let me know if you still have any issues.