# Ubuntu parallel port

**URL:** <https://discourse.psychopy.org/t/ubuntu-parallel-port/43964>\
**Category:** Builder\
**Created:** [February 19, 2025, 3:59pm UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964 "2025-02-19T15:59:45Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 19, 2025, 3:59pm UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/1 "2025-02-19T15:59:45Z")

</div>

If this template helps then use it. If not then just delete and start from scratch.

**OS** Ubuntu 22.04 LTS  
**PsychoPy version** (e.g. 1.84.x):  
**Standard Standalone? (y/n)** If not then what?: y  
**What are you trying to achieve?:**

I want to send port-triggers via the parallel port to a recording computer. The computer runs Ubuntu 22.04 LTS. I am not familiar with Ubuntu.

The experiment, built with Builder, chrashes with the error message that there is not such port. I tried all ports offered to me by PsychoPy, e.g. parport0 and parport1. A psychophysics-toolbox program can write to the port with the address ‘0378’. So, it is technically possible. How or where do I tell PsychoPy to use this address?

Thanks a lot for any help Jens

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 20, 2025, 10:22am UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/2 "2025-02-20T10:22:34Z")

</div>

Hello

here is the error message

> ## Running: /home/busch/Documents/JEBAR/PermissiveSubjectsEEG/PermissiveSubject\_lastrun.py

13.1966 INFO Loaded monitor calibration from [‘2025\_02\_19 14:59’]  
13.2144 INFO Loaded monitor calibration from [‘2025\_02\_19 14:59’]  
0.6200 WARNING Monitor specification not found. Creating a temporary one…  
Traceback (most recent call last):  
ioHub Server Process Completed With Code: 0  
File “/home/busch/Documents/JEBAR/PermissiveSubjectsEEG/PermissiveSubject\_lastrun.py”, line 2364, in   
run(  
File “/home/busch/Documents/JEBAR/PermissiveSubjectsEEG/PermissiveSubject\_lastrun.py”, line 462, in run  
p\_port = parallel.ParallelPort(address=‘/dev/parport0’)  
File “/home/busch/.psychopy\_py310/lib/python3.10/site-packages/psychopy/parallel/\_linux.py”, line 41, in **init**  
self.port = pyp.Parallel(address)  
File “/home/busch/.psychopy\_py310/lib/python3.10/site-packages/parallel/parallelppdev.py”, line 190, in **init**  
self.PPCLAIM()  
File “/home/busch/.psychopy\_py310/lib/python3.10/site-packages/parallel/parallelppdev.py”, line 221, in PPCLAIM  
fcntl.ioctl(self.\_fd, PPCLAIM)  
OSError: [Errno 6] No such device or address  
################# Experiment ended with exit code 1 [pid:9083] #################

Thanks a lot for any help

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![aforren1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/aforren1/32/44286_2.png) [@aforren1](https://discourse.psychopy.org/u/aforren1)\
**Post date:** [February 20, 2025, 10:57am UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/3 "2025-02-20T10:57:30Z")

</div>

Do you see anything if you type `ls /dev/ | grep par` in a terminal? e.g.

```auto
$ ls /dev/ | grep par
parport0

```

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 20, 2025, 11:31am UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/4 "2025-02-20T11:31:14Z")

</div>

Hello @aforren1

yes, I see parport0 and parport1 with `ls /dev | grep par`.

I specified the parallel port in the Builder as follows

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/f/a/fa00812da0d8c848271cb7ada9f08ef59df5eeba.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/9/a/9ab1be9450d970e75f2c34b57cf1213d86ed5778.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/9/4/940928275245486f55dfcba8bdea554cf3c0584c.png)

The parallel port is set in the preferences as follows

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/2/6/2623de1e80e9f62fe19896164c76dbf0fa3e3723.png)

So, it should in principle work, shouldn’t it?

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![aforren1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/aforren1/32/44286_2.png) [@aforren1](https://discourse.psychopy.org/u/aforren1)\
**Post date:** [February 20, 2025, 3:37pm UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/5 "2025-02-20T15:37:50Z")

</div>

> [@JensBoelte](#):
>
> So, it should in principle work, shouldn’t it?

Hmm, I would think so?

I just tried a Builder task with just the parallel component (in v2024.2.4), and it was happy? The only other straightforward thing that comes to mind would be that the user isn’t a member of the `lp` group (or whichever one is relevant to parallel port access), but that shouldn’t be it if a PTB task works…

Have you tried a script like

```auto
from psychopy import parallel
parallel.ParallelPort(address=‘/dev/parport0’)

```

or

```auto
import parallel
p = parallel.Parallel() 

```

Just to cut out the Builder as a cause?

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 20, 2025, 4:07pm UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/6 "2025-02-20T16:07:02Z")

</div>

Hello @aforren1

I can give it a try on Monday. Thanks a lot.

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 24, 2025, 3:45pm UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/7 "2025-02-24T15:45:28Z")

</div>

Hello @aforren1

The two min toy experiments with

```auto
from psychopy import parallel
parallel.ParallelPort(address = '/dev/parport0')

```

or

```auto
import parallel
p = parallel.Parallel()

```

exit with no error. This is really strange on line 21 of my experiment `parallel`is imported

```auto
from psychopy import sound, gui, visual, core, data, event, logging, clock, colors, layout, hardware, parallel

```

It is then initialized in the routine in which it is first called.

```auto
 p_port = parallel.ParallelPort(address='/dev/parport0')

```

Still the error remains

