os.execv

Post Reply
pfortier
Posts: 5
Joined: Sun Sep 22, 2024 1:59 pm

os.execv

Post by pfortier »

On ubuntu jammy, I installed neuron using:
sudo apt install python3-pip
sudo pip3 install neuron

I ran nrgui and it worked.
Then I ran nrnivmodl to compile modules and it completed successfully.
Then I ran again nrngui and got the following error:

Traceback (most recent call last):
File "/home/pfortier/project/x86_64/special.nrn", line 123, in <module>
os.execv(exe, sys.argv)
FileNotFoundError: [Errno 2] No such file or directory

I checked using "ls -l x86_64/special*" and found the file /home/pfortier/project/x86_64/special.nrn does exist:
-rwxr-xr-x 1 pfortier pfortier 4.5K Sep 22 13:21 x86_64/special
-rwxr-xr-x 1 pfortier pfortier 4.5K Sep 22 12:58 x86_64/special.nrn
Furthermore, line 123 of x86_64/special.nrn contains "os.execv(exe, sys.argv)"

I would appreciate help to solve this problem.
ted
Site Admin
Posts: 6384
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: os.execv

Post by ted »

In an empty directory launch python 3 from the command line.
In Python execute
from neuron import h
If that works, execute
soma = h.Section("soma")
If something fails, at which step did that happen, and what was the error message?
pfortier
Posts: 5
Joined: Sun Sep 22, 2024 1:59 pm

Re: os.execv

Post by pfortier »

All but one file has the same permissions so I used "chmod 750 gstim.mod" instead of 664 to match the others with 750.
I deleted the directory x86_64 and ran nrnivmodl again which completed successfully again.
Then I ran nrngui and it worked perfectly.

The only change made was to the file permission of gstim.mod from 664 to 750 so I must assume that this was the problem.
pfortier
Posts: 5
Joined: Sun Sep 22, 2024 1:59 pm

Re: os.execv

Post by pfortier »

ted wrote: Mon Sep 23, 2024 12:36 pm In an empty directory launch python 3 from the command line.
In Python execute
from neuron import h
If that works, execute
soma = h.Section("soma")
If something fails, at which step did that happen, and what was the error message?
No error occurred.
But as mentioned in an addendum, changing the permissions of gstim.mod from 664 to 750 and re-running nrnivmodl solved the issue.
Thanks
ted
Site Admin
Posts: 6384
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: os.execv

Post by ted »

Thanks for the followup! Now I have a question for you:

Given the (to me at least) relatively nonspecific and noninformative error messages, what led you to check the mod file permissions? After all, nrnivmodl completed without complaint.
pfortier
Posts: 5
Joined: Sun Sep 22, 2024 1:59 pm

Re: os.execv

Post by pfortier »

ted wrote: Mon Sep 23, 2024 11:12 pm Thanks for the followup! Now I have a question for you:

Given the (to me at least) relatively nonspecific and noninformative error messages, what led you to check the mod file permissions? After all, nrnivmodl completed without complaint.
I decided to take a step back towards a tutorial "http://web.mit.edu/neuron_v7.4/nrntuthtml/index.html" suggested by "https://www.neuron.yale.edu/neuron/docs".
running nrngui worked (same as I experienced)
running nrnivmodl to compile the calcium mechanism worked (same as I experienced)
running nrngui worked (this was where an error occurred for my simulation code)
So I concluded that the installation of neuron was good but something in my mod files was wrong. I noticed that the permissions of 1 file were different from the others so I made it the same as the others, re-ran nrnivmodl and discovered that the problem was gone.
hines
Site Admin
Posts: 1710
Joined: Wed May 18, 2005 3:32 pm

Re: os.execv

Post by hines »

The only change made was to the file permission of gstim.mod from 664 to 750 so I must assume that this was the problem.
I glad the problem went away. That's not a bad reason to move on. However I'm quite puzzled how that change could fix a

Code: Select all

FileNotFoundError: [Errno 2] No such file or directory
when the file in question

Code: Select all

/home/pfortier/project/x86_64/special.nrn
in fact exists.

I'd be curious if your problem returns if you

Code: Select all

chmod 664 gstim.mod
rm -r -f x86_64
nrnivmodl
nrngui
pfortier
Posts: 5
Joined: Sun Sep 22, 2024 1:59 pm

Re: os.execv

Post by pfortier »

hines wrote: Wed Sep 25, 2024 7:14 am I'd be curious if your problem returns
I reverted gstim.mod to permissions 664, deleted the x86_64 directory, ran nrnivmodl and then nrngui.
The problem did not reappear.
I can't explain it but I can continue with my simulation project :-)
hines
Site Admin
Posts: 1710
Joined: Wed May 18, 2005 3:32 pm

Re: os.execv

Post by hines »

Another detail that gave me a bit of an itch but we can ignore for now is
File "/home/pfortier/project/x86_64/special.nrn", line 123, in <module>
os.execv(exe, sys.argv)
FileNotFoundError: [Errno 2] No such file or directory
I interpret that as a failure with respect to the value of exe. I.e special.nrn actually exists and tries to execute ' os.execv(exe, sys.argv)
I'd like to modify special.nrn to print the value of exe before line 123.
But when I create a python virtual environment, pip install neuron, and use nrnivmodl in a model folder I happen to have laying around,
I see that x86_64/special.nrn is a binary file. I guess I'm not quite clear where special.nrn came from and will have to figure it out.

Anyway, I suspect (without evidence) that the original problem was somehow related to sudo.
Post Reply