Error while installing pynq-sklearn

I am using Pynq 3.0.1, The board I am using is pynq Z2. I am trying to implement linear regression and polynomial regression on the pl. I keep getting the following error when I try to install pynq-sklearn.
This is the code I used

!sudo pip3 install git+https://github.com/sfox14/pynq-sklearn.git 

And this is what I get

Collecting git+https://github.com/sfox14/pynq-sklearn.git
  Cloning https://github.com/sfox14/pynq-sklearn.git to /tmp/pip-req-build-m00bxh8g
  Running command git clone --filter=blob:none --quiet https://github.com/sfox14/pynq-sklearn.git /tmp/pip-req-build-m00bxh8g
  Resolved https://github.com/sfox14/pynq-sklearn.git to commit 90819d812578235c84246d31fb134d440c73cf0b
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [22 lines of output]
      Traceback (most recent call last):
        File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 143, in _get_build_requires
          self.run_setup()
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 267, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 158, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 7, in <module>
          import pynq_sklearn
        File "/tmp/pip-req-build-m00bxh8g/pynq_sklearn/__init__.py", line 2, in <module>
          from .base import PynqMixin
        File "/tmp/pip-req-build-m00bxh8g/pynq_sklearn/base.py", line 1, in <module>
          from pynq import Overlay, PL, Xlnk
      ModuleNotFoundError: No module named 'pynq'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I thought it was becase pynq wasn’t installed, but pynq is installed on the board.
I am new to this, so it would be great if anyone of you could help me with this.
The project I am working on is the implementation of linear regression and polynomial regression on pynq z2 . So if there are any resources on doing it, it would be great if you could send it please.
Thank you for your time.

1 Like

Please note that Xlnk() is obsolete since PYNQ v2.5. And the pynq-sklearn repository, as said in its README.md, should be only used with PYNQ v2.1.

Okay so in order to build a linear regression model on the pl, is there no other way to do it?

You can use Vitis HLS to write your own linear regression IP.

Specifically, you can use Vitis HLS to turn your C++ code into RTL design and pack it into an IP. Then, you can integrate the IP into your hardware system in Vivado, and export a bitstream file. Finally, you can download the bitstream to PL and access your IP from PS using the PYNQ library.

Do you know where I can get PYNQ Z2 v2.1 from? I do not have the time to design the ip since my project is due this week. It would be of great help if someone could help me with it.

You can take a look at PYNQ/boards at image_v2.1 · Xilinx/PYNQ · GitHub.

However, there was only BSP files for PYNQ-Z1, not PYNQ-Z2. PYNQ-Z2 BSP files were not present until v2.2. Also, the git repo GitHub - sfox14/pynq-sklearn: Library for PYNQ-based ML accelerators was designed for PYNQ-Z1.

So I guess there’s no way around. Maybe you can try with PYNQ v2.2, though I don’t think it is a good idea to use such legacy versions.

Anyway, good luck with your project. I’d recommend HLS, which is fast and easy to use.