Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spacy_install() fails on recent version of spacy #255

Closed
nap2155 opened this issue Oct 17, 2024 · 2 comments
Closed

spacy_install() fails on recent version of spacy #255

nap2155 opened this issue Oct 17, 2024 · 2 comments

Comments

@nap2155
Copy link

nap2155 commented Oct 17, 2024

Thanks for spacyr!

I am unable to complete the spacy_install() command. It seems as though the issue is based on dependency issues in the Python spacy package (see: explosion/spaCy#13658).

When I run reticulate::py_install("spacy", envname = Sys.getenv("SPACY_PYTHON", unset = "r-spacyr")), I get the following error message:

Using virtual environment 'r-spacyr' ...
+ /Users/NAME/.virtualenvs/r-spacyr/bin/python -m pip install --upgrade --no-user spacy
Requirement already satisfied: spacy in ./.virtualenvs/r-spacyr/lib/python3.8/site-packages (3.7.5)
Collecting spacy
  Using cached spacy-3.8.2.tar.gz (1.3 MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [67 lines of output]
      Ignoring numpy: markers 'python_version >= "3.9"' don't match your environment
      Collecting setuptools
        Using cached setuptools-75.2.0-py3-none-any.whl.metadata (6.9 kB)
      Collecting cython<3.0,>=0.25
        Using cached Cython-0.29.37-py2.py3-none-any.whl.metadata (3.1 kB)
      Collecting cymem<2.1.0,>=2.0.2
        Using cached cymem-2.0.8-cp38-cp38-macosx_10_9_x86_64.whl.metadata (8.4 kB)
      Collecting preshed<3.1.0,>=3.0.2
        Using cached preshed-3.0.9-cp38-cp38-macosx_10_9_x86_64.whl.metadata (2.2 kB)
      Collecting murmurhash<1.1.0,>=0.28.0
        Using cached murmurhash-1.0.10-cp38-cp38-macosx_10_9_x86_64.whl.metadata (2.0 kB)
      Collecting thinc<8.4.0,>=8.3.0
        Using cached thinc-8.3.2.tar.gz (193 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'error'
        error: subprocess-exited-with-error
      
        × pip subprocess to install build dependencies did not run successfully.
        │ exit code: 1
        ╰─> [37 lines of output]
            Ignoring numpy: markers 'python_version >= "3.9"' don't match your environment
            Collecting setuptools
              Using cached setuptools-75.2.0-py3-none-any.whl.metadata (6.9 kB)
            Collecting cython<3.0,>=0.25
              Using cached Cython-0.29.37-py2.py3-none-any.whl.metadata (3.1 kB)
            Collecting murmurhash<1.1.0,>=1.0.2
              Using cached murmurhash-1.0.10-cp38-cp38-macosx_10_9_x86_64.whl.metadata (2.0 kB)
            Collecting cymem<2.1.0,>=2.0.2
              Using cached cymem-2.0.8-cp38-cp38-macosx_10_9_x86_64.whl.metadata (8.4 kB)
            Collecting preshed<3.1.0,>=3.0.2
              Using cached preshed-3.0.9-cp38-cp38-macosx_10_9_x86_64.whl.metadata (2.2 kB)
            Collecting blis<1.1.0,>=1.0.0
              Using cached blis-1.0.1.tar.gz (3.6 MB)
              Installing build dependencies: started
              Installing build dependencies: finished with status 'error'
              error: subprocess-exited-with-error
      
              × pip subprocess to install build dependencies did not run successfully.
              │ exit code: 1
              ╰─> [7 lines of output]
                  Collecting setuptools
                    Using cached setuptools-75.2.0-py3-none-any.whl.metadata (6.9 kB)
                  Collecting cython>=0.25
                    Using cached Cython-3.0.11-cp38-cp38-macosx_10_9_x86_64.whl.metadata (3.2 kB)
                  ERROR: Ignored the following versions that require a different python version: 1.25.0 Requires-Python >=3.9; 1.25.1 Requires-Python >=3.9; 1.25.2 Requires-Python >=3.9; 1.26.0 Requires-Python <3.13,>=3.9; 1.26.1 Requires-Python <3.13,>=3.9; 1.26.2 Requires-Python >=3.9; 1.26.3 Requires-Python >=3.9; 1.26.4 Requires-Python >=3.9; 2.0.0 Requires-Python >=3.9; 2.0.1 Requires-Python >=3.9; 2.0.2 Requires-Python >=3.9; 2.1.0 Requires-Python >=3.10; 2.1.0rc1 Requires-Python >=3.10; 2.1.1 Requires-Python >=3.10; 2.1.2 Requires-Python >=3.10
                  ERROR: Could not find a version that satisfies the requirement numpy<3.0.0,>=2.0.0 (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 1.13.3, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6, 1.17.0, 1.17.1, 1.17.2, 1.17.3, 1.17.4, 1.17.5, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.19.0, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.19.5, 1.20.0, 1.20.1, 1.20.2, 1.20.3, 1.21.0, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.22.0, 1.22.1, 1.22.2, 1.22.3, 1.22.4, 1.23.0, 1.23.1, 1.23.2, 1.23.3, 1.23.4, 1.23.5, 1.24.0, 1.24.1, 1.24.2, 1.24.3, 1.24.4)
                  ERROR: No matching distribution found for numpy<3.0.0,>=2.0.0
                  [end of output]
      
              note: This error originates from a subprocess, and is likely not a problem with pip.
            error: subprocess-exited-with-error
      
            × pip subprocess to install build dependencies did not run successfully.
            │ exit code: 1
            ╰─> See above for output.
      
            note: This error originates from a subprocess, and is likely not a problem with pip.
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: subprocess-exited-with-error
      
      × pip subprocess to install build dependencies did not run successfully.
      │ exit code: 1
      ╰─> See above for output.
      
      note: This error originates from a subprocess, and is likely not a problem with pip.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Error: Error installing package(s): 'spacy' 

It loads when I switch to an earlier version of spacy: reticulate::py_install("spacy<3.8", envname = Sys.getenv("SPACY_PYTHON", unset = "r-spacyr")). However, at that point, I receive a separate error:

Using virtual environment 'r-spacyr' ...
+ /Users/NAME/.virtualenvs/r-spacyr/bin/python -m pip install --upgrade --no-user en_core_web_sm
ERROR: Could not find a version that satisfies the requirement en_core_web_sm (from versions: none)
ERROR: No matching distribution found for en_core_web_sm
Error: Error installing package(s): 'en_core_web_sm'

Please let me know if there is a separate way to download the relevant language model. Thank you!

@nap2155
Copy link
Author

nap2155 commented Oct 18, 2024

I realize that simply running spacy_initialize() avoids the error. Closing this comment thread. Thank you!

@nap2155 nap2155 closed this as completed Oct 18, 2024
@JBGruber
Copy link
Collaborator

From the error, I see that your Python version is too old to install the current version of numpy. You could fix this by first running reticulate::install_python() or if you want the most recent version reticulate::install_python("3.12:latest").

The reason why spacy_initialize() works here is that you already have spacyr installed correctly (see the third line in your output Requirement already satisfied: spacy in ./.virtualenvs/r-spacyr/lib/python3.8/site-packages (3.7.5)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants