Skip to content

Commit cd54aed

Browse files
committed
Fixed missing pip dep on fresh venv bug; fixed missing pyxsi_utils bug
1 parent 6c0fe8a commit cd54aed

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

src/finn/interface/manage_deps.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def pull_board(args: tuple) -> bool:
245245
else:
246246
update_status(
247247
pkg_name,
248-
f"Installation failed! " f"Expected commit {commit} but got {read_commit}",
248+
f"Installation failed! Expected commit {commit} but got {read_commit}",
249249
"red",
250250
)
251251
return False
@@ -275,11 +275,11 @@ def pull_board(args: tuple) -> bool:
275275
sys.exit(1)
276276

277277

278-
def install_pyxsi():
278+
def install_pyxsi() -> bool:
279279
# TODO: integrate properly into the rich.Live above?
280280
# Will soon be replaced by finnXSI
281-
pyxsi_path = os.path.join(get_deps_path(), "pyxsi")
282-
pyxsi_so_path = os.path.join(pyxsi_path, "pyxsi.so")
281+
pyxsi_path = get_deps_path() / "pyxsi"
282+
pyxsi_so_path = pyxsi_path / "pyxsi.so"
283283

284284
# Disable PyXSI makefile Docker wrapper
285285
os.environ["PYXSI_MAKE_USE_DOCKER"] = "0"
@@ -291,11 +291,13 @@ def install_pyxsi():
291291
return False
292292

293293
# Check if .so was created
294-
if not os.path.isfile(pyxsi_so_path):
294+
if not pyxsi_so_path.exists():
295295
return False
296296

297297
# Set environment variables
298298
os.environ["PYTHONPATH"] = f"{os.environ['PYTHONPATH']}:{pyxsi_path}:{pyxsi_path}/py"
299+
sys.path.append(str(pyxsi_path))
300+
sys.path.append(str(pyxsi_path / "py"))
299301
vivado_path = os.environ["XILINX_VIVADO"]
300302
if "LD_LIBRARY_PATH" not in os.environ.keys():
301303
os.environ["LD_LIBRARY_PATH"] = f"/lib/x86_64-linux-gnu/:{vivado_path}/lib/lnx64.o"

src/finn/interface/run_finn.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ def build(
173173
config: str,
174174
model: str,
175175
) -> None:
176-
from finn.builder.build_dataflow import build_dataflow_cfg
177-
from finn.builder.build_dataflow_config import DataflowBuildConfig
178-
179176
config_path = Path(config).expanduser()
180177
model_path = Path(model).expanduser()
181178
build_dir = Path(build_path).expanduser() if build_path != "" else None
@@ -190,6 +187,12 @@ def build(
190187
num_workers,
191188
skip_dep_update=(skip_dep_update or skip_update_by_default()),
192189
)
190+
191+
# Can import from finn now, since all deps are installed
192+
# and all environment variables are set correctly
193+
from finn.builder.build_dataflow import build_dataflow_cfg
194+
from finn.builder.build_dataflow_config import DataflowBuildConfig
195+
193196
status("Creating dataflow build config...")
194197
dfbc: DataflowBuildConfig | None = None
195198
match config_path.suffix:

0 commit comments

Comments
 (0)