chipsalliance / f4pga-v2x

Tool for converting specialized annotated Verilog models into XML needed for Verilog to Routing flow.
https://f4pga-v2x.readthedocs.io/en/latest/
Apache License 2.0
10 stars 12 forks source link

Persistent errors about vtr-xml-utils when attempting to install python-symbiflow-v2x #105

Closed MidsummerNight closed 3 years ago

MidsummerNight commented 3 years ago

v2x-issue-blurred

I was trying to install this v2x tool and first cloned the repository then ran "pip install ." in v2x's directory as instructed in README. However I always end up getting the errors in the picture above stating issues with vtr-xml-utils. My system is Ubuntu 20.04 with the latest patches to date and I can sucessfully build and run symbiflow-examples, symbiflow-arch-def and symbiflow-prjxray. I can also confirm that my git clone of the v2x repo is correct and I do have access to https://github.com/SymbiFlow/vtr-xml-utils so my network isn't the cause. Has anyone else encountered the same problem? Is there a way to solve this? Thanks!

EDIT: pip install git+https://github.com/SymbiFlow/python-symbiflow-v2x.git#egg=python-symbiflow-v2x also doesn't work, will get a similar warning:

<myusername>@<myusername>-VirtualBox:~/python-symbiflow-v2x$ pip install git+https://github.com/SymbiFlow/python-symbiflow-v2x.git#egg=python-symbiflow-v2x
Collecting python-symbiflow-v2x
  Cloning https://github.com/SymbiFlow/python-symbiflow-v2x.git to /tmp/pip-install-n5ktak56/python-symbiflow-v2x
  Running command git clone -q https://github.com/SymbiFlow/python-symbiflow-v2x.git /tmp/pip-install-n5ktak56/python-symbiflow-v2x
  WARNING: Generating metadata for package python-symbiflow-v2x produced metadata for project name v2x. Fix your #egg=python-symbiflow-v2x fragments.
Collecting lxml
  Using cached lxml-4.6.3-cp38-cp38-manylinux2014_x86_64.whl (6.8 MB)
Collecting pyjson
  Using cached pyjson-1.3.0-py3-none-any.whl (4.8 kB)
ERROR: Could not find a version that satisfies the requirement vtr-xml-utils (from v2x) (from versions: none)
ERROR: No matching distribution found for vtr-xml-utils (from v2x)

The only difference is that there's no mention of "(from v2x==0.0.1)" like the output of "pip install ."

mithro commented 3 years ago

@kgugala / @acomodi - Can you look into this issue?

MidsummerNight commented 3 years ago

Follow up:

I have yet to find a direct solution to the vtr-xml-utils issue when running "pip install .". However I tried running "pip install -r requirements.txt" and then "pip install .", and the results are as follows:

<myusername>@<myusername>-VirtualBox:~/python-symbiflow-v2x$ pip install -r requirements.txt
Obtaining file:///home/<myusername>/python-symbiflow-v2x (from -r requirements.txt (line 3))
Obtaining vtr-xml-utils from git+https://github.com/SymbiFlow/vtr-xml-utils.git#egg=vtr-xml-utils (from -r requirements.txt (line 2))
  Cloning https://github.com/SymbiFlow/vtr-xml-utils.git to ./src/vtr-xml-utils
  Running command git clone -q https://github.com/SymbiFlow/vtr-xml-utils.git /home/<myusername>/python-symbiflow-v2x/src/vtr-xml-utils
Collecting check-manifest
  Downloading check_manifest-0.46-py3-none-any.whl (20 kB)
Collecting docutils
  Using cached docutils-0.17.1-py2.py3-none-any.whl (575 kB)
Collecting flake8
  Downloading flake8-3.9.2-py2.py3-none-any.whl (73 kB)
     |████████████████████████████████| 73 kB 91 kB/s 
Collecting pylint
  Downloading pylint-2.10.2-py3-none-any.whl (392 kB)
     |████████████████████████████████| 392 kB 495 kB/s 
Collecting pytest
  Using cached pytest-6.2.4-py3-none-any.whl (280 kB)
Collecting pytest-runner
  Using cached pytest_runner-5.3.1-py3-none-any.whl (7.1 kB)
Collecting readme_renderer
  Downloading readme_renderer-29.0-py2.py3-none-any.whl (15 kB)
Collecting tox
  Downloading tox-3.24.3-py2.py3-none-any.whl (85 kB)
     |████████████████████████████████| 85 kB 347 kB/s 
Collecting lxml
  Using cached lxml-4.6.3-cp38-cp38-manylinux2014_x86_64.whl (6.8 MB)
Collecting pyjson
  Using cached pyjson-1.3.0-py3-none-any.whl (4.8 kB)
