{
  "id": 390653,
  "title": "Library install errors/packages not available in internet-off mode?",
  "url": "/competitions/rsna-breast-cancer-detection/discussion/390653",
  "author_name": "gsharpminor",
  "post_date": "2023-02-26T14:57:09.482000",
  "votes": 0,
  "comment_count": 11,
  "views": 0,
  "content": "<p>New Kaggler here… So I built a pipeline to use a radiomics-based approach on the RSNA challenge, specifically using the <a href=\"https://pyradiomics.readthedocs.io/en/latest/\" target=\"_blank\">pyradiomics </a> Python module. </p>\n<p>It runs perfectly on my home computer and also in the Kaggle notebook… until I set \"internet off\" mode. Then, when I try to import the pyradiomics package with</p>\n<p><code>!pip install pyradiomics</code></p>\n<p>I instead get: </p>\n<blockquote>\n  <p>ERROR: Could not find a version that satisfies the requirement pyradiomics</p>\n</blockquote>\n<p>and also:</p>\n<blockquote>\n  <p>ModuleNotFoundError: No module named 'radiomics'</p>\n</blockquote>\n<p>…It appears that PyRadiomics is not part of the environment previously set up by Kaggle, so with internet off it hits a wall trying to download it. So is there any way to pre-load a module that you need, before submitting in \"internet off\" mode?</p>\n<p>It would be almost unbelievable if a) my time on this is completely wasted to the point that I cannot even *submit *the work; and b) it is not permitted to use a radiomics package on what is very clearly a prime use case for a radiomics approach!</p>\n<p>I still have a day and a half to submit something. Any advice appreciated ASAP! (Fortunately the pipeline runs relatively fast.)</p>",
  "messages": [
    {
      "id": 2160434,
      "postDate": "2023-02-26T17:11:13.650Z",
      "content": "<p>Did you find a working solution? I am making and copying the wheels on the Kaggle platform (e.g., <code>!pip wheel pyradiomics</code>) into a personal Kaggle dataset and adding them from there. (There might be many whl files created and you could try to see which of the dependencies are already satisfied to make your zip to be uploaded as a dataset smaller.) Here is a good tutorial: <a href=\"https://www.kaggle.com/code/jiny333/creating-whl-files-to-install-external-libraries\" target=\"_blank\">https://www.kaggle.com/code/jiny333/creating-whl-files-to-install-external-libraries</a></p>",
      "rawMarkdown": "Did you find a working solution? I am making and copying the wheels on the Kaggle platform (e.g., `!pip wheel pyradiomics`) into a personal Kaggle dataset and adding them from there. (There might be many whl files created and you could try to see which of the dependencies are already satisfied to make your zip to be uploaded as a dataset smaller.) Here is a good tutorial: https://www.kaggle.com/code/jiny333/creating-whl-files-to-install-external-libraries",
      "votes": 1,
      "replies": [
        {
          "id": 2160578,
          "postDate": "2023-02-26T19:23:05.310Z",
          "content": "<p>It would be interesting to hear about this pyradiomics-based solution if it some day becomes public. 👍</p>",
          "rawMarkdown": "It would be interesting to hear about this pyradiomics-based solution if it some day becomes public. 👍"
        },
        {
          "id": 2160658,
          "postDate": "2023-02-26T20:38:57.240Z",
          "content": "<p>Thanks Antti. I might try this \"wheels\" approach. So far i have been trying to just bring in the packages i need from Github, store them in local folder, and then use pip to install them from there instead of the internet. But this leads to a string of dependencies i have to install too… then dependencies for the dependencies… and here we are still 😒</p>",
          "rawMarkdown": "Thanks Antti. I might try this \"wheels\" approach. So far i have been trying to just bring in the packages i need from Github, store them in local folder, and then use pip to install them from there instead of the internet. But this leads to a string of dependencies i have to install too... then dependencies for the dependencies... and here we are still 😒",
          "votes": 1,
          "replies": [
            {
              "id": 2160665,
              "postDate": "2023-02-26T20:56:32.327Z",
              "content": "<p>Also when I install dependencies i often find i can't even look in the folders i downloaded. They just hang forever:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F930277%2F57ffaac4efc88b8c3acf4449adc83556%2FScreenshot%20from%202023-02-26%2013-51-14.png?generation=1677444818785444&amp;alt=media\" alt=\"\"></p>\n<p>Previously, the whole system got sick when i tried to run the first cell that sets up the environment: </p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F930277%2Fb1303793e01c813afcdca22c3f910495%2FScreenshot%20from%202023-02-26%2007-27-23_kaggleMalfunction.png?generation=1677444968857888&amp;alt=media\" alt=\"\"></p>\n<p>Like, who is in charge here? I am basically being kept from even <em>submitting my work</em> by absurd technical issues.</p>",
              "rawMarkdown": "Also when I install dependencies i often find i can't even look in the folders i downloaded. They just hang forever:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F930277%2F57ffaac4efc88b8c3acf4449adc83556%2FScreenshot%20from%202023-02-26%2013-51-14.png?generation=1677444818785444&alt=media)\n\nPreviously, the whole system got sick when i tried to run the first cell that sets up the environment: \n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F930277%2Fb1303793e01c813afcdca22c3f910495%2FScreenshot%20from%202023-02-26%2007-27-23_kaggleMalfunction.png?generation=1677444968857888&alt=media)\n\nLike, who is in charge here? I am basically being kept from even *submitting my work* by absurd technical issues."
            },
            {
              "id": 2160668,
              "postDate": "2023-02-26T21:06:56.087Z",
              "content": "<p>Let's be in charge today. Fork this <a href=\"https://www.kaggle.com/code/anttiisosalo/create-pyradiomics-wheel/notebook\" target=\"_blank\">https://www.kaggle.com/code/anttiisosalo/create-pyradiomics-wheel/notebook</a> &gt; download zip, upload as private dataset, and add data, and you should be good to go.</p>",
              "rawMarkdown": "Let's be in charge today. Fork this https://www.kaggle.com/code/anttiisosalo/create-pyradiomics-wheel/notebook > download zip, upload as private dataset, and add data, and you should be good to go.",
              "votes": 1
            },
            {
              "id": 2160669,
              "postDate": "2023-02-26T21:08:13.577Z",
              "content": "<p>And see here <a href=\"https://www.kaggle.com/code/anttiisosalo/16-bit-post-processing-rsna-bc-detection?scriptVersionId=119182142&amp;cellId=12\" target=\"_blank\">https://www.kaggle.com/code/anttiisosalo/16-bit-post-processing-rsna-bc-detection?scriptVersionId=119182142&amp;cellId=12</a> how I am accessing private resources.</p>",
              "rawMarkdown": "And see here https://www.kaggle.com/code/anttiisosalo/16-bit-post-processing-rsna-bc-detection?scriptVersionId=119182142&cellId=12 how I am accessing private resources.",
              "votes": 1
            },
            {
              "id": 2160690,
              "postDate": "2023-02-26T22:09:27.720Z",
              "content": "<p>I like your attitude 😀. But i think i have got it working without having to mess with repos or wheels.</p>\n<p>The thing i didn't see is the \"persistence\" pull down. So I did the following:</p>\n<ol>\n<li><p>With internet on, do usual !pip install pyradiomics</p></li>\n<li><p>Set \"persistence\" to \"variables and files\". also set \"environment\" to \"always use latest environment\"</p></li>\n<li><p>Now turn off internet and submit. </p></li>\n</ol>\n<p>It looks like by doing this, you can tell the Kaggle notebook to simply <em>remember</em> whatever libraries you already had installed and open before the internet switched off. So since i already installed pyradiomics, it remembers to hang on to it. </p>\n<p>We will see if it finishes… so far running about an hour with no \"import error\", far longer than it was before… else i will follow your advice…</p>",
              "rawMarkdown": "I like your attitude 😀. But i think i have got it working without having to mess with repos or wheels.\n\nThe thing i didn't see is the \"persistence\" pull down. So I did the following:\n\n1. With internet on, do usual !pip install pyradiomics\n\n2. Set \"persistence\" to \"variables and files\". also set \"environment\" to \"always use latest environment\"\n\n3. Now turn off internet and submit. \n\nIt looks like by doing this, you can tell the Kaggle notebook to simply *remember* whatever libraries you already had installed and open before the internet switched off. So since i already installed pyradiomics, it remembers to hang on to it. \n\nWe will see if it finishes... so far running about an hour with no \"import error\", far longer than it was before... else i will follow your advice...",
              "votes": 1
            },
            {
              "id": 2160696,
              "postDate": "2023-02-26T22:21:12.250Z",
              "rawMarkdown": "",
              "isDeleted": true
            },
            {
              "id": 2160785,
              "postDate": "2023-02-27T01:35:57.540Z",
              "content": "<p>Well, I tried just about everything. But the wheels don't work either. I can bring them in as a zip file, but when I try to actually use them to build pyradiomics, I just get </p>\n<blockquote>\n  <p>\"ERROR: [packagename].whl is not a supported wheel on this platform.\"</p>\n</blockquote>\n<p>It's really odd that the competition organizers seem to have made it so hard for anyone to use any packages but the ones they already thought of. And it has nothing to do with the competition rules, since I can run this on my own home computer without internet, no problem.</p>\n<p>Maybe will try looking for exact versions of the wheels to match the Python version Kaggle is using? I'm about out of ideas.</p>\n<p>**UPDATE: I was downloading wheels for the wrong version of Python (3.8, while Kaggle uses 3.7.12). So now the wheels install fine and pyradiomics is installing + running without internet! </p>\n<p>(Still think it should be made much simpler for people to use unusual python packages on here.)**</p>",
              "rawMarkdown": "Well, I tried just about everything. But the wheels don't work either. I can bring them in as a zip file, but when I try to actually use them to build pyradiomics, I just get \n\n>\"ERROR: [packagename].whl is not a supported wheel on this platform.\"\n\nIt's really odd that the competition organizers seem to have made it so hard for anyone to use any packages but the ones they already thought of. And it has nothing to do with the competition rules, since I can run this on my own home computer without internet, no problem.\n\nMaybe will try looking for exact versions of the wheels to match the Python version Kaggle is using? I'm about out of ideas.\n\n**UPDATE: I was downloading wheels for the wrong version of Python (3.8, while Kaggle uses 3.7.12). So now the wheels install fine and pyradiomics is installing + running without internet! \n\n(Still think it should be made much simpler for people to use unusual python packages on here.)**"
            }
          ]
        }
      ]
    },
    {
      "id": 2160328,
      "postDate": "2023-02-26T15:29:51.510Z",
      "content": "<p>Yea. In my experience you need \"internet on\" to install anything that's not standard in Kaggle notebooks (numpy, pandas, etc.) I am not familiar with an pre-download methods, but that does not mean it doesn't exist.</p>",
      "rawMarkdown": "Yea. In my experience you need \"internet on\" to install anything that's not standard in Kaggle notebooks (numpy, pandas, etc.) I am not familiar with an pre-download methods, but that does not mean it doesn't exist.",
      "replies": [
        {
          "id": 2160344,
          "postDate": "2023-02-26T15:49:25.233Z",
          "content": "<p>I think I may have an idea (fingers crossed), for anyone curious. The key is mentioned <a href=\"https://www.kaggle.com/competitions/ubiquant-market-prediction/discussion/303294\" target=\"_blank\">here</a>: </p>\n<p>Gist of what you do is:</p>\n<ol>\n<li>use git to clone the repo of the package you need into your working directory on Kaggle.</li>\n<li>set the notebook to \"file persistence\" so that the repo is still there in subsequent runs. </li>\n<li>Change the !pip command so that it points at the cloned repo in your own directory rather than at the internet</li>\n<li>Change the import statement so it imports from the repo</li>\n<li>Repeat for any needed dependencies</li>\n</ol>",
          "rawMarkdown": "I think I may have an idea (fingers crossed), for anyone curious. The key is mentioned [here](https://www.kaggle.com/competitions/ubiquant-market-prediction/discussion/303294): \n\nGist of what you do is:\n1. use git to clone the repo of the package you need into your working directory on Kaggle.\n2. set the notebook to \"file persistence\" so that the repo is still there in subsequent runs. \n3. Change the !pip command so that it points at the cloned repo in your own directory rather than at the internet\n4. Change the import statement so it imports from the repo\n5. Repeat for any needed dependencies\n",
          "votes": 1
        }
      ]
    },
    {
      "id": 2160308,
      "postDate": "2023-02-26T14:57:09.483Z",
      "content": "<p>New Kaggler here… So I built a pipeline to use a radiomics-based approach on the RSNA challenge, specifically using the <a href=\"https://pyradiomics.readthedocs.io/en/latest/\" target=\"_blank\">pyradiomics </a> Python module. </p>\n<p>It runs perfectly on my home computer and also in the Kaggle notebook… until I set \"internet off\" mode. Then, when I try to import the pyradiomics package with</p>\n<p><code>!pip install pyradiomics</code></p>\n<p>I instead get: </p>\n<blockquote>\n  <p>ERROR: Could not find a version that satisfies the requirement pyradiomics</p>\n</blockquote>\n<p>and also:</p>\n<blockquote>\n  <p>ModuleNotFoundError: No module named 'radiomics'</p>\n</blockquote>\n<p>…It appears that PyRadiomics is not part of the environment previously set up by Kaggle, so with internet off it hits a wall trying to download it. So is there any way to pre-load a module that you need, before submitting in \"internet off\" mode?</p>\n<p>It would be almost unbelievable if a) my time on this is completely wasted to the point that I cannot even *submit *the work; and b) it is not permitted to use a radiomics package on what is very clearly a prime use case for a radiomics approach!</p>\n<p>I still have a day and a half to submit something. Any advice appreciated ASAP! (Fortunately the pipeline runs relatively fast.)</p>",
      "rawMarkdown": "New Kaggler here... So I built a pipeline to use a radiomics-based approach on the RSNA challenge, specifically using the [pyradiomics ](https://pyradiomics.readthedocs.io/en/latest/) Python module. \n\nIt runs perfectly on my home computer and also in the Kaggle notebook... until I set \"internet off\" mode. Then, when I try to import the pyradiomics package with\n\n`!pip install pyradiomics`\n\nI instead get: \n>ERROR: Could not find a version that satisfies the requirement pyradiomics\n\nand also:\n>ModuleNotFoundError: No module named 'radiomics'\n\n...It appears that PyRadiomics is not part of the environment previously set up by Kaggle, so with internet off it hits a wall trying to download it. So is there any way to pre-load a module that you need, before submitting in \"internet off\" mode?\n\nIt would be almost unbelievable if a) my time on this is completely wasted to the point that I cannot even *submit *the work; and b) it is not permitted to use a radiomics package on what is very clearly a prime use case for a radiomics approach!\n\nI still have a day and a half to submit something. Any advice appreciated ASAP! (Fortunately the pipeline runs relatively fast.)"
    }
  ],
  "comments": [
    {
      "id": 2160434,
      "author_name": "Antti Isosalo",
      "author_url": "",
      "post_date": "2023-02-26T17:11:13.650000",
      "content": "<p>Did you find a working solution? I am making and copying the wheels on the Kaggle platform (e.g., <code>!pip wheel pyradiomics</code>) into a personal Kaggle dataset and adding them from there. (There might be many whl files created and you could try to see which of the dependencies are already satisfied to make your zip to be uploaded as a dataset smaller.) Here is a good tutorial: <a href=\"https://www.kaggle.com/code/jiny333/creating-whl-files-to-install-external-libraries\" target=\"_blank\">https://www.kaggle.com/code/jiny333/creating-whl-files-to-install-external-libraries</a></p>",
      "votes": 1,
      "replies": [
        {
          "id": 2160578,
          "author_name": "Antti Isosalo",
          "author_url": "",
          "post_date": "2023-02-26T19:23:05.310000",
          "content": "<p>It would be interesting to hear about this pyradiomics-based solution if it some day becomes public. 👍</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 2160658,
          "author_name": "gsharpminor",
          "author_url": "",
          "post_date": "2023-02-26T20:38:57.240000",
          "content": "<p>Thanks Antti. I might try this \"wheels\" approach. So far i have been trying to just bring in the packages i need from Github, store them in local folder, and then use pip to install them from there instead of the internet. But this leads to a string of dependencies i have to install too… then dependencies for the dependencies… and here we are still 😒</p>",
          "votes": 1,
          "replies": [
            {
              "id": 2160665,
              "author_name": "gsharpminor",
              "author_url": "",
              "post_date": "2023-02-26T20:56:32.327000",
              "content": "<p>Also when I install dependencies i often find i can't even look in the folders i downloaded. They just hang forever:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F930277%2F57ffaac4efc88b8c3acf4449adc83556%2FScreenshot%20from%202023-02-26%2013-51-14.png?generation=1677444818785444&amp;alt=media\" alt=\"\"></p>\n<p>Previously, the whole system got sick when i tried to run the first cell that sets up the environment: </p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F930277%2Fb1303793e01c813afcdca22c3f910495%2FScreenshot%20from%202023-02-26%2007-27-23_kaggleMalfunction.png?generation=1677444968857888&amp;alt=media\" alt=\"\"></p>\n<p>Like, who is in charge here? I am basically being kept from even <em>submitting my work</em> by absurd technical issues.</p>",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2160668,
              "author_name": "Antti Isosalo",
              "author_url": "",
              "post_date": "2023-02-26T21:06:56.087000",
              "content": "<p>Let's be in charge today. Fork this <a href=\"https://www.kaggle.com/code/anttiisosalo/create-pyradiomics-wheel/notebook\" target=\"_blank\">https://www.kaggle.com/code/anttiisosalo/create-pyradiomics-wheel/notebook</a> &gt; download zip, upload as private dataset, and add data, and you should be good to go.</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2160669,
              "author_name": "Antti Isosalo",
              "author_url": "",
              "post_date": "2023-02-26T21:08:13.577000",
              "content": "<p>And see here <a href=\"https://www.kaggle.com/code/anttiisosalo/16-bit-post-processing-rsna-bc-detection?scriptVersionId=119182142&amp;cellId=12\" target=\"_blank\">https://www.kaggle.com/code/anttiisosalo/16-bit-post-processing-rsna-bc-detection?scriptVersionId=119182142&amp;cellId=12</a> how I am accessing private resources.</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2160690,
              "author_name": "gsharpminor",
              "author_url": "",
              "post_date": "2023-02-26T22:09:27.720000",
              "content": "<p>I like your attitude 😀. But i think i have got it working without having to mess with repos or wheels.</p>\n<p>The thing i didn't see is the \"persistence\" pull down. So I did the following:</p>\n<ol>\n<li><p>With internet on, do usual !pip install pyradiomics</p></li>\n<li><p>Set \"persistence\" to \"variables and files\". also set \"environment\" to \"always use latest environment\"</p></li>\n<li><p>Now turn off internet and submit. </p></li>\n</ol>\n<p>It looks like by doing this, you can tell the Kaggle notebook to simply <em>remember</em> whatever libraries you already had installed and open before the internet switched off. So since i already installed pyradiomics, it remembers to hang on to it. </p>\n<p>We will see if it finishes… so far running about an hour with no \"import error\", far longer than it was before… else i will follow your advice…</p>",
              "votes": 1,
              "replies": []
            },
            {
              "id": 2160696,
              "author_name": "",
              "author_url": "",
              "post_date": "2023-02-26T22:21:12.250000",
              "content": "",
              "votes": 0,
              "replies": []
            },
            {
              "id": 2160785,
              "author_name": "gsharpminor",
              "author_url": "",
              "post_date": "2023-02-27T01:35:57.540000",
              "content": "<p>Well, I tried just about everything. But the wheels don't work either. I can bring them in as a zip file, but when I try to actually use them to build pyradiomics, I just get </p>\n<blockquote>\n  <p>\"ERROR: [packagename].whl is not a supported wheel on this platform.\"</p>\n</blockquote>\n<p>It's really odd that the competition organizers seem to have made it so hard for anyone to use any packages but the ones they already thought of. And it has nothing to do with the competition rules, since I can run this on my own home computer without internet, no problem.</p>\n<p>Maybe will try looking for exact versions of the wheels to match the Python version Kaggle is using? I'm about out of ideas.</p>\n<p>**UPDATE: I was downloading wheels for the wrong version of Python (3.8, while Kaggle uses 3.7.12). So now the wheels install fine and pyradiomics is installing + running without internet! </p>\n<p>(Still think it should be made much simpler for people to use unusual python packages on here.)**</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 2160328,
      "author_name": "Kyle Graupe",
      "author_url": "",
      "post_date": "2023-02-26T15:29:51.510000",
      "content": "<p>Yea. In my experience you need \"internet on\" to install anything that's not standard in Kaggle notebooks (numpy, pandas, etc.) I am not familiar with an pre-download methods, but that does not mean it doesn't exist.</p>",
      "votes": 0,
      "replies": [
        {
          "id": 2160344,
          "author_name": "gsharpminor",
          "author_url": "",
          "post_date": "2023-02-26T15:49:25.233000",
          "content": "<p>I think I may have an idea (fingers crossed), for anyone curious. The key is mentioned <a href=\"https://www.kaggle.com/competitions/ubiquant-market-prediction/discussion/303294\" target=\"_blank\">here</a>: </p>\n<p>Gist of what you do is:</p>\n<ol>\n<li>use git to clone the repo of the package you need into your working directory on Kaggle.</li>\n<li>set the notebook to \"file persistence\" so that the repo is still there in subsequent runs. </li>\n<li>Change the !pip command so that it points at the cloned repo in your own directory rather than at the internet</li>\n<li>Change the import statement so it imports from the repo</li>\n<li>Repeat for any needed dependencies</li>\n</ol>",
          "votes": 1,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "2160434": "Did you find a working solution? I am making and copying the wheels on the Kaggle platform (e.g., `!pip wheel pyradiomics`) into a personal Kaggle dataset and adding them from there. (There might be many whl files created and you could try to see which of the dependencies are already satisfied to make your zip to be uploaded as a dataset smaller.) Here is a good tutorial: https://www.kaggle.com/code/jiny333/creating-whl-files-to-install-external-libraries",
    "2160328": "Yea. In my experience you need \"internet on\" to install anything that's not standard in Kaggle notebooks (numpy, pandas, etc.) I am not familiar with an pre-download methods, but that does not mean it doesn't exist.",
    "2160308": "New Kaggler here... So I built a pipeline to use a radiomics-based approach on the RSNA challenge, specifically using the [pyradiomics ](https://pyradiomics.readthedocs.io/en/latest/) Python module. \n\nIt runs perfectly on my home computer and also in the Kaggle notebook... until I set \"internet off\" mode. Then, when I try to import the pyradiomics package with\n\n`!pip install pyradiomics`\n\nI instead get: \n>ERROR: Could not find a version that satisfies the requirement pyradiomics\n\nand also:\n>ModuleNotFoundError: No module named 'radiomics'\n\n...It appears that PyRadiomics is not part of the environment previously set up by Kaggle, so with internet off it hits a wall trying to download it. So is there any way to pre-load a module that you need, before submitting in \"internet off\" mode?\n\nIt would be almost unbelievable if a) my time on this is completely wasted to the point that I cannot even *submit *the work; and b) it is not permitted to use a radiomics package on what is very clearly a prime use case for a radiomics approach!\n\nI still have a day and a half to submit something. Any advice appreciated ASAP! (Fortunately the pipeline runs relatively fast.)"
  }
}