farach / huggingfaceR

Hugging Face state-of-the-art models in R
Other
142 stars 17 forks source link

Possible installation issues #16

Closed tomazweiss closed 2 years ago

tomazweiss commented 2 years ago

Thanks for your effort with this package. I wanted to try it out but I run into some installation issues that I wanted to share.

In README.md you are suggesting to run py_install("keras") before running devtools::install_github("farach/huggingfaceR"). This will install keras into default envname which is:

the active environment as set by the RETICULATE_PYTHON_ENV variable will be used; if that is unset, then the r-reticulate environment will be used.

The huggingfaceR environment doesn't yet exist at this point and you need keras there too. You probably also don't want to mess with the r-reticulate env since you are creating a new one.

I've also failed to install required python packages from the conda-forge channel due to some incompatibility issues:

+ "C:/Users/weisst/Miniconda3/condabin/conda.bat" "create" "--yes" "--name" "huggingfaceR" "python=3.8" "PyTorch" "Tensorflow" "transformers" "sentencepiece" "huggingface_hub" "--quiet" "-c" "conda-forge"
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): ...working... done
                                                                                                 0<00:00, 21.45s/it]                                          
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed
....

Switching to the main channel solved this issue.

So my workaround has been to manually run

reticulate::conda_create(
  envname = "huggingfaceR",
  packages = c('keras", "PyTorch", "Tensorflow", "transformers", "sentencepiece", "huggingface_hub"),
  conda = paste0(reticulate::miniconda_path(), "/condabin/conda"),
  forge = FALSE
)

before running devtools::install_github("farach/huggingfaceR").

Of course, the main channel has to be present in

(base) C:\Users\weisst>conda config --get
--set channel_priority strict
--add channels 'defaults'   # lowest priority
--add channels 'conda-forge'
--add channels 'main'   # highest priority
--set ssl_verify True
jpcompartir commented 2 years ago

Hey, thanks for this! @farach is going to take a look at Windows installation & we'll be formalising documentation, installation steps and things of that ilk as we move towards the first release, so this is very helpful!

farach commented 2 years ago

I added "keras" to the packages argument in conda_create() within the .onLoad function. I was not able to identify the conda-forge incompatibility problems so have left the forge argument set to TRUE (default value). I updated the README file to reflect that users do not have to install keras prior to installing huggingfaceR. Thanks again for pointing this out!