{"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"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"## Introduction\nDue to some extremely large images in test dataset, loading images using OpenCV and PIL causes the notebook to crash. Pyvips is a good way to avoid memory problem, but you need to make it work in an offline environment when you submit your notebook. \n\nIn this notebook, I'm going to show you how to install Pyvips offline.\n\nYou will need to prepare another notebook to download pyvips binaries.\n\n## 1. Make a notebook to download pyvips and dependencies ","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19"}},{"cell_type":"code","source":"!conda config --add pkgs_dirs ./ # Set the location where conda package will be downloaded\n!conda install --download-only -y pyvips # Download pyvips and dependencies","metadata":{"execution":{"iopub.status.busy":"2022-07-17T12:58:34.945879Z","iopub.execute_input":"2022-07-17T12:58:34.946772Z","iopub.status.idle":"2022-07-17T13:00:53.587096Z","shell.execute_reply.started":"2022-07-17T12:58:34.946664Z","shell.execute_reply":"2022-07-17T13:00:53.586099Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Now binaries of pyvips and dependencies are all downloaded to the working directory.","metadata":{}},{"cell_type":"code","source":"!ls ","metadata":{"execution":{"iopub.status.busy":"2022-07-17T13:06:54.392782Z","iopub.execute_input":"2022-07-17T13:06:54.393901Z","iopub.status.idle":"2022-07-17T13:06:55.185191Z","shell.execute_reply.started":"2022-07-17T13:06:54.393847Z","shell.execute_reply":"2022-07-17T13:06:55.183716Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## 2. Click \"Save version\" and go back to your submission notebook.\n## 3. Add the output files of your pyvips binary notebook\n**Actually you can use this notebook as pyvips binary notebook.**\n![](http://drive.google.com/uc?export=view&id=1_WLG-O7MFtehWRWVQQZRvVHXN_422iXU)","metadata":{}},{"cell_type":"markdown","source":"## 4. Install pyvips using conda","metadata":{}},{"cell_type":"code","source":"!conda install *.tar.bz2 \n# Note that \"*.tar.bz2\" should be the directory of your binary notebook outputs\n# e.g. (../input/{notebook_name}/*.tar.bz2)","metadata":{"execution":{"iopub.status.busy":"2022-07-17T13:14:56.157134Z","iopub.execute_input":"2022-07-17T13:14:56.157651Z","iopub.status.idle":"2022-07-17T13:15:32.635928Z","shell.execute_reply.started":"2022-07-17T13:14:56.157613Z","shell.execute_reply":"2022-07-17T13:15:32.634493Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## 5. Enjoy the competition :)","metadata":{}},{"cell_type":"code","source":"import pyvips","metadata":{"execution":{"iopub.status.busy":"2022-07-17T13:19:03.651678Z","iopub.execute_input":"2022-07-17T13:19:03.652159Z","iopub.status.idle":"2022-07-17T13:19:03.901852Z","shell.execute_reply.started":"2022-07-17T13:19:03.652124Z","shell.execute_reply":"2022-07-17T13:19:03.9006Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}