Running pynq outside Jupyter Notebooks

PYNQ Version
Release 2019_10_03 3f63450
(typing pip3 show pynq gives me version 2.5.4)

Board:
PYNQ-Z2

Python3 version:
3.6.5

The issue:
I’m trying to run pynq outside of Jupyter Notebooks.

This is what I have in my hello2.py file:

from pynq import Overlay

That’s all.
I try to run this program using python3 hello2.py

then I get these errors:

"Traceback (most recent call last):
File “hello2.py”, line 1, in
from pynq import Overlay
File “/home/xilinx/.local/lib/python3.6/site-packages/pynq/init.py”, line 33, in
from .pl import PL
File “/home/xilinx/.local/lib/python3.6/site-packages/pynq/pl.py”, line 39, in
from .ps import CPU_ARCH_IS_SUPPORTED, CPU_ARCH, ZYNQ_ARCH, ZU_ARCH
File “/home/xilinx/.local/lib/python3.6/site-packages/pynq/ps.py”, line 322, in
class _ClocksUltrascale(_ClocksMeta):
File “/home/xilinx/.local/lib/python3.6/site-packages/pynq/ps.py”, line 382, in _ClocksUltrascale
IOPLL_CTRL = Register(CRL_APB_ADDRESS + IOPLL_CTRL_OFFSET)
File “/home/xilinx/.local/lib/python3.6/site-packages/pynq/registers.py”, line 115, in init
array = MMIO(address, np.dtype(register_type).itemsize).array
File “/home/xilinx/.local/lib/python3.6/site-packages/pynq/mmio.py”, line 82, in init
device = Device.active_device
File “/home/xilinx/.local/lib/python3.6/site-packages/pynq/pl_server/device.py”, line 94, in active_device
if len(cls.devices) == 0:
File “/home/xilinx/.local/lib/python3.6/site-packages/pynq/pl_server/device.py”, line 78, in devices
cls._devices.extend(DeviceMeta._subclasses[key].probe())
File “/home/xilinx/.local/lib/python3.6/site-packages/pynq/pl_server/device.py”, line 565, in probe
return [XlnkDevice()]
File “/home/xilinx/.local/lib/python3.6/site-packages/pynq/pl_server/device.py”, line 574, in init
self.default_memory = Xlnk()
File “/home/xilinx/.local/lib/python3.6/site-packages/pynq/xlnk.py”, line 133, in init
raise RuntimeError(“Root permission needed by the library.”)
RuntimeError: Root permission needed by the library.
Exception ignored in: <bound method Xlnk.del of <pynq.xlnk.Xlnk object at 0xb573b1b0>>
Traceback (most recent call last):
File “/home/xilinx/.local/lib/python3.6/site-packages/pynq/xlnk.py”, line 150, in del
for key in self.bufmap.keys():
AttributeError: ‘Xlnk’ object has no attribute ‘bufmap’
"
This only happens outside Jupyter Notebooks. Would appreciate any help on how to run pynq outside Jupyter Notebooks. thanks.

UPDATE:

Ok. The error above occurs when I open a terminal through Putty. But when I open a terminal through Jupyter Books, everything works fine. Is there any way to get it to work through Putty also?

UPDATE 2:
Ok. I found out that if I do: sudo python3 hello2.py it works. So the problem was a lack of root permission. So my question now is, how do I log in as root from Putty? If I put in ‘root’ as the username it asks for the password… ‘xilinx’ doesn’t work as the password for root.

sudo
su
xilinx should work as the password.

Can you post a log?

Cathal

That worked. Thanks.

1 Like