Collecting build>=0.1
  Downloading build-0.6.0.post1-py3-none-any.whl (15 kB)
Collecting toml
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from check-manifest->-r requirements.txt (line 6)) (45.2.0)
Collecting pycodestyle<2.8.0,>=2.7.0
  Downloading pycodestyle-2.7.0-py2.py3-none-any.whl (41 kB)
     |████████████████████████████████| 41 kB 141 kB/s 
Collecting mccabe<0.7.0,>=0.6.0
  Downloading mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)
Collecting pyflakes<2.4.0,>=2.3.0
  Downloading pyflakes-2.3.1-py2.py3-none-any.whl (68 kB)
     |████████████████████████████████| 68 kB 439 kB/s 
Collecting astroid<2.8,>=2.7.2
  Downloading astroid-2.7.2-py3-none-any.whl (238 kB)
     |████████████████████████████████| 238 kB 225 kB/s 
Collecting platformdirs>=2.2.0
  Downloading platformdirs-2.2.0-py3-none-any.whl (13 kB)
Collecting isort<6,>=4.2.5
  Downloading isort-5.9.3-py3-none-any.whl (106 kB)
     |████████████████████████████████| 106 kB 382 kB/s 
Collecting pluggy<1.0.0a1,>=0.12
  Using cached pluggy-0.13.1-py2.py3-none-any.whl (18 kB)
Collecting packaging
  Using cached packaging-21.0-py3-none-any.whl (40 kB)
Collecting attrs>=19.2.0
  Using cached attrs-21.2.0-py2.py3-none-any.whl (53 kB)
Collecting py>=1.8.2
  Using cached py-1.10.0-py2.py3-none-any.whl (97 kB)
Collecting iniconfig
  Using cached iniconfig-1.1.1-py2.py3-none-any.whl (5.0 kB)
Collecting Pygments>=2.5.1
  Downloading Pygments-2.10.0-py3-none-any.whl (1.0 MB)
     |████████████████████████████████| 1.0 MB 327 kB/s 
Collecting bleach>=2.1.0
  Downloading bleach-4.1.0-py2.py3-none-any.whl (157 kB)
     |████████████████████████████████| 157 kB 208 kB/s 
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from readme_renderer->-r requirements.txt (line 12)) (1.14.0)
Requirement already satisfied: virtualenv!=20.0.0,!=20.0.1,!=20.0.2,!=20.0.3,!=20.0.4,!=20.0.5,!=20.0.6,!=20.0.7,>=16.0.0 in /usr/lib/python3/dist-packages (from tox->-r requirements.txt (line 13)) (20.0.17)
Requirement already satisfied: filelock>=3.0.0 in /usr/lib/python3/dist-packages (from tox->-r requirements.txt (line 13)) (3.0.12)
Collecting tomli>=1.0.0
  Downloading tomli-1.2.1-py3-none-any.whl (11 kB)
Collecting pep517>=0.9.1
  Downloading pep517-0.11.0-py2.py3-none-any.whl (19 kB)
Collecting wrapt<1.13,>=1.11
  Downloading wrapt-1.12.1.tar.gz (27 kB)
Collecting lazy-object-proxy>=1.4.0
  Downloading lazy_object_proxy-1.6.0-cp38-cp38-manylinux1_x86_64.whl (58 kB)
     |████████████████████████████████| 58 kB 263 kB/s 
Collecting pyparsing>=2.0.2
  Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting webencodings
  Using cached webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Building wheels for collected packages: wrapt
  Building wheel for wrapt (setup.py) ... done
  Created wheel for wrapt: filename=wrapt-1.12.1-cp38-cp38-linux_x86_64.whl size=78531 sha256=6861821daa0dd456d5066a6eac25a099fb43af6148b88d8a0393e4d6402e1c18
  Stored in directory: /home/<myusername>/.cache/pip/wheels/5f/fd/9e/b6cf5890494cb8ef0b5eaff72e5d55a70fb56316007d6dfe73
Successfully built wrapt
Installing collected packages: lxml, vtr-xml-utils, tomli, pyparsing, packaging, pep517, build, toml, check-manifest, docutils, pycodestyle, mccabe, pyflakes, flake8, wrapt, lazy-object-proxy, astroid, platformdirs, isort, pylint, pluggy, attrs, py, iniconfig, pytest, pytest-runner, Pygments, webencodings, bleach, readme-renderer, tox, pyjson, v2x
  Running setup.py develop for vtr-xml-utils
  WARNING: The script pyproject-build is installed in '/home/<myusername>/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script check-manifest is installed in '/home/<myusername>/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script pycodestyle is installed in '/home/<myusername>/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script pyflakes is installed in '/home/<myusername>/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script flake8 is installed in '/home/<myusername>/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts isort and isort-identify-imports are installed in '/home/<myusername>/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts epylint, pylint, pyreverse and symilar are installed in '/home/<myusername>/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts py.test and pytest are installed in '/home/<myusername>/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script pygmentize is installed in '/home/<myusername>/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts tox and tox-quickstart are installed in '/home/<myusername>/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  Running setup.py develop for v2x