```auto
 File "/home/busch/Documents/JEBAR/PermissiveSubjectsEEG/PermissiveSubject.py", line 2364, in <module>
    run(
  File "/home/busch/Documents/JEBAR/PermissiveSubjectsEEG/PermissiveSubject.py", line 462, in run
    p_port = parallel.ParallelPort(address='/dev/parport0')
  File "/home/busch/.psychopy_py310/lib/python3.10/site-packages/psychopy/parallel/_linux.py", line 41, in __init__
    self.port = pyp.Parallel(address)
  File "/home/busch/.psychopy_py310/lib/python3.10/site-packages/parallel/parallelppdev.py", line 190, in __init__
    self.PPCLAIM()
  File "/home/busch/.psychopy_py310/lib/python3.10/site-packages/parallel/parallelppdev.py", line 221, in PPCLAIM
    fcntl.ioctl(self._fd, PPCLAIM)
OSError: [Errno 6] No such device or address

```

More ideas?

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![aforren1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/aforren1/32/44286_2.png) [@aforren1](https://discourse.psychopy.org/u/aforren1)\
**Post date:** [February 24, 2025, 4:02pm UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/8 "2025-02-24T16:02:58Z")

</div>

Weird! Only other thought is that the port is claimed by something else? I don’t actually know very much about it, but it looks like PPCLAIM will fail if another program has already claimed the port with PPEXCL? See [here](http://www.linuxfocus.org/common/src/article205/ppdev.html). I wonder if pyparallel or ppdev on the MATLAB side doesn’t clean up properly? Easy check would be to reboot, then run the Builder task.

---

<div class="post-metadata">

**Author:** ![aforren1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/aforren1/32/44286_2.png) [@aforren1](https://discourse.psychopy.org/u/aforren1)\
**Post date:** [February 24, 2025, 4:15pm UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/9 "2025-02-24T16:15:54Z")

</div>

One other guess-- if you have multiple instances of the Parallel component in Builder, I think they’d conflict? I.e. if you make multiple parallel port objects with the same address, the second one instantiated would fail because the port’s already been exclusively claimed?

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 25, 2025, 8:34am UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/10 "2025-02-25T08:34:55Z")

</div>

Hello

> [@aforren1](#):
>
> Easy check would be to reboot and then run the builder task.

I doubt the port is being used. The computer is turned off and on after each experiment.

> [@aforren1](#):
>
> if you have multiple instances of the parallel component in Builder, I think they’d conflict?

Currently I only have one parallel port component. So this tip does not address the problem.

I wonder if it is a problem that I am running Psychopy in a virtual environment?

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![aforren1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/aforren1/32/44286_2.png) [@aforren1](https://discourse.psychopy.org/u/aforren1)\
**Post date:** [February 25, 2025, 3:33pm UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/11 "2025-02-25T15:33:35Z")

</div>

> [@JensBoelte](#):
>
> I wonder if it is a problem that I am running Psychopy in a virtual environment?

I wouldn’t think a Python virtual environment would make a difference, unless you happen to mean some container env (e.g. Docker, …). For one data point, the Builder test I did was running from a Python 3.10 venv.

Can you share the PsychoPy version & task code?

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [February 25, 2025, 3:48pm UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/12 "2025-02-25T15:48:33Z")

</div>

> [@JensBoelte](#):
>
> I wonder if it is a problem that I am running Psychopy in a virtual environment?

I certainly find that I can’t do while running in a VS Code virtual environment (plugin/external library related). Can you test?

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 26, 2025, 8:47am UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/13 "2025-02-26T08:47:49Z")

</div>

Hello

> [@aforren1](#):
>
> Can you share the PsychoPy version & task code?

I will be able to share the code tomorrow. Today, I do not have access to the stimulation PC.

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [February 27, 2025, 12:07pm UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/14 "2025-02-27T12:07:34Z")

</div>

Hello

I created a toy-vesion of my experiment. It just try to send one trigger to the parallel port.  
[TestPPort.psyexp](https://discourse.psychopy.org/uploads/short-url/6F9zmrnBR5ZAj7PlEagtcS8ZCWt.psyexp) (8.5 KB)

The error message changed however.

```auto
 File "/home/busch/Documents/JEBAR/TestPPort_lastrun.py", line 593, in <module>
    run(
  File "/home/busch/Documents/JEBAR/TestPPort_lastrun.py", line 365, in run
    p_port = parallel.ParallelPort(address='/dev/parport0')
  File "/home/busch/.psychopy_py310/lib/python3.10/site-packages/psychopy/parallel/_linux.py", line 41, in __init__
    self.port = pyp.Parallel(address)
  File "/home/busch/.psychopy_py310/lib/python3.10/site-packages/parallel/parallelppdev.py", line 187, in __init__
    self._fd = os.open(self.device, os.O_RDWR)
PermissionError: [Errno 13] Permission denied: '/dev/parport0'

```

Now, the device seems to found but I have not the permission to address it.

Best wishes Jens

---

<div class="post-metadata">

**Author:** ![aforren1](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/aforren1/32/44286_2.png) [@aforren1](https://discourse.psychopy.org/u/aforren1)\
**Post date:** [February 27, 2025, 8:06pm UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/15 "2025-02-27T20:06:49Z")

</div>

I think that suggests

> [@aforren1](#):
>
> user isn’t a member of the `lp` group

though it still doesn’t make sense with the PTB success. What does typing `groups` in the terminal say? Any chance the PTB task is being run as the root user?

---

<div class="post-metadata">

**Author:** ![JensBoelte](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jensboelte/32/9060_2.png) [@JensBoelte](https://discourse.psychopy.org/u/JensBoelte)\
**Post date:** [March 14, 2025, 9:01am UTC](https://discourse.psychopy.org/t/ubuntu-parallel-port/43964/16 "2025-03-14T09:01:56Z")

</div>

Hello

I have given up using the parallel port. I do not know why I cannot access it from within PsychoPy. I am using a USB interface now.

Best wishes Jens
