can't open DISPLAY

Post Reply
fietkiewicz
Posts: 18
Joined: Thu Jun 27, 2013 5:13 pm
Location: Hobart and William Smith Colleges
Contact:

can't open DISPLAY

Post by fietkiewicz »

I recently installed NEURON on a new computer and am trying to run nrniv, but get the error "can't open DISPLAY". If I run it from an XQuartz terminal, I get an "oc" prompt but no GUI.

Environment details are: Mac M2 with Sonoma 14.0, XQuartz 2.8.5, installed NEURON via pip3. Typing "echo $DISPLAY" in a Mac terminal yields:

/private/tmp/com.apple.launchd.hwPdpV4Kmb/org.xquartz:0

Note that the full response in terminal for "nrniv" is...

/Library/Frameworks/Python.framework/Versions/3.12/bin/nrniv:10: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
from pkg_resources import working_set
can't open DISPLAY

A secondary concern is that installing via pip3 does not tell me if/where I have installed anything that is a Mac app such as nrngui. Note that I cannot find a Mac dmg or pkg installer. I see nothing at https://github.com/neuronsimulator/nrn/releases, and the link for "PKG Installer" is broken at https://nrn.readthedocs.io/en/8.2.4/.
hines
Site Admin
Posts: 1691
Joined: Wed May 18, 2005 3:32 pm

Re: can't open DISPLAY

Post by hines »

I just uploaded a mac pkg file at https://github.com/neuronsimulator/nrn/ ... /tag/8.2.4
It is called nrn-8.2.4-12-g64efe0a14-macosx-10.9-universal2-py-38-39-310-311-312.pkg
Please try that and let me know if it is not fully functional

I think we are in the middle of fixing a newest xquartz/python12/nrn wheel issue. One can hope your issue would disappear when that is resolved.
installing via pip3 does not tell me if/where I have installed anything that is a Mac app such as nrngui.
I'm not sure how to expand pip's verbosity in that regard. All the runnable things installed should be in the same place as `which python3.12`
fietkiewicz
Posts: 18
Joined: Thu Jun 27, 2013 5:13 pm
Location: Hobart and William Smith Colleges
Contact:

Re: can't open DISPLAY

Post by fietkiewicz »

Thanks, but unfortunately it didn't work. Using Mac terminal, I still get the same error. Opening nrngui.app through Applications/NEURON produces this version of the error:

<stdin>:149: SyntaxWarning: invalid escape sequence '\.'
<stdin>:197: SyntaxWarning: invalid escape sequence '\.'
Attempt to fix nrniv failure using: eval "`mk_nrnpyenv.sh`" failed.
can't open DISPLAY
nrngui exit status was 1
Press return key to exit

As additional backstory, I unsuccessfully tried to install the app on my M2 back in November/December 2023 and never got it to open at that time. I did uninstall that before installing with the new pkg file.
ramcdougal
Posts: 267
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: can't open DISPLAY

Post by ramcdougal »

Do any other X11 applications work?

e.g. what happens if you run "xeyes" from the terminal?
fietkiewicz
Posts: 18
Joined: Thu Jun 27, 2013 5:13 pm
Location: Hobart and William Smith Colleges
Contact:

Re: can't open DISPLAY

Post by fietkiewicz »

Ah, there's a clue. Doesn't work from Mac terminal, giving the following error:

Error: Can't open display: /private/tmp/com.apple.launchd.twr4Ugscqx/org.xquartz:0

But it does work from within an Xquartz terminal. I guess I'll try updating/reinstalling Xquartz next.
hines
Site Admin
Posts: 1691
Joined: Wed May 18, 2005 3:32 pm

Re: can't open DISPLAY

Post by hines »

I have an Apple M1 Ventura 13.6, xquartz 2.8.5, and a bunch of pythons including python-3.12.2. I'll upgrade to Sonoma 14.3.1 and see what happens.
fietkiewicz
Posts: 18
Joined: Thu Jun 27, 2013 5:13 pm
Location: Hobart and William Smith Colleges
Contact:

Re: can't open DISPLAY

Post by fietkiewicz »

On my end, no luck yet after reinstalling Xquartz. The latest version is from January 2023 (same version that I already had installed), but I uninstalled/reinsntalled and still get the same error with xeyes. There are several threads out there on this kind of Xquartz error, but I haven't found any that were helpful yet.
hines
Site Admin
Posts: 1691
Joined: Wed May 18, 2005 3:32 pm

Re: can't open DISPLAY

Post by hines »

After installing Sonoma, neurondemo started from a terminal and the graphics works. I do see the

Code: Select all