Successfully installed Pygments-2.10.0 astroid-2.7.2 attrs-21.2.0 bleach-4.1.0 build-0.6.0.post1 check-manifest-0.46 docutils-0.17.1 flake8-3.9.2 iniconfig-1.1.1 isort-5.9.3 lazy-object-proxy-1.6.0 lxml-4.6.3 mccabe-0.6.1 packaging-21.0 pep517-0.11.0 platformdirs-2.2.0 pluggy-0.13.1 py-1.10.0 pycodestyle-2.7.0 pyflakes-2.3.1 pyjson-1.3.0 pylint-2.10.2 pyparsing-2.4.7 pytest-6.2.4 pytest-runner-5.3.1 readme-renderer-29.0 toml-0.10.2 tomli-1.2.1 tox-3.24.3 v2x vtr-xml-utils webencodings-0.5.1 wrapt-1.12.1
<myusername>@<myusername>-VirtualBox:~/python-symbiflow-v2x$ pip install .
Processing /home/<myusername>/python-symbiflow-v2x
Requirement already satisfied: lxml in /home/<myusername>/.local/lib/python3.8/site-packages (from v2x==0.0.1) (4.6.3)
Requirement already satisfied: pyjson in /home/<myusername>/.local/lib/python3.8/site-packages (from v2x==0.0.1) (1.3.0)
Requirement already satisfied: vtr-xml-utils in ./src/vtr-xml-utils (from v2x==0.0.1) (0.0.1)
Building wheels for collected packages: v2x
  Building wheel for v2x (setup.py) ... done
  Created wheel for v2x: filename=v2x-0.0.1-py2.py3-none-any.whl size=35566 sha256=a592b5119a532bc490e2cee2b983de4ffbe713bbb9bfa8d17de76ac784b4fad7
  Stored in directory: /home/<myusername>/.cache/pip/wheels/b6/1e/e9/1c81856e7d7f1343d15c8755e85e8679ddb064a5e5bdd88fda
Successfully built v2x
Installing collected packages: v2x
  Attempting uninstall: v2x
    Found existing installation: v2x 0.0.1
    Uninstalling v2x-0.0.1:
      Successfully uninstalled v2x-0.0.1
  WARNING: The script v2x is installed in '/home/<myusername>/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed v2x-0.0.1
<myusername>@<myusername>-VirtualBox:~/python-symbiflow-v2x$ v2x -h

Command 'v2x' not found, did you mean:

  command 'vax' from deb simh (3.8.1-6)
  command 'j2x' from deb ncbi-entrez-direct (12.0.20190816+ds-1)
  command 'x2x' from deb x2x (1.30-8)
  command 'a2x' from deb asciidoc-base (9.0.0~rc1-1)

Try: sudo apt install <deb name>

Apart from the PATH warnings (which should be easy to fix by manually setting PATH), everything seems to be correct this time:

<myusername>@<myusername>-VirtualBox:~/python-symbiflow-v2x$ cd /home/<myusername>/.local/bin
<myusername>@<myusername>-VirtualBox:~/.local/bin$ ls
check-manifest          __pycache__  pyproject-build  rst2html5.py           rst2odt.py        rstpep2html.py
epylint                 pycodestyle  pyreverse        rst2html.py            rst2pseudoxml.py  symilar
flake8                  pyflakes     py.test          rst2latex.py           rst2s5.py         tox
isort                   pygmentize   pytest           rst2man.py             rst2xetex.py      tox-quickstart
isort-identify-imports  pylint       rst2html4.py     rst2odt_prepstyles.py  rst2xml.py        v2x
<myusername>@<myusername>-VirtualBox:~/.local/bin$ python3 v2x
usage: v2x [-h] [--top TOP] [--outfile OUTFILE] [--includes INCLUDES] [--mode {pb_type,model}] input.v [input.v ...]
v2x: error: the following arguments are required: input.v
<myusername>@<myusername>-VirtualBox:~/.local/bin$ ./v2x 
usage: v2x [-h] [--top TOP] [--outfile OUTFILE] [--includes INCLUDES] [--mode {pb_type,model}] input.v [input.v ...]
v2x: error: the following arguments are required: input.v
<myusername>@<myusername>-VirtualBox:~/.local/bin$ ./v2x -h
usage: v2x [-h] [--top TOP] [--outfile OUTFILE] [--includes INCLUDES] [--mode {pb_type,model}] input.v [input.v ...]

