Установить R 3.x через homebrew - PullRequest
0 голосов
/ 14 июля 2020

Формула R https://github.com/Homebrew/homebrew-core/commits/master/Formula/r.rb была недавно обновлена ​​с версии 3.6.3 до 4.0. В версии 4 есть несколько обратно несовместимых изменений, поэтому я хотел бы, чтобы в моей системе были установлены версии 3.x и 4.x.

Можно ли этого добиться с помощью homebrew? Простая попытка brew install r@3.6 дает мне No available formula with the name "r@3.6".

(Кроме того: обновление с 3.6 до 4.0 произошло в моей системе довольно незаметно, я сделал brew upgrade dvc и обновил несколько зависимостей [Installing dependencies for dvc: c-ares, protobuf, grpc, gcc, openblas, sqlite, python@3.8, numpy, zstd and apache-arrow], а затем лавина иждивенцев:

==> Upgrading 42 dependents:
ansible 2.9.6_1 -> 2.9.10, ansible 2.9.6_1 -> 2.9.10, awscli 2.0.7 -> 2.0.28_1,
 awscli 2.0.7 -> 2.0.28_1, cython 0.29.10 -> 0.29.20, cassandra 3.11.4 -> 3.11.6_2,
 ffmpeg 4.2.2_2 -> 4.3_2, ffmpeg 4.2.2_2 -> 4.3_2, gdal 2.4.4_4 -> 3.1.1_2,
 gdal 2.4.4_4 -> 3.1.1_2, gdal 2.4.4_4 -> 3.1.1_2, gdal 2.4.4_4 -> 3.1.1_2,
 gdal 2.4.4_4 -> 3.1.1_2, gdal 2.4.4_4 -> 3.1.1_2, glib 2.64.2 -> 2.64.3, glib 2.64.2 -> 2.64.3,
 graphviz 2.42.3 -> 2.44.0, graphviz 2.42.3 -> 2.44.0, harfbuzz 2.6.4 -> 2.6.8,
 hdf5 1.12.0 -> 1.12.0_1, imagemagick 7.0.10-6_1 -> 7.0.10-23,
 imagemagick 7.0.10-6_1 -> 7.0.10-23, ipython 7.13.0 -> 7.16.1, jupyterlab 2.1.0 -> 2.1.5,
 libdap 3.20.5 -> 3.20.6, libdap 3.20.5 -> 3.20.6, libheif 1.6.2_1 -> 1.7.0,
 libheif 1.6.2_1 -> 1.7.0, maxima 5.43.2 -> 5.44.0, maxima 5.43.2 -> 5.44.0,
 netcdf 4.7.4 -> 4.7.4_1, pipenv 2018.11.26_3 -> 2020.6.2, pipenv 2018.11.26_3 -> 2020.6.2,
 poppler 0.87.0 -> 0.90.0, poppler 0.87.0 -> 0.90.0, python 3.7.7 -> 3.7.8,
 python-yq 2.7.2 -> 2.10.1, qcachegrind 18.04.3_1 -> 19.08.3, r 3.6.3_1 -> 4.0.2_1,
 r 3.6.3_1 -> 4.0.2_1, shared-mime-info 1.15 -> 2.0, shared-mime-info 1.15 -> 2.0

, поэтому я пытаюсь вернуть установку R 3.6.)

1 Ответ

1 голос
/ 18 июля 2020

Поскольку R 3.6.3 активно не поддерживается в апстриме, homebrew-core не имеет формулы для него с поддержкой версий. Существует хакерский способ установить самую последнюю версию 3.6.3.

$ cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core # switch to your local homebrew-core folder

$ git reset --hard c3a244c627e # effective reset to the most recent r3.6.3 edition
Updating files: 100% (3680/3680), done.
HEAD is now at c3a244c627e r: update 3.6.3_2 bottle.
$ git checkout -b r-3.6.3 # this would prevent messing up your source tree
Switched to a new branch 'r-3.6.3'

$ brew reinstall r # this would reinstall 3.6.3_2

$ git checkout master # checkout back to source tree

Журнал установки

==> Downloading https://homebrew.bintray.com/bottles/gcc-9.3.0_1.mojave.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/de8319322428721741a0dc41dfdf2eece80e0215a7a4a861e0e206a9bfbca583?response-
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/openblas-0.3.9.mojave.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/15116c0a8d1f359f83761de72835021cbad6a814cf7fd53cc93428b522f06dda?response-
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/r-3.6.3_2.mojave.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/c6d4210a241f9466804d5660b467afb6f59d2150e43288b1c66e47387ff43f6e?response-
######################################################################## 100.0%
==> Reinstalling r
==> Installing dependencies for r: gcc and openblas
==> Installing r dependency: gcc
==> Pouring gcc-9.3.0_1.mojave.bottle.tar.gz
?  /usr/local/Cellar/gcc/9.3.0_1: 1,463 files, 292MB
==> Installing r dependency: openblas
==> Pouring openblas-0.3.9.mojave.bottle.tar.gz
==> Caveats
openblas is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BLAS in Accelerate.framework.

For compilers to find openblas you may need to set:
  export LDFLAGS="-L/usr/local/opt/openblas/lib"
  export CPPFLAGS="-I/usr/local/opt/openblas/include"

For pkg-config to find openblas you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"

==> Summary
?  /usr/local/Cellar/openblas/0.3.9: 23 files, 119.7MB
==> Installing r
==> Pouring r-3.6.3_2.mojave.bottle.tar.gz
?  /usr/local/Cellar/r/3.6.3_2: 2,122 files, 58.2MB
==> Caveats
==> openblas
openblas is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BLAS in Accelerate.framework.

For compilers to find openblas you may need to set:
  export LDFLAGS="-L/usr/local/opt/openblas/lib"
  export CPPFLAGS="-I/usr/local/opt/openblas/include"

For pkg-config to find openblas you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"

проверка версии

$ r --version
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin18.7.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

Устаревшая формула

Кроме того, что вы можете установить хакерским способом, я также сделал для этого унаследованную формулу. https://github.com/Homebrew/homebrew-core/pull/58063

...