Skip to content

Check for requirements before installing conda packages. #2622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions torchbenchmark/models/doctr_det_predictor/install.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import subprocess
import warnings
import json

from utils.python_utils import pip_install_requirements


def pip_install_requirements_doctr():
required_pkgs = ["expecttest", "libglib", "pango"]
try:
subprocess.check_call(
[
"conda",
"install",
"-y",
"expecttest",
"libglib",
"pango",
"-c",
"conda-forge",
]
)
installed_pkgs = [x["name"] for x in json.loads(subprocess.check_output(["conda", "list", "--json"], text=True))]
if not all(pkg in installed_pkgs for pkg in required_pkgs):
subprocess.check_call(
[
"conda",
"install",
"-y",
*required_pkgs,
"-c",
"conda-forge",
]
)
except:
warnings.warn(
"The doctr_det_predictor model requires conda binary libaries to be installed. Missing conda packages might break this model."
Expand Down
26 changes: 14 additions & 12 deletions torchbenchmark/models/doctr_reco_predictor/install.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import subprocess
import warnings
import json

from utils.python_utils import pip_install_requirements


def pip_install_requirements_doctr():
required_pkgs = ["expecttest", "libglib", "pango"]
try:
subprocess.check_call(
[
"conda",
"install",
"-y",
"expecttest",
"libglib",
"pango",
"-c",
"conda-forge",
]
)
installed_pkgs = [x["name"] for x in json.loads(subprocess.check_output(["conda", "list", "--json"], text=True))]
if not all(pkg in installed_pkgs for pkg in required_pkgs):
subprocess.check_call(
[
"conda",
"install",
"-y",
*required_pkgs,
"-c",
"conda-forge",
]
)
except:
warnings.warn(
"The doctr_reco_predictor model requires conda binary libaries to be installed. Missing conda packages might break this model."
Expand Down