Trying to make PYNQ documentation from /docs directory

OS: Linux-Mint 20.3 = Ubuntu 20.04 (focal)
PYNQ_3.0.1
Python 3.12.0
sphinx (sphynx-build) 3.2.6
All requirements mentioned in the requirements.txt file are installed

Trying to build the PYNQ docs.

PYNQ/docs
Running in a terminal make html
Getting this error

phinx-build -b html -d build/doctrees   source build/html
Running Sphinx v7.2.6
/home/myself/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pydantic/_internal/_config.py:317: UserWarning: Valid config keys have changed in V2: \* 'underscore_attrs_are_private' has been removed
warnings.warn(message, UserWarning)

Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/home/myself/.pyenv/versions/3.12.0/lib/python3.12/site-packages/sphinx/config.py", line 358, in eval_config_file
    exec(code, namespace)  # NoQA: S102
    ^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/netdrive/myself/Projects/Downloads/PYNQ/docs/source/conf.py", line 37, in <module>
    import pynq
  File "/mnt/netdrive/myself/Projects/Downloads/PYNQ/pynq/__init__.py", line 11, in <module>
    from .overlay import DefaultHierarchy, DefaultIP, Overlay, UnsupportedConfiguration
  File "/mnt/netdrive/myself/Projects/Downloads/PYNQ/pynq/overlay.py", line 13, in <module>
    from pynqmetadata.frontends import Metadata
  File "/home/myself/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pynqmetadata/__init__.py", line 5, in <module>
    from .models.bit_field import BitField
  File "/home/myself/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pynqmetadata/models/__init__.py", line 9, in <module>
    from .dfx_core import DFXCore
  File "/home/myself/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pynqmetadata/models/dfx_core.py", line 10, in <module>
    @dataclass(repr=False)
     ^^^^^^^^^^^^^^^^^^^^^
  File "/home/myself/.pyenv/versions/3.12.0/lib/python3.12/dataclasses.py", line 1256, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myself/.pyenv/versions/3.12.0/lib/python3.12/dataclasses.py", line 994, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/myself/.pyenv/versions/3.12.0/lib/python3.12/dataclasses.py", line 852, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'pynqmetadata.models.vlnv.Vlnv'> for field vlnv is not allowed: use default_factory

make: *** [Makefile:57: html] Error 2

Has somebody any idea what is going wrong here?

Many thanks in advance,

1 Like

I have almost the same issue, hope someone can help with this. I also tried the Conda environment as the document suggests, but still have issues when running the code.

Here is error I got:

$ python tests/vecadd.py
Compiling PyLog code ...
/home/hongzhet/anaconda3/lib/python3.11/site-packages/pydantic/_internal/_config.py:322: UserWarning: Valid config keys have changed in V2:
* 'underscore_attrs_are_private' has been removed
  warnings.warn(message, UserWarning)
Traceback (most recent call last):
  File "/home/data/hongzhet/otherProjects/pylog/tests/vecadd.py", line 31, in <module>
    pl_vecadd(a, b, c)
  File "/home/hongzhet/otherProjects/pylog/pylog.py", line 145, in wrapper
    return plrt.call(args)
           ^^^^^^^^^^^^^^^
  File "/home/hongzhet/otherProjects/pylog/runtime.py", line 50, in call
    return self.call_xrt(args)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/hongzhet/otherProjects/pylog/runtime.py", line 108, in call_xrt
    from pynq import Overlay
  File "/home/hongzhet/anaconda3/lib/python3.11/site-packages/pynq/__init__.py", line 4, in <module>
    from . import pl_server
  File "/home/hongzhet/anaconda3/lib/python3.11/site-packages/pynq/pl_server/__init__.py", line 18, in <module>
    from .embedded_device import EmbeddedDevice
  File "/home/hongzhet/anaconda3/lib/python3.11/site-packages/pynq/pl_server/embedded_device.py", line 11, in <module>
    from pynqmetadata.frontends import Metadata
  File "/home/hongzhet/anaconda3/lib/python3.11/site-packages/pynqmetadata/__init__.py", line 5, in <module>
    from .models.bit_field import BitField
  File "/home/hongzhet/anaconda3/lib/python3.11/site-packages/pynqmetadata/models/__init__.py", line 9, in <module>
    from .dfx_core import DFXCore
  File "/home/hongzhet/anaconda3/lib/python3.11/site-packages/pynqmetadata/models/dfx_core.py", line 10, in <module>
    @dataclass(repr=False)
     ^^^^^^^^^^^^^^^^^^^^^
  File "/home/hongzhet/anaconda3/lib/python3.11/dataclasses.py", line 1220, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hongzhet/anaconda3/lib/python3.11/dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/hongzhet/anaconda3/lib/python3.11/dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'pynqmetadata.models.vlnv.Vlnv'> for field vlnv is not allowed: use default_factory

It’s probably because you are using python 3.12, you should retry with python 3.10