strath-sdr / rfsoc_qpsk

PYNQ example of using the RFSoC as a QPSK transceiver.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError and Javascript Error

wbmaguire opened this issue · comments

Hi There,
Unfortunately when I try to use jupyterlab or jupyter notebook I get the following error

AttributeError: module 'plotly.graph_objs' has no attribute 'FigureWidget'

When I try to use jupyterlab I get the additional error
Javascript Error: require is not defined

I installed the packages as per https://github.com/strath-sdr/rfsoc_qpsk

pip3 install --upgrade git+https://github.com/strath-sdr/rfsoc_qpsk.git

jupyter labextension install @jupyter-widgets/jupyterlab-manager@0.38 --no-build
jupyter labextension install plotlywidget@0.10.0 --no-build
jupyter labextension install @jupyterlab/plotly-extension@0.18 --no-build
jupyter lab build

systemctl restart jupyter

I think there is a package compatibility issue with the install. My installed packages are
root@pynq:/home/xilinx# pip3 list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) inyour pip.conf under the [list] section) to disable this warning.
2ping (4.1)
alabaster (0.7.8)
asn1crypto (0.24.0)
attrs (17.4.0)
Babel (2.4.0)
beautifulsoup4 (4.6.0)
bleach (2.1.2)
certifi (2019.6.16)
cffi (1.11.5)
chardet (3.0.4)
Click (7.0)
cryptography (2.1.4)
cycler (0.10.0)
Cython (0.26.1)
dash (0.21.1)
dash-core-components (0.23.0)
dash-html-components (0.11.0)
dash-renderer (0.13.0)
decorator (4.4.0)
deltasigma (0.2.2)
docutils (0.14)
entrypoints (0.2.3.post1)
Flask (1.0.3)
Flask-Compress (1.4.0)
html5lib (0.999999999)
httplib2 (0.9.2)
idna (2.8)
imagesize (0.7.1)
imutils (0.5.2)
ipykernel (4.8.2)
ipython (5.5.0)
ipython-genutils (0.2.0)
ipywidgets (6.0.0)
itsdangerous (1.1.0)
Jinja2 (2.10)
jsonschema (2.6.0)
jupyter-client (5.2.2)
jupyter-contrib-core (0.3.3)
jupyter-contrib-nbextensions (0.5.1)
jupyter-core (4.4.0)
jupyter-highlight-selected-word (0.2.0)
jupyter-latex-envs (1.4.6)
jupyter-nbextensions-configurator (0.4.1)
jupyterlab (0.35.6)
jupyterlab-server (0.2.0)
keyring (10.6.0)
keyrings.alt (3.0)
lxml (4.2.1)
MarkupSafe (1.0)
matplotlib (2.1.1)
mistune (0.8.3)
mpmath (1.0.0)
nbconvert (5.3.1)
nbformat (4.4.0)
nbsphinx (0.3.1)
nbwavedrom (0.2.0)
netifaces (0.10.4)
networkx (1.11)
nose (1.3.7)
notebook (5.2.2)
numexpr (2.6.4)
numpy (1.13.3)
olefile (0.45.1)
pandas (0.22.0)
pandocfilters (1.4.2)
pexpect (4.2.1)
pickleshare (0.7.4)
Pillow (5.1.0)
pip (9.0.1)
plotly (3.9.0)
pluggy (0.6.0)
ply (3.11)
prompt-toolkit (1.0.15)
psutil (5.4.2)
py (1.5.2)
pycparser (2.18)
pycrypto (2.6.1)
pycurl (7.43.0.1)
pyeda (0.28.0)
Pygments (2.2.0)
pygobject (3.26.1)
pygraphviz (1.4rc1)
pynq (2.4)
pyparsing (2.2.0)
pytest (3.3.2)
pytest-sourceorder (0.5)
python-apt (1.6.0)
python-dateutil (2.6.1)
pytz (2019.1)
PyWavelets (0.5.1)
pyxdg (0.25)
PyYAML (3.12)
pyzmq (16.0.2)
requests (2.22.0)
requests-unixsocket (0.1.5)
retrying (1.3.3)
rfsoc-qpsk (1.0)
rise (5.2.0)
roman (2.0.0)
scikit-image (0.13.1)
scipy (0.19.1)
SecretStorage (2.3.1)
setuptools (39.0.1)
simplegeneric (0.8.1)
six (1.12.0)
Sphinx (1.6.7)
sphinx-rtd-theme (0.4.3)
SQLAlchemy (1.1.11)
ssh-import-id (5.7)
sympy (1.1.1)
systemd-python (234)
tables (3.4.2)
terminado (0.7)
testpath (0.3.1)
tornado (4.5.3)
traitlets (4.3.2)
transitions (0.5.3)
unattended-upgrades (0.1)
urllib3 (1.25.3)
uvloop (0.8.1)
wcwidth (0.1.7)
webencodings (0.5)
Werkzeug (0.15.4)
wheel (0.30.0)
widgetsnbextension (2.0.1)
xrfclk (0.1)
xrfdc (0.1)
root@pynq:/home/xilinx#

