{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[],"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"raw","source":"import os\nimport shutil\n\nimport io\nimport contextlib\nimport sys\nimport time\nimport zipfile\nfrom pathlib import Path\n\nimport requests\nimport numpy as np","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19"}},{"cell_type":"code","source":"\n\nimport os\nimport torch\nos.environ['TORCH'] = torch.__version__\nprint(torch.__version__)\n\n","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Path roots for the project\nWORKING_ROOT = os.path.abspath(\".\")\nprint(f\"WORKING_ROOT='{WORKING_ROOT}'\")","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# This is a list of our required packages, specified exactly as you would for\n# !pip install. If you need to specify where to find the links, list them in\n# the links list\ntorch_version = torch.__version__\n# torch_version = '1.13.0'\nPACKAGES = [ \n    #\"textdistance==4.2.2\", \n    #\"totalsegmentator\", \n#     \"numcodecs\", \n#     \"zarr\", \n#     \"segmentation_models_pytorch\", \n#     \"timm\", \n#     \"einops\", \n#     \"grad-cam\", \n#     \"torch_cluster\", \n#     \"torch_scatter\", \n#     \"torch_geometric\",\n    \"ftfy\",\n    \"tabpfn\", \n    \"iterative-stratification\", \n#     \"opensearch-py\", \n#     \"elasticsearch\", \n#     \"optimum\", \n#     \"optimum[exporters]\",     \n    \"pytorch-tabnet==4.1.0\", \n    \"lightgbm==3.3.2\",\n#     \"lofo-importance\", \n#     \"pyro-ppl==1.8.5\", \n#     \"torch==2.0.1+cu118\", \n#     \"torchvision==0.15.2+cu118\", \n#     \"torchaudio==2.0.2+cu118\", \n]\nLINKS = [\n    #\"https://pypi.org/project/textdistance/\",\n    #\"https://pypi.org/project/totalsegmentator/\",\n    #\"https://pypi.org/project/monai/\",\n    #\"https://pypi.org/project/torchio/\",\n#     \"https://pypi.org/project/numcodecs/\",\n#     \"https://pypi.org/project/zarr/\",\n#     \"https://pypi.org/project/segmentation_models_pytorch/\",\n#     \"https://pypi.org/project/timm/\",\n#     \"https://pypi.org/project/einops/\",\n#     \"https://pypi.org/project/grad-cam/\",\n#     f\"https://data.pyg.org/whl/torch-${torch_version}.html\",\n#     f\"https://data.pyg.org/whl/torch-${torch_version}.html\",\n#     f\"https://data.pyg.org/whl/torch-${torch_version}.html\",\n#     \"https://pypi.org/project/torch_cluster/\",\n#     \"https://pypi.org/project/torch_scatter/\",\n#     \"https://pypi.org/project/torch_geometric/\"\n#     \"https://pypi.org/project/iterative-stratification\", \n    #\"https://pypi.org/project/tabpfn\", \n#     \"https://pypi.org/project/pytorch-tabnet\", \n#     \"https://pypi.org/project/lofo-importance\", \n#     \"https://pypi.org/project/pyro-ppl\", \n]","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\n\npip_packages = \" \".join(PACKAGES)\n# find_links = \" \".join([f\"--find-links {link}\" for link in LINKS])\n\n","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\n# !pip wheel {pip_packages} {find_links} \\\n!pip wheel {pip_packages} \\\n    --progress-bar off \\\n    --wheel-dir={WORKING_ROOT}","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip wheel torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 \\\n    --progress-bar off \\\n    --wheel-dir={WORKING_ROOT}","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# PACKAGES += ['torch','torchvision','torchaudio']","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# List out the files we've downloaded\nos.listdir(WORKING_ROOT)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"requirements_file_path = os.path.join(WORKING_ROOT, \"requirements.txt\")\nwith open(requirements_file_path, \"w\") as f:\n#     for package in PACKAGES + ePACKAGES:\n    for package in PACKAGES:\n        f.write(f\"{package}\\n\")\nwith open(requirements_file_path, \"r\") as f:\n    requirements_txt = f.read()\n    print(f\">>>> {requirements_file_path}\\n\")\n    print(requirements_txt)\n    print(\"<<<<\")","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}