(possible) solution to install brms on Ubuntu 18.04 on WSL

Hi,

From Paul:

https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Linux

In the end this procedure worked to get brms:


# Add Michael Rutter's c2d4u3.5 PPA (and rrutter3.5 for CRAN builds too)
sudo add-apt-repository -y "ppa:marutter/rrutter3.5"
sudo add-apt-repository -y "ppa:marutter/c2d4u3.5"
sudo apt update
sudo apt install r-cran-rstan
sudo apt-get install r-cran-shinystan
sudo apt-get install r-cran-brms

thanks!

Hi, I have exactly the same problem as you when installing the R package but with metafor and brms


rPkgsInstall -pkgs ALL
Installing packages into ‘/home/R’
(as ‘lib’ is unspecified)

++ Note:  @ 18:08:15
        This package has been installed on the computer: brms
        This package has been installed on the computer: metafor

Warning message:
packages ‘brms’, ‘metafor’ are not available (for R version 3.4.4)

I tried


sudo add-apt-repository -y "ppa:marutter/rrutter3.5"

Cannot add PPA: 'ppa:~marutter/ubuntu/rrutter3.5'.
ERROR: '~marutter' user or team does not exist.

sudo apt-get install r-cran-brms
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package r-cran-brms

I tried to find a solution do download the packages but it didn’t work… =(

Thank you in advance for your help!

Clement

Hi, Clement-

Just to have some more info about your system to see what might be happening, what is the output of:


afni_system_check.py -check_all

?

–pt

Hi Paul,
Here is the result


-------------------------------- general ---------------------------------
architecture:         64bit
system:               Linux
release:              4.4.0-17763-Microsoft
version:              #379-Microsoft Wed Mar 06 19:16:00 PST 2019
distribution:         Ubuntu 18.04 bionic
number of CPUs:       24
apparent login shell: bash
shell RC file:        .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /home/cgarin/abin/afni
afni version         : Precompiled binary linux_ubuntu_16_64: Nov  8 2019
                     : AFNI_19.3.12 'Nero'
AFNI_version.txt     : AFNI_19.3.12, linux_ubuntu_16_64, Nov 08 2019
which python         : /usr/bin/python
python version       : 2.7.15+
which R              : /usr/bin/R
R version            : R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
which tcsh           : /usr/bin/tcsh

instances of various programs found in PATH:
    afni    : 1   (/home/cgarin/abin/afni)
    R       : 1   (/usr/bin/R)
    python  : 1   (/usr/bin/python2.7)
    python2 : 1   (/usr/bin/python2.7)
    python3 : 1   (/usr/bin/python3.6)


testing ability to start various programs...
    afni                 : success
    suma                 : success
    3dSkullStrip         : success
    uber_subject.py      : success
    3dAllineate          : success
    3dRSFC               : success
    SurfMesh             : success
    3dClustSim           : success
    3dMVM                : success

checking for R packages...
    rPkgsInstall -pkgs ALL -check : FAILURE

        oo Warning:
           These packages are not installed on the computer: brms!
        These packages are not installed on the computer: metafor!


R RHOME : /usr/lib/R

checking for $HOME files...
    .afnirc                   : found
    .sumarc                   : found
    .afni/help/all_progs.COMP : found

------------------------------ python libs -------------------------------
++ module loaded: PyQt4
   module file : /usr/lib/python2.7/dist-packages/PyQt4/__init__.pyc

** failed to load module matplotlib.pyplot
-- matplotlib.pyplot is not required, but is desirable

-------------------------------- env vars --------------------------------
PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Windows/System32/OpenSSH:/mnt/c/Program Files/PuTTY:/mnt/c/Users/cgarin/AppData/Local/Microsoft/WindowsApps:/snap/bin:/home/cgarin/abin

PYTHONPATH =
R_LIBS = /home/cgarin/R

LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH =
DYLD_FALLBACK_LIBRARY_PATH =

------------------------------ data checks -------------------------------
data dir : found AFNI_data6   under $HOME
           top history: ...2019 [ptaylor]: updated FT_analysis/results.QC_FT.05
data dir : found AFNI_demos   under $HOME
           top history: 22 Oct 2019 [discoraj]: added Cluster Explorer Demo
data dir : found suma_demo    under $HOME
           top history: ...s_New/data/Build_tmp on Mon Mar  4 11:56:45 EST 2013
data dir : found afni_handouts under $HOME
atlas    : found TT_N27+tlrc  under /home/cgarin/abin

------------------------------ OS specific -------------------------------
which apt-get        : /usr/bin/apt-get
apt-get version      : apt 1.6.3 (amd64)

have Ubuntu system: Ubuntu 18.04 bionic
have Ubuntu afni  : Precompiled binary linux_ubuntu_16_64: Nov  8 2019

=========================  summary, please fix:  =========================
*  login shell 'bash', trusting user to translate code examples from 'tcsh'
*  missing R packages (see rPkgsInstall)

again thanks a lot for your help!!

Clement

Hi all,

I have a similar problem, but with a lot more packages having not installed (see system check output in attached files). Did you manage to get to the bottom of this?

Thanks for any help you can give.

Howdy-

So, rPkgsInstall is an AFNI program that installs R packages; it basically makes a lot of “install.packages()” calls inside of R. It has to pull from some repository/mirror, and unfortunately the main R-cran one that it has pulled from by default appears to not be working at the moment.

Gang has found a better one to use, and we have updated that default setting in the very most recent code base (built last night); so, you should be able to run:


@update.afni.binaries -d
rPkgsInstall -pkgs ALL

to get the newest AFNI and install with the newly default-set program, OR, you could run this without the space after “https:” (which this interface makes me put in, otherwise the link gets reformatted, unfortunately):


rPkgsInstall -pkgs ALL -site "https: //cloud.r-project.org"

… on your current version.

Please let us know if that sorts it.

–pt

Hi there,

Thanks very much for your response. I ended up installing the packages individually (Unfortunately I’ve just seen your message).
The system evaluation now only has two ‘suggestions’:

  • login shell ‘bash’, trusting user to translate code examples from ‘tcsh’ * shell bash: consider sourcing (non-login) .bashrc from (login) .profile

I assume these aren’t important?

Thanks for your help

Gerard

Hi, Gerard-

OK, well, glad the first part is all set, then.

Re those two messages:

    • login shell ‘bash’, trusting user to translate code examples from ‘tcsh’
      Nothing for you to change at all. This is not something to fix.
      When we do shell scripting, we mostly use tcsh; those can be run from any shell, but if you were, say, to copy+paste from one into to a terminal, then you would want to be a ‘tcsh’ shell.
    • shell bash: consider sourcing (non-login) .bashrc from (login) .profile
      This is a minor thing, but can you please copy+paste this into a terminal:

echo "" >> ~/.profile
echo "source ~/.bashrc" >> ~/.profile
echo "" >> ~/.profile

Then, can you open a new terminal and verify that that message is gone from running “afni_system_check.py -check_all”? (It should be from all further terminals.)

And then that looks like you are all set.

–pt

Hi everyone,

I recently went 3 times through installing AFNI on Ubuntu 18.04 on WSL1 on Windows 10, and each time I run into a problem with installing brms, which was not solved by the suggested solution, i.e.:


sudo add-apt-repository -y "ppa:marutter/rrutter3.5"
sudo add-apt-repository -y "ppa:marutter/c2d4u3.5"

sudo apt update

sudo apt install -y r-cran-rstan r-cran-shinystan r-cran-brms

Somehow (I am a Windows person and most of the time I have no idea what I am doing in Linux) I figured the problem was with r-cran-v8 and/or libnode64.

After some googling, I found a solution that worked for me, so I thought I would share.

Again, I am a Windows person who has no idea what they are doing, so I refuse to take any responsibility if this fries your computer or in the future places all your activations in the ventricles.


sudo add-apt-repository ppa:cran/v8
sudo apt-get update
sudo apt-get install libnode-dev

which I then followed by


sudo apt install r-cran-rstan
sudo apt install r-cran-shinystan
sudo apt install r-cran-brms

I did them separately to better see if I am running into problems, and if yes, where.

There were no problems, and afni_system_check.py was happy, and afni and suma started.

So here you have it, my contribution to the community, again - no responsibility. Did I say I don’t know what I am doing?

Thanks a lot for kindly sharing the information!

I am also very new to this, but just wanted to say this seems to have fixed my error for installing brms on Ubuntu 20.04 on WSL. Thanks!

Brilliant!
I must log in to thank you for your solution!
I’m in the same situation: Win10, WSL1, Ubuntu18, and get stuck at libnode64.
This works for me!

Brilliant!
I must log in to thank you for your solution!
I’m in the same situation: Win10, WSL1, Ubuntu18, and get stuck at libnode64.
This works for me!

the webpage shows submit error but why showing reply twice

xy497 Wrote:

Brilliant!
I must log in to thank you for your solution!
I’m in the same situation: Win10, WSL1, Ubuntu18,
and get stuck at libnode64.
This works for me!

Happy to hear that.

By the way, after months of struggle with WSL1 I gave up. It was especially bad at my institution - our IT security at random times kills a windows service that underlies WSL, which of course immediately kills Ubuntu and whatever runs in it, like AFNI.

But other things were annoying too.:

  • one cannot use Windows mechanisms to write in Linux file system in WSL1, things get corrupted. Because of that, to share files between AFNI and Windows programs I basically had to maintain separate copies of everything, one in Linux and one in Windows, which would be synced using dedicated software
  • in WSL2 writing into Linux file system from Windows side works, but then VcXsrv does not, and one has to find other (complicated) solutions to run AFNI GUI (also my institution does not offer Windows modern enough to contain WSL 2)
  • there are many other problems with Ubuntu that one gets on WSL
    – it’s command line-only out of the box, I get that people like it, and I am not scared by command like, I stared in MS-DOS - but it’s 2021 FFS, I want to able to use a mouse and a pretty GUI!
    – it won’t run 32-bit executables, and even some modern 64-bit programs have 32-bit installers to ensure that the installer runs on any system and installs either 32-bit or 64-bit version of the program. So installing such a program is impossible or one has to look for hacks.
    – some popular programs won’t work, e.g. in Ubuntu on WSL 1 I wasn’t able to install Atom, or get Firefox to work properly

So I switched to VM VirtualBox and I am really happy

  • I get a modern OS with full GUI if I want to use GUI, but of course I can use Terminal as well
  • things generally work out of the box
  • including AFNI GUI without any add-ons like VcXsrv or hacks
  • sharing folders with windows works perfectly (though they map into different location than in WSL)
  • my institutions IT security does not kill anything
  • even R installation for AFNI went better, not completely without problems, but the first solution (marutter) worked

The disadvantages is that one has to permanently sacrifice a section of the drive for VM/Linux, and VM/Linux will only utilize up to 50% half of the available CPU cores (unless I cannot find the setting to change that).

Still in my opinion much better experience and comfort than with WSL. I heard that most recent versions of Windows (latest 10 or maybe 11 ?) made significant progress with WSL, but - again thanks to my institution which keeps our Windows pretty old - I don’t know how it works with AFNI.