Therefore I would be grateful if someone would advise me if they have seen this issue and if there are any fixes available please provide the details.

Regards

Walter

Hi Walter,

Thanks for the report. It looks like the AttributeError is due to your version of ipywidgets (6.0.0). Could you try updating this?

pip3 install ipywidgets==7.4.2

Just out of interest, are you using the PYNQ v2.4 image? This should have had ipywidgets==7.4.2 already... maybe it got downgraded by another package that has been installed. I'll add this as an explicit dependency.

As for the Javascript error, this is safe to ignore and will be fixed for the next PYNQ release. Please do run this in JupyterLab because we need some Lab features to make the plots work! If you want to get rid of this error before the next release, you can run the following on the board to patch it out:

 patch --ignore-whitespace /usr/local/lib/python3.6/dist-packages/pynq/lib/pynqmicroblaze/magic.py  << 'EOF'
--- /usr/local/lib/python3.6/dist-packages/pynq/lib/pynqmicroblaze/magic.py	2019-02-21 20:26:36.000000000 +0000
+++ magic.py	2019-04-08 22:45:31.000000000 +0000
@@ -98,4 +98,4 @@
 if instance:
     get_ipython().register_magics(MicroblazeMagics)
-    display_javascript(js, raw=True)
+    #display_javascript(js, raw=True)
EOF

Cheers,
Craig

Hi Craig,
Just an update which might help other developers. I had an issue with a later build producing the same results with Jupyter. I think the PYNQ build is grabbing different Jupyter and supporting package states which can cause errors with the dependencies needed. For example when I tried to do a rebuild from source without changing anything I get errors

jupyter labextension install @jupyter-widgets/jupyterlab-manager@0.38 --no-build
An error occurred.
ValueError:
"@jupyter-widgets/jupyterlab-manager@0.38.1" is not compatible with the current JupyterLab
Conflicting Dependencies:

For the purposes of this description PYNQ is installed in my home directory. My host ip is 192.168.1.140 and the Xilinx Vivado, SDK and SDx tools are located in /tools/Xilinx. Petalinux is installed at /tools/pkg
Description uses C format for block comments.

