Closed SarahAlidoost closed 1 month ago
I've been installing fully inside conda and running into similar issues, but not all.
conda install r
installed r-base-4.4.1
After this, I've had to manually install the following packages (for far):
conda install protobuf
conda install jq
conda install udunits2
conda install gdal
conda install pkg-config
Rscript -e "renv::restore()"
was reasonably quick to continue the installation, but does take a long time to run thought the whole process.
@SarahAlidoost the reason why this is taking so long could be that your system is building the packages from source instead of downloading available binaries. You are on Ubuntu right? Maybe there are other mirrors with more binaries available for linux? I will have a look. Maybe conda can indeed help for this, but I am not sure if all needed packages are available (have you been also using the r
channel @vanlankveldthijs ?).
Will mention that renv.lock should be removed in #10, thanks for the tip !
Maybe conda can indeed help for this, but I am not sure if all needed packages are available (have you been also using the
r
channel @vanlankveldthijs ?).
I'm using the base channel of miniforge, which is conda-forge
.
I'm using the base channel of miniforge, which is conda-forge.
Aah, sorry, now I got it - so you have installed R and some of the required (system) libraries with conda
, but still installing R packages via renv
? I guess that this will still be building packages from source then. A faster way could instead also install R packages via conda: conda install r-dbscan r-geojsonio r-leaflet ...
with all the dependencies from the DESCRIPTION file (note that R packages in conda all start with r-
), maybe trying to add the r
channel. If this works, we could also add a corresponding environment file to the repo..
@fnattino is there an easy way to reverse the Rscript installation process?
I wanted to check whether building from source worked after creating a new conda environment and installing
conda install r protobuf jq udunits2 gdal pkg-config
Unfortunately, this does not affect the Rscript cache, so it will not rebuild the packages.
I know that it may be a lot faster to install any existing binaries, but as long as the readme describes setting up the repo by running Rscript, it should at least also mention the required dependencies.
I think the following should bypass the cache (at least according to the docs):
Rscript -e "renv::restore(rebuild = TRUE)"
Just as a reference, I have put together the following environment file, that seems to work to get all (R and Python) packages installed in the conda environment:
name: crisp
channels:
- conda-forge
- r
dependencies:
# Python dependencies
- python=3.10
- folium
- geopandas
- jupyterlab
- mapclassify
- matplotlib
- momepy
- numpy<2
- osmnx
- pandas
- scikit-learn
- shapely
# R dependencies
- r
- r-dbscan
- r-geojsonio
- r-leaflet
- r-lwgeom
- r-osmdata
- r-rstac
- r-sfnetworks
- r-terra
- r-tidyverse
Note that one than needs to remove renv
folder (and renv.lock
file?) before running R - renv
otherwise tries to create a new project-based environment (based on the conda environment).
Will add this to the repository with some extra information in the REAMDE as an alternative installation approach.
In case you want to complete remove the renv cache, the following may help:
"To completely remove renv from a project, call renv::deactivate(clean = TRUE)
. If you later want to use renv for this project, you’ll need to start from scratch with renv::init()
."
Besides the fact that installation from both
renv.lock
and scratch is slow; taking about an hour, it seems that the R packages have OS-specific dependencies, see below. After the error from 'sf' (the last one), I quit the installation fromrenv.lock
file and tried installing from scratch. For that, the readme should mention that therenv.lock
file should be removed.To speed up the installation process, could we group the dependencies based on individual notebooks? This way, we only install the packages required for each specific notebook.
- Errors from
renv.lock
:- Errors from scratch: