Creating a Window instance caused error: "stack smashing detected"

I am trying to execute the following basic psychopy code:

import psychopy.visual as pv
pv.Window()

Which gives the following error.

*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)

There exist one similar topic with no replies. I am running on an Ubuntu 18.04.05 LTS machine. How can I fix/debug this?