Skip to content
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

Fix #4324: Add verbose output for pip install errors #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
35 changes: 24 additions & 11 deletions evaluation_script/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ def install(package):

# Args:
# package ([str]): Package name with version

subprocess.check_call([sys.executable, "-m", "pip", "install", package])
try:
subprocess.run([sys.executable,"-m","pip","install",package])
except subprocess.CalledProcessError as e:
print(f"Error occurred while installing {package}: {e.stderr}")
except FileNotFoundError:
print("Error: Pip is not found. make sure you have pip installed.")
except PermissionError:
print("Error: Permission denied. ")


def install_local_package(folder_name):
Expand All @@ -23,15 +29,22 @@ def install_local_package(folder_name):
# Args:
# folder_name ([str]): name of the folder placed in evaluation_script/

subprocess.check_output(
[
sys.executable,
"-m",
"pip",
"install",
os.path.join(str(Path(__file__).parent.absolute()) + folder_name),
]
)

try:
subprocess.run([
sys.executable,
"-m",
"pip",
"install",
os.path.join(str(Path(__file__).parent.absolute()), folder_name)
], capture_output=True, text=True, check=True)
print(f"Successfully installed local package from {folder_name}.")
except subprocess.CalledProcessError as e:
print(f"Error occurred while installing local package from {folder_name}: {e.stderr}")
except FileNotFoundError:
print("Error: Pip not found.")
except PermissionError:
print("Error: Permission denied. ")

install("shapely==1.7.1")
install("requests==2.25.1")
Expand Down