<stdin>:149: SyntaxWarning: invalid escape sequence '\.'
<stdin>:197: SyntaxWarning: invalid escape sequence '\.'
oc>
and will try to trace that down. But it does not seem related to the GUI issue.

In my case, xeyes works properly when launched from a terminal window.

There are a few items on the web about Sonoma xquartz, but I can't determine if any are relevant to your situation.
ramcdougal
Posts: 267
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: can't open DISPLAY

Post by ramcdougal »

I'm not saying you should do this, but just to double-check, do NEURON's graphics work when NEURON is launched from an xterminal?
hines
Site Admin
Posts: 1691
Joined: Wed May 18, 2005 3:32 pm

Re: can't open DISPLAY

Post by hines »

Yes. The graphics work when nrngui is launched from an xterm. (the xterm was launched from a terminal window)
fietkiewicz
Posts: 18
Joined: Thu Jun 27, 2013 5:13 pm
Location: Hobart and William Smith Colleges
Contact:

Re: can't open DISPLAY

Post by fietkiewicz »

Yes, I can start nrngui from an Xquartz terminal (started from the Xquartz app menu). I hadn't tried this correctly before because, for some reason, I was always typing "nrniv" from the command line in both the Xquartz terminal and Mac terminal. But either way, nrngui does not work for me using Mac terminal, nor by using nrngui.app in Applications. Additionally, I can import NEURON via Python either. All of those (app, terminal, and python) produce "can't open DISPLAY".
fietkiewicz
Posts: 18
Joined: Thu Jun 27, 2013 5:13 pm
Location: Hobart and William Smith Colleges
Contact:

Re: can't open DISPLAY

Post by fietkiewicz »

I had some success from the Mac terminal by setting the DISPLAY env var:

export DISPLAY=:0

That enables me to run nrngui and neurondemo from the terminal when the XQuartz app is running. It does not enable me to launch the .app versions through the OS GUI. Note that the default value of DISPLAY was /private/tmp/com.apple.launchd.jTW25EH48E/org.xquartz:0
hines
Site Admin
Posts: 1691
Joined: Wed May 18, 2005 3:32 pm

Re: can't open DISPLAY

Post by hines »

That's great progress. Sadly, I don't know how to diagnose issues at the DISPLAY level of XQuartz so am at a loss as to how to extend the working behavior to launching by double clicking the app icons.

When the app icon is launched, does a terminal window pop up? And is the value of DISPLAY in that terminal the "working" value of

Code: Select all

DISPLAY=:0
fietkiewicz
Posts: 18
Joined: Thu Jun 27, 2013 5:13 pm
Location: Hobart and William Smith Colleges
Contact:

Re: can't open DISPLAY

Post by fietkiewicz »

A terminal window does open but does not offer a prompt for commands:

<stdin>:149: SyntaxWarning: invalid escape sequence '\.'
<stdin>:197: SyntaxWarning: invalid escape sequence '\.'
Attempt to fix nrniv failure using: eval "`mk_nrnpyenv.sh`" failed.
can't open DISPLAY
nrngui exit status was 1
Press return key to exit

My guess is that DISPLAY is set as something of the form "/private/tmp/com.apple.launchd", which is the default value that I would find from a Mac terminal to begin with. I've read some threads out there that mention this "launcher", but I don't understand what it is.

As a separate idea, it seems that xquartz can also be installed on a Mac using brew. I'm trying that, but I can't seem to get brew to work (was never installed on this M2 before).
hines
Site Admin
Posts: 1691
Joined: Wed May 18, 2005 3:32 pm

Re: can't open DISPLAY

Post by hines »

A terminal window does open but does not offer a prompt for commands:
The launch mechanism dates back to Macos 9. I never learned xcode sufficiently to bring it into the 21st century. Anyway, double clicking on nrngui.app
after a few intermediate steps ultimately starts a terminal window that executes the bash shell script /Applications/NEURON/bin/nrngui.sh

You can edit the nrngui.sh script to echo some information, eg, insert after the initial comment

Code: Select all

echo "DISPLAY=$DISPLAY
<stdin>:149: SyntaxWarning: invalid escape sequence '\.'
<stdin>:197: SyntaxWarning: invalid escape sequence '\.'
Attempt to fix nrniv failure using: eval "`mk_nrnpyenv.sh`" failed.
This is fixed in the latest uploaded pkg file at https://github.com/neuronsimulator/nrn/ ... /tag/8.2.4
It's a longshot but it might be best to install that first.
By the way, a few lines are printed in the terminal when it is lauched which then scroll off the top of the terminal. You can see them by scrolling the terminal.
Post Reply