The following steps appear to work

  1. git clone -v --recurse-submodules --progress "https://github.com/Xilinx/PYNQ.git"
    /* Checkout version 2.4 and avoid detached Head in Git by generating a local branch.*/

  2. git checkout tags/v2.4 -b mybranch_2.4

  3. git submodule update --init --recursive
    /Setup the build tools/

  4. cd ~/PYNQ/sdbuild

  5. ./scripts/setup.sh

  6. exit

  7. /* Now build the ZCU111 target. Open up a new command prompt and setup the Xilinx tool environments.*/
    source /tools/Xilinx/Vivado/2018.3/settings64.sh
    source /tools/pkg/petalinux/2018.3/settings.sh

  8. /* Grab the ZCU111 board files from https://github.com/Xilinx/ZCU111-PYNQ and follow the instructions posted. In my case I just copy the folder /home/developer/ZCU111-PYNQ /ZCU111 to the ~/PYNQ/boards/. I also remove the other boards from this directory because I am only interested in building the ZCU111 design. Note you may need to grab a ZCU111 bsp from Xilinx if you are not using your own. /
    cd ~/PYNQ/sdbuild
    make clean
    make
    /
    At the end of this step the image file will be ~/PYNQ/sdbuild/output/ZCU111-2.4.img*/

  9. /* Build the SD card, assuming a 32GByte SD. Insert the SD card. Warning make sure you are targeting the correct device for the following steps. On my system the SD is located at /dev/sda . This may be different on other systems so make sure you are targeting the correct device. Otherwise you can overwrite the wrong target disk, not pretty. When plugging the SD card into the Linux machine don't mount it as the dd tool needs the device to be unmounted. */
    sudo dd if=ZCU111-2.4.img | pv -s 7G | dd of=/dev/sda bs=8192

  10. /*Now resize the disk. The current PYNQ image for the ZCU111 is about 7G in size. I use gparted to resize the file system to 32G. */
    sudo gparted /*Use the GUI to change the size of the root file system partition. */

  11. /* Setup the ZCU111 to have a fixed IP address. PYNQ uses the Ubuntu 18.04LTS distribution which uses a yaml file in /etc/netplan to setup network interfaces. For my setup the ZCU111 is set to have a fixed IP address 192.168.1.32. The content of the associated myconf.yaml file is (note tabs are displaying in post)
    "network:
    ethernets:
    eth0:
    addresses: [192.168.1.32/24]
    gateway4: 192.168.1.254
    nameservers:
    addresses: [8.8.8.8,8.8.4.4]
    dhcp4: no

    version: 2"
    /* Once myconf.yaml file has been created in the /etc/netplan directory reboot. Note this manual task could be automated by writing a package to do it in the boards/ZCU111/packages/ directory such that it happens when the PYNQ image is build. I will post the package at some point when I get around to doing it */
    sudo shutdown -r now

  12. /* Now rfsoc+qpsk demo needs to be fetched and the Jupyterlab needs to be setup to run the rfsoc demo on the target. Open a browser and enter 192.168.1.32:9090/lab. Note use your ZCU111 assigned IP address. Log in password is "xilinx". In Jupyter lab open up the terminal. Note to paste commands into the Jupyter Terminal you need to hold the shift key while performing the cut and paste mouse clicks. */
    jupyter lab clean
    pip3 install ipywidgets --upgrade
    pip3 install --upgrade git+https://github.com/strath-sdr/rfsoc_qpsk.git
    jupyter nbextension enable --py widgetsnbextension
    jupyter labextension install @jupyter-widgets/jupyterlab-manager@ --no-build
    jupyter labextension install plotlywidget@0.10.0 --no-build
    jupyter labextension install @jupyterlab/plotly-extension@0.18 --no-build
    jupyter lab build
    systemctl restart jupyter

  13. /* This step is probably not required but I usually do a reboot. From a Linux Terminal, not the Jupyter Terminal */
    sudo shutdown -r now

  14. /* Run the Jupyter rfsoc_qpsk Notebook. This is done by opening a browser http://192.168.8.32:9090 and opening the file /notebooks/rfsoc_qpsk/RFSoC_QPSK_Loopback.ipynb. I was unable to get jupyterlab to render the graphs. I think this might have something to do with the Jupyterlab Java issue.*/

Anyway, hope this helps

Regards

Walter

Hi Walter,

Great write up of the PYNQ build steps — thanks for that. You're right about the latest versions of some python packages getting pulled in at build time. This non-determinism is something that has bitten me in the past too... I'm sure the PYNQ folks would be grateful if you raise this as an issue on the PYNQ repo?

You mentioned in point 14 that the graphs still weren't rendering. This would happen if you navigated to the Jupyter Notebook interface (at http://192.168.8.32:9090/), rather than the Jupyter Lab interface (at http://192.168.8.32:9090/lab).

Cheers,
Craig