Verilog to XML

positional arguments:
  input.v               One or more Verilog input files, that will be passed to Yosys internally. They should be enough to
                        generate a flattened representation of the model, so that paths through the model can be
                        determined.

optional arguments:
  -h, --help            show this help message and exit
  --top TOP             Top level module, will usually be automatically determined from the file name im.v
  --outfile OUTFILE, -o OUTFILE
                        Output filename, default 'output.xml'
  --includes INCLUDES   Comma separate list of include directories.
  --mode {pb_type,model}
                        Output file type, possible values are: pb_type and model. Default value is pb_type
<myusername>@<myusername>-VirtualBox:~/.local/bin$ 

So far everything looks good. Next, I will try to manually set PATH and pass in some Verilog files to check if it does actually work. Will report back after I get the results.

MidsummerNight commented 3 years ago

Update: After adding ~/.local/bin to PATH, I finally made v2x run correctly. Not without caveats though:

<myusername>@<myusername>-VirtualBox:~$ v2x -o lut_ff_macro-sim-pb_type.xml /home/<myusername>/python-symbiflow-v2x/tests/no_seq/lut_ff_macro.sim.v
ERROR: Cannot find the Yosys binary or its not executable.

This shouldn't be a surprise for those who have watched the VPR device models generation from Verilog with V2X - Karol Gugala - ORConf 2019 talk on v2x's README carefully enough, yet it can still be an annoyance as v2x's documentations doesn't explicitly list Yosys as an requirement. Luckily I already prepared Yosys when previously trying out symbiflow-examples, so I simply set up the environment:

export INSTALL_DIR="/home/<myusername>/opt/symbiflow"
export FPGA_FAM="xc7"
export PATH="$INSTALL_DIR/$FPGA_FAM/install/bin:$PATH"
source "$INSTALL_DIR/$FPGA_FAM/conda/etc/profile.d/conda.sh"
conda activate $FPGA_FAM

Then:

(xc7) <myusername>@<myusername>-VirtualBox:~/symbiflow-examples$ cd ~
(xc7) <myusername>@<myusername>-VirtualBox:~$ v2x -o lut_ff_macro-sim-pb_type.xml /home/<myusername>/python-symbiflow-v2x/tests/no_seq/lut_ff_macro.sim.v
is_blackbox True has_modes? False
(xc7) <myusername>@<myusername>-VirtualBox:~$ v2x --mode model -o lut_ff_macro-sim-model.xml /home/<myusername>/python-symbiflow-v2x/tests/no_seq/lut_ff_macro.sim.v
(xc7) <myusername>@<myusername>-VirtualBox:~$ 

And the xml files generated by v2x are identical to their respective counterparts in ~/python-symbiflow-v2x/tests/no_seq However, while manually using v2x to generate xml files seems to be fine now, pytest doesn't seem to work correctly:

<myusername>@<myusername>-VirtualBox:~/python-symbiflow-v2x/tests$ rm -rf build
<myusername>@<myusername>-VirtualBox:~/python-symbiflow-v2x/tests$ pytest -vv
============================= test session starts ==============================
platform linux -- Python 3.8.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/<myusername>/python-symbiflow-v2x
collected 0 items / 1 error                                                    

==================================== ERRORS ====================================
______________________ ERROR collecting tests/test_v2x.py ______________________
test_v2x.py:150: in pytest_generate_tests
    prepare_files()
test_v2x.py:58: in prepare_files
    pbtypeout = vlog_to_pbtype.vlog_to_pbtype(
../../.local/lib/python3.8/site-packages/v2x/vlog_to_pbtype.py:927: in vlog_to_pbtype
    pfx = run.determine_select_prefix()
../../.local/lib/python3.8/site-packages/v2x/yosys/run.py:75: in determine_select_prefix
    stdout = get_output(cmd, no_common_args=True)
../../.local/lib/python3.8/site-packages/v2x/yosys/run.py:108: in get_output
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
/usr/lib/python3.8/subprocess.py:858: in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
/usr/lib/python3.8/subprocess.py:1585: in _execute_child
    and os.path.dirname(executable)
/usr/lib/python3.8/posixpath.py:152: in dirname
    p = os.fspath(p)
E   TypeError: expected str, bytes or os.PathLike object, not NoneType
------------------------------- Captured stdout --------------------------------
Generated mux RMUX in /home/<myusername>/python-symbiflow-v2x/build/muxes/routing
=========================== short test summary info ============================
ERROR test_v2x.py - TypeError: expected str, bytes or os.PathLike object, not...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.38s ===============================

Did I do anything wrong or is this another problem with v2x? If the latter, should I open a new issue or continue the discussion here? Thanks!