quanteda / spacyr

R wrapper to spaCy NLP
http://spacyr.quanteda.io
250 stars 38 forks source link

spacy_install() not working #242

Closed seb-29 closed 10 months ago

seb-29 commented 1 year ago

Hi,

after installing spacyr using install.packages("spacyr") and miniconda3, I tried installing spaCy following the instructions available at https://spacyr.quanteda.io/. Thus, I ran the following commands using RStudio (with admin rights):

library(spacyr)
spacy_install()

The installation process began. However, it got stuck at the following point:

Solving environment: ...working... unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
Solving environment: ...working... unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source.
Collecting package metadata (repodata.json): ...working... done

At this point, nothing happens anymore. Could you please help me understand what the issue is? I´m quite puzzled, as I´ve used spacyr without any problems in the past - now I seem unable to set it up!

JBGruber commented 1 year ago

Seems to be a duplicate of #236. You can try my solution in this https://github.com/quanteda/spacyr/issues/236#issuecomment-1702311825.

seb-29 commented 1 year ago

Thank you, @JBGruber! I´ve reinstalled Miniconda via the reticulate package as follows:

install_miniconda(path = miniconda_path(), update = TRUE, force = FALSE)

Then I´ve installed spacyr from Github, as you suggested in the comment to #236. However, when trying to run the spacy_install() function that you rewrote from scratch, I get the following notification:

"_No suitable Python installation was found on your system. Do you want to run reticulate::installpython() to install it?"

Why is that? When I run the py_config() function, R(Studio) detects Python 3.9 in the r-reticulate environment that was set up during the Miniconda installation! Thanks a lot in advance :)

JBGruber commented 1 year ago

That message is emitted by reticulate. I'm not quite sure why it does not like the miniconda installation (it was the same for me). But I'm not a big fan of conda anyway. I don't see the advantage over the small python installation reticulate now offers and that one seems much more stable! So I would suggest to swap conda for python if you're not attached to it for some reason.

seb-29 commented 1 year ago

Thanks @JBGruber! No, I´m not particularly attached to conda :) I just thought that spacyr requires it, or? In my experience, spacy_install() always resulted in the creation of a dedicated conda environment (spacy_condaenv), in which spaCy would then be installed. Is that not the case? If so, how should I best proceed to get spaCy working via spacyr?

JBGruber commented 1 year ago

spacyr requires Python. Anaconda is Python and then some. I've never used any of the other features of Anaconda. So I think getting less functions, but more stable ones is preferable. spaCy is now installed in a Python environment. Which again do less then conda environments, but I had less problems with them in the past.

But maybe someone (e.g., @kbenoit) has a different take. Then I could still integrate an alternative route through Anaconda.

seb-29 commented 1 year ago

Thanks @JBGruber! install_python() isn´t working, as I don´t have Git installed on my computer... Is this Git SCM? If yes, once it is installed, will I be able to install spacyr as outlined here by you? Or will further software be needed? I´m coming from the social sciences, so my "back-end" know-how is rather modest :)

JBGruber commented 1 year ago

The "64-bit Git for Windows Setup" should do (although I highly suggest you look into winget or chocolately for package management). I'm a little surprised you need this. I always assumed RStudio comes packed with a git version. But the underlying reticulate command might need more (?). I'll test on a virtual machine when I have time.

(BTW, I'm a political scientist :sweat_smile:)

kbenoit commented 10 months ago

This should be solved now with v1.3, please give it a try.