Spaces:
Runtime error
Runtime error
Download scripts/check_requirements.py from Hslavinsky/AutoGPT: direct link, hf CLI and curl.
- Browser
- Download file 833 Bytes
-
https://huggingface.co/spaces/Hslavinsky/AutoGPT/resolve/main/scripts/check_requirements.py
- Command line
-
hf download hf://spaces/Hslavinsky/AutoGPT/scripts/check_requirements.py
-
curl -L -o check_requirements.py https://huggingface.co/spaces/Hslavinsky/AutoGPT/resolve/main/scripts/check_requirements.py
833 Bytes
| import sys | |
| import pkg_resources | |
| def main(): | |
| requirements_file = sys.argv[1] | |
| with open(requirements_file, "r") as f: | |
| required_packages = [ | |
| line.strip().split("#")[0].strip() for line in f.readlines() | |
| ] | |
| installed_packages = [package.key for package in pkg_resources.working_set] | |
| missing_packages = [] | |
| for package in required_packages: | |
| if not package: # Skip empty lines | |
| continue | |
| package_name = package.strip().split("==")[0] | |
| if package_name.lower() not in installed_packages: | |
| missing_packages.append(package_name) | |
| if missing_packages: | |
| print("Missing packages:") | |
| print(", ".join(missing_packages)) | |
| sys.exit(1) | |
| else: | |
| print("All packages are installed.") | |
| if __name__ == "__main__": | |
| main() | |