error launching afni on new machine

Hi team,
We are trying to set up a new installation and I encountered an error I haven’t seen before. Can you help me resolve this:

Precompiled binary linux_ubuntu_16_64: Sep 1 2021 (Version AFNI_21.2.06 ‘Nerva’)

** Version check disabled: AFNI_VERSION_CHECK forbids
Thanks go to KM Donahue for useful feedback

Initializing: X11Error: Can’t open display: :0.0

We also tried launching gedit to see if we could connect to X11 that way and received this error:
Unable to init server: Could not connect: Connection refused

(gedit:34): Gtk-WARNING **: 11:43:58.072: cannot open display: :0.0

Howdy-

What OS/system have you installed on?

What is the output of:


afni_system_check.py -check_all

?

It seems likely that you have used ssh to go to a remote server, but either without X11 forwarding on, or perhaps just without -X or -Y as an ssh option.

If that is the case, what OS did you ssh from?

  • rick

Hi Paul, We are on a Windows machine using Ubuntu. Here’s the output

kirkprok@RAD-D-BBZVHL2:~$ afni_system_check.py -check_all
-------------------------------- general ---------------------------------
architecture: 64bit
system: Linux
release: 5.10.16.3-microsoft-standard-WSL2
version: #1 SMP Fri Apr 2 22:23:49 UTC 2021
distribution: Ubuntu 18.04 bionic
number of CPUs: 8
apparent login shell: bash
shell RC file: .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /home/kirkprok/abin/afni
afni version : Precompiled binary linux_ubuntu_16_64: Sep 20 2021
: AFNI_21.2.07 ‘Nerva’
AFNI_version.txt : AFNI_21.2.07, linux_ubuntu_16_64, Sep 20 2021
which python : /usr/bin/python
python version : 2.7.17
which R : /usr/bin/R
R version : R version 3.6.3 (2020-02-29) – “Holding the Windsock”
which tcsh : /usr/bin/tcsh

instances of various programs found in PATH:
afni : 1 (/home/kirkprok/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!

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

++ module loaded: matplotlib.pyplot
module file : /usr/lib/python2.7/dist-packages/matplotlib/pyplot.pyc

-------------------------------- env vars --------------------------------
PATH = /home/kirkprok/miniconda3/condabin:/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.2020.824.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/Users/kirkprok/AppData/Local/Microsoft/WindowsApps:/snap/bin:/home/kirkprok/abin:/home/kirkprok/abin:/home/kirkprok/abin

PYTHONPATH =
R_LIBS = /home/kirkprok/R

LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH =
DYLD_FALLBACK_LIBRARY_PATH =

------------------------------ data checks -------------------------------
data dir : missing AFNI_data6
data dir : missing AFNI_demos
data dir : missing suma_demo
data dir : missing afni_handouts
atlas : found TT_N27+tlrc under /home/kirkprok/abin

------------------------------ OS specific -------------------------------
which apt-get : /usr/bin/apt-get
apt-get version : apt 1.6.12ubuntu0.1 (amd64)

have Ubuntu system: Ubuntu 18.04 bionic
have Ubuntu afni : Precompiled binary linux_ubuntu_16_64: Sep 20 2021

========================= summary, please fix: =========================

  • just be aware: login shell ‘bash’, but our code examples use ‘tcsh’
  • missing R packages (see rPkgsInstall)
  • insufficient data for AFNI bootcamp

Thanks Rick. We are trying to get things installed on a local machine for now so we aren’t using ssh. I am perplexed. We are in a Windows machine and using Ubuntu. We had initially used Ubuntu version 20.04 and then we removed that and now we’re trying Ubuntu 18.04 but we are getting the same error.

Howdy-

OK, Daniel probably has the most experience with that setup+OS. Are you using WSL 2 or the original one (from the system check, perhaps the former, which might have additional difficulties…).

Do you have the vcXsvr installed as well, and running, with the environment variables described here set:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/steps_windows10.html#install-vcxsrv-windows-x-server
?

–pt

WSL adds some complexity to the X11 installation, so I thought this might be heading in that directions. While other Ubuntu and Linux variations usually come with an X server built in, WSL doesn’t quite yet. WSL comes in two versions - version 1 and version 2. Version 1 is easier to get going, but version 2 is a bit faster and also should work.

For an X server, you can use VcXsrv, mobaXterm, XWin32 and a few others. You need to start whichever XServer you use before you call the AFNI GUI or other X11 programs. With the more recent version 2 of WSL, the display occurs over a virtual network bridge on your own computer, and you have to set the DISPLAY variable.

export DISPLAY=“$(/sbin/ip route | awk ‘/default/ { print $3 }’):0”

You can test with that just on the command line, but put that in your .bashrc file for long term use.

Note the developer version of WSL doesn’t require any of this because it includes an X server. Unfortunately, it is very buggy and slow so far, and I can’t recommend it yet. There are a few more details in this previous post:

https://afni.nimh.nih.gov/afni/community/board/read.php?1,159772,165003#msg-165003

Daniel, thanks!
We are still having trouble resolving the issue in WSL2 but I appreciate the link to the other thread. It was useful to know that this problem has been encountered before. We are going to try to convert back to WSL1 and see if that resolves it. Otherwise, we will explore the links you shared in the other post to some forums where other people have encountered this.
I’ll keep you posted.
Josh

Converting back to WSL1 solved our problem and we were able to use the AFNI GUI. Thanks for the support!

Great! Thanks for the update. I’ve had good luck getting X11 to work with WSL2, but it is trickier, and I haven’t tried for the past few months with the developer version installed instead.