{
  "id": 291547,
  "title": "Error while importing greatbarrierreef",
  "url": "/competitions/tensorflow-great-barrier-reef/discussion/291547",
  "author_name": "",
  "post_date": "2021-11-29T22:31:46.352563200Z",
  "votes": 2,
  "comment_count": 13,
  "views": 0,
  "content": "<p>When I try to import greatbarrierreef, I get an error saying 'no module named greatbarrierreef.competition'. Where am I going wrong?</p>\n<pre><code>      1 \n----&gt; 2 from .competition import make_env\n      3 \n      4 __all__ = ['make_env']\n\nModuleNotFoundError: No module named 'greatbarrierreef.competition'\n</code></pre>",
  "messages": [
    {
      "id": "1599858",
      "postDate": "11/29/2021 22:31:46",
      "content": "<p>When I try to import greatbarrierreef, I get an error saying 'no module named greatbarrierreef.competition'. Where am I going wrong?</p>\n<pre><code>      1 \n----&gt; 2 from .competition import make_env\n      3 \n      4 __all__ = ['make_env']\n\nModuleNotFoundError: No module named 'greatbarrierreef.competition'\n</code></pre>",
      "rawMarkdown": "When I try to import greatbarrierreef, I get an error saying 'no module named greatbarrierreef.competition'. Where am I going wrong?\n\n```\n      1 \n----> 2 from .competition import make_env\n      3 \n      4 __all__ = ['make_env']\n\nModuleNotFoundError: No module named 'greatbarrierreef.competition'\n```",
      "votes": null
    },
    {
      "id": "1599953",
      "postDate": "11/30/2021 01:35:46",
      "content": "<p>You may need to add the competition dataset which includes the module.</p>",
      "rawMarkdown": "You may need to add the competition dataset which includes the module.",
      "votes": null
    },
    {
      "id": "1599958",
      "postDate": "11/30/2021 01:38:07",
      "content": "<p>And do this as shown in \"Evaluation\" page (I still have questions regarding the test APIs, though):<br>\nimport greatbarrierreef<br>\nenv = greatbarrierreef.make_env()</p>",
      "rawMarkdown": "And do this as shown in \"Evaluation\" page (I still have questions regarding the test APIs, though):\nimport greatbarrierreef\nenv = greatbarrierreef.make_env()",
      "votes": null
    },
    {
      "id": "1600484",
      "postDate": "11/30/2021 13:11:14",
      "content": "<p>Why dont you do like this</p>\n<pre><code>INPUT_DIR = '../input/tensorflow-great-barrier-reef/'\nsys.path.insert(0, INPUT_DIR)\nimport greatbarrierreef\n</code></pre>\n<p>Reference: <a href=\"https://www.kaggle.com/khanhlvg/inference-using-efficientdet-d0-model-tensorflow\" target=\"_blank\">https://www.kaggle.com/khanhlvg/inference-using-efficientdet-d0-model-tensorflow</a></p>\n<p>EDIT:<br>\nI dont know why this just didnt worked<br>\nchange the <code>INPUT_DIR = '../input/tensorflow-great-barrier-reef/greatbarrierreef'</code></p>",
      "rawMarkdown": "Why dont you do like this\n```\nINPUT_DIR = '../input/tensorflow-great-barrier-reef/'\nsys.path.insert(0, INPUT_DIR)\nimport greatbarrierreef\n```\nReference: https://www.kaggle.com/khanhlvg/inference-using-efficientdet-d0-model-tensorflow\n\nEDIT:\nI dont know why this just didnt worked\nchange the `INPUT_DIR = '../input/tensorflow-great-barrier-reef/greatbarrierreef'`",
      "votes": null
    },
    {
      "id": "1600645",
      "postDate": "11/30/2021 15:29:34",
      "content": "<p>Same error here. Solutions mentioned do not solve the problem.</p>\n<p>Using similar directory structure on localhost as on my Kaggle notebook </p>\n<pre><code>import sys\nsys.path.append('../input/tensorflow-great-barrier-reef') \nimport greatbarrierreef\n</code></pre>\n<p>results in</p>\n<pre><code>ModuleNotFoundError: No module named 'greatbarrierreef.competition'\n</code></pre>\n<p>So: it <strong>does</strong> find <code>greatbarrierreef</code> but errors when in the relative <code>from .competition</code> import inside the package.</p>",
      "rawMarkdown": "Same error here. Solutions mentioned do not solve the problem.\n\nUsing similar directory structure on localhost as on my Kaggle notebook \n\n```\nimport sys\nsys.path.append('../input/tensorflow-great-barrier-reef') \nimport greatbarrierreef\n```\n\nresults in\n\n```\nModuleNotFoundError: No module named 'greatbarrierreef.competition'\n```\n\nSo: it **does** find `greatbarrierreef` but errors when in the relative `from .competition` import inside the package.",
      "votes": null
    },
    {
      "id": "1600650",
      "postDate": "11/30/2021 15:38:24",
      "content": "<p>sorry <br>\nINPUT_DIR = ../input/tensorflow-great-barrier-reef/greatbarrierreef<br>\nThis works<br>\n<img src=\"https://i.ibb.co/ZmXdRkW/image.png\" alt=\"\"></p>",
      "rawMarkdown": "sorry \nINPUT_DIR = ../input/tensorflow-great-barrier-reef/greatbarrierreef\nThis works\n![](https://i.ibb.co/ZmXdRkW/image.png)",
      "votes": null
    },
    {
      "id": "1600658",
      "postDate": "11/30/2021 15:49:48",
      "content": "<p>Unfortunately this still doesn't seem to work for me ☹️</p>\n<p>Still same error</p>\n<p>edit: studying python docs on relative imports atm 😑</p>",
      "rawMarkdown": "Unfortunately this still doesn't seem to work for me ☹️\n\nStill same error\n\nedit: studying python docs on relative imports atm 😑",
      "votes": null
    },
    {
      "id": "1600659",
      "postDate": "11/30/2021 15:50:20",
      "content": "<p>restart the kernel and try it again</p>",
      "rawMarkdown": "restart the kernel and try it again",
      "votes": null
    },
    {
      "id": "1600669",
      "postDate": "11/30/2021 15:57:44",
      "content": "<p>Can't get the package to work at all… I'm on python 3.9.6</p>\n<p>See the following:</p>\n<pre><code>hendrik@hendrik-Lenovo-ideapad-520S-14IKB:~/gsol/kaggle/gbr/input/tensorflow-great-barrier-reef$ l\nexample_sample_submission.csv  greatbarrierreef/  train.csv\nexample_test.npy               test.csv           train_images/\nhendrik@hendrik-Lenovo-ideapad-520S-14IKB:~/gsol/kaggle/gbr/input/tensorflow-great-barrier-reef$ python\nPython 3.9.6 (default, Aug 17 2021, 16:59:40) \n[GCC 7.5.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n&gt;&gt;&gt; import greatbarrierreef\nTraceback (most recent call last):\n  File \"&lt;stdin&gt;\", line 1, in &lt;module&gt;\n  File \"/home/hendrik/gsol/kaggle/gbr/input/tensorflow-great-barrier-reef/greatbarrierreef/__init__.py\", line 2, in &lt;module&gt;\n    from .competition import make_env\nModuleNotFoundError: No module named 'greatbarrierreef.competition'\n</code></pre>\n<p>Edit: for completeness; it DOES work for me on the remote Kaggle notebook.</p>",
      "rawMarkdown": "Can't get the package to work at all... I'm on python 3.9.6\n\nSee the following:\n\n```\nhendrik@hendrik-Lenovo-ideapad-520S-14IKB:~/gsol/kaggle/gbr/input/tensorflow-great-barrier-reef$ l\nexample_sample_submission.csv  greatbarrierreef/  train.csv\nexample_test.npy               test.csv           train_images/\nhendrik@hendrik-Lenovo-ideapad-520S-14IKB:~/gsol/kaggle/gbr/input/tensorflow-great-barrier-reef$ python\nPython 3.9.6 (default, Aug 17 2021, 16:59:40) \n[GCC 7.5.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import greatbarrierreef\nTraceback (most recent call last):\n  File \"<stdin>\", line 1, in <module>\n  File \"/home/hendrik/gsol/kaggle/gbr/input/tensorflow-great-barrier-reef/greatbarrierreef/__init__.py\", line 2, in <module>\n    from .competition import make_env\nModuleNotFoundError: No module named 'greatbarrierreef.competition'\n```\n\nEdit: for completeness; it DOES work for me on the remote Kaggle notebook.",
      "votes": null
    },
    {
      "id": "1600679",
      "postDate": "11/30/2021 16:12:55",
      "content": "<p>Pretty sure it has to do with that <code>competition.cpython-37m-x86_64-linux-gnu.so</code> file containing the API, instead of \"normal\" .py files.</p>",
      "rawMarkdown": "Pretty sure it has to do with that `competition.cpython-37m-x86_64-linux-gnu.so` file containing the API, instead of \"normal\" .py files.",
      "votes": null
    },
    {
      "id": "1600683",
      "postDate": "11/30/2021 16:17:33",
      "content": "<p>Possible cause is the version difference of Python. Kaggle notebooks use 3.7.10 and my laptop uses 3.9.6. </p>",
      "rawMarkdown": "Possible cause is the version difference of Python. Kaggle notebooks use 3.7.10 and my laptop uses 3.9.6.",
      "votes": null
    },
    {
      "id": "1600690",
      "postDate": "11/30/2021 16:22:42",
      "content": "<p>Yeah, you need to be on the same python version to run this locally. The easiest way is to use Kaggle's docker image, which will give you an exact match of the notebooks environment - <a href=\"https://github.com/Kaggle/docker-python\" target=\"_blank\">https://github.com/Kaggle/docker-python</a></p>",
      "rawMarkdown": "Yeah, you need to be on the same python version to run this locally. The easiest way is to use Kaggle's docker image, which will give you an exact match of the notebooks environment - https://github.com/Kaggle/docker-python",
      "votes": null
    },
    {
      "id": "1600694",
      "postDate": "11/30/2021 16:26:32",
      "content": "<p>Thanks both for your replies. I just confirmed that the python versions indeed was the cause and just found your reply. I will use the docker image. Thank you!💯</p>",
      "rawMarkdown": "Thanks both for your replies. I just confirmed that the python versions indeed was the cause and just found your reply. I will use the docker image. Thank you!💯",
      "votes": null
    },
    {
      "id": "1636960",
      "postDate": "01/03/2022 12:18:02",
      "content": "<p>Same error here.<br>\nPlease upload \"competition.cp37-win-amd64.pyd\" file also for windows os.<br>\n(\"competition.cpython-37m-x86_64-linux-gnu.so\")</p>\n<p>++ Kaggle notebooks use python version 3.7.10 but that version not support windows os.<br>\n\"3.7.9 was the last release to provide binary installers for Windows and macOS.\"<br>\n(<a href=\"https://www.python.org/downloads/release/python-3710/\" target=\"_blank\">https://www.python.org/downloads/release/python-3710/</a>)</p>",
      "rawMarkdown": "Same error here.\nPlease upload \"competition.cp37-win-amd64.pyd\" file also for windows os.\n(\"competition.cpython-37m-x86_64-linux-gnu.so\")\n\n\n++ Kaggle notebooks use python version 3.7.10 but that version not support windows os.\n\"3.7.9 was the last release to provide binary installers for Windows and macOS.\"\n(https://www.python.org/downloads/release/python-3710/)",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1599953,
      "author_name": "tjtong",
      "author_url": "",
      "post_date": "11/30/2021 01:35:46",
      "content": "<p>You may need to add the competition dataset which includes the module.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1599958,
      "author_name": "tjtong",
      "author_url": "",
      "post_date": "11/30/2021 01:38:07",
      "content": "<p>And do this as shown in \"Evaluation\" page (I still have questions regarding the test APIs, though):<br>\nimport greatbarrierreef<br>\nenv = greatbarrierreef.make_env()</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1600484,
      "author_name": "morizin",
      "author_url": "",
      "post_date": "11/30/2021 13:11:14",
      "content": "<p>Why dont you do like this</p>\n<pre><code>INPUT_DIR = '../input/tensorflow-great-barrier-reef/'\nsys.path.insert(0, INPUT_DIR)\nimport greatbarrierreef\n</code></pre>\n<p>Reference: <a href=\"https://www.kaggle.com/khanhlvg/inference-using-efficientdet-d0-model-tensorflow\" target=\"_blank\">https://www.kaggle.com/khanhlvg/inference-using-efficientdet-d0-model-tensorflow</a></p>\n<p>EDIT:<br>\nI dont know why this just didnt worked<br>\nchange the <code>INPUT_DIR = '../input/tensorflow-great-barrier-reef/greatbarrierreef'</code></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1600645,
      "author_name": "hendrikgrondijs",
      "author_url": "",
      "post_date": "11/30/2021 15:29:34",
      "content": "<p>Same error here. Solutions mentioned do not solve the problem.</p>\n<p>Using similar directory structure on localhost as on my Kaggle notebook </p>\n<pre><code>import sys\nsys.path.append('../input/tensorflow-great-barrier-reef') \nimport greatbarrierreef\n</code></pre>\n<p>results in</p>\n<pre><code>ModuleNotFoundError: No module named 'greatbarrierreef.competition'\n</code></pre>\n<p>So: it <strong>does</strong> find <code>greatbarrierreef</code> but errors when in the relative <code>from .competition</code> import inside the package.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1600650,
          "author_name": "morizin",
          "author_url": "",
          "post_date": "11/30/2021 15:38:24",
          "content": "<p>sorry <br>\nINPUT_DIR = ../input/tensorflow-great-barrier-reef/greatbarrierreef<br>\nThis works<br>\n<img src=\"https://i.ibb.co/ZmXdRkW/image.png\" alt=\"\"></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1600658,
          "author_name": "hendrikgrondijs",
          "author_url": "",
          "post_date": "11/30/2021 15:49:48",
          "content": "<p>Unfortunately this still doesn't seem to work for me ☹️</p>\n<p>Still same error</p>\n<p>edit: studying python docs on relative imports atm 😑</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1600659,
          "author_name": "morizin",
          "author_url": "",
          "post_date": "11/30/2021 15:50:20",
          "content": "<p>restart the kernel and try it again</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1600669,
          "author_name": "hendrikgrondijs",
          "author_url": "",
          "post_date": "11/30/2021 15:57:44",
          "content": "<p>Can't get the package to work at all… I'm on python 3.9.6</p>\n<p>See the following:</p>\n<pre><code>hendrik@hendrik-Lenovo-ideapad-520S-14IKB:~/gsol/kaggle/gbr/input/tensorflow-great-barrier-reef$ l\nexample_sample_submission.csv  greatbarrierreef/  train.csv\nexample_test.npy               test.csv           train_images/\nhendrik@hendrik-Lenovo-ideapad-520S-14IKB:~/gsol/kaggle/gbr/input/tensorflow-great-barrier-reef$ python\nPython 3.9.6 (default, Aug 17 2021, 16:59:40) \n[GCC 7.5.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n&gt;&gt;&gt; import greatbarrierreef\nTraceback (most recent call last):\n  File \"&lt;stdin&gt;\", line 1, in &lt;module&gt;\n  File \"/home/hendrik/gsol/kaggle/gbr/input/tensorflow-great-barrier-reef/greatbarrierreef/__init__.py\", line 2, in &lt;module&gt;\n    from .competition import make_env\nModuleNotFoundError: No module named 'greatbarrierreef.competition'\n</code></pre>\n<p>Edit: for completeness; it DOES work for me on the remote Kaggle notebook.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1600679,
          "author_name": "hendrikgrondijs",
          "author_url": "",
          "post_date": "11/30/2021 16:12:55",
          "content": "<p>Pretty sure it has to do with that <code>competition.cpython-37m-x86_64-linux-gnu.so</code> file containing the API, instead of \"normal\" .py files.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1600683,
          "author_name": "hendrikgrondijs",
          "author_url": "",
          "post_date": "11/30/2021 16:17:33",
          "content": "<p>Possible cause is the version difference of Python. Kaggle notebooks use 3.7.10 and my laptop uses 3.9.6. </p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1600690,
          "author_name": "wcukierski",
          "author_url": "",
          "post_date": "11/30/2021 16:22:42",
          "content": "<p>Yeah, you need to be on the same python version to run this locally. The easiest way is to use Kaggle's docker image, which will give you an exact match of the notebooks environment - <a href=\"https://github.com/Kaggle/docker-python\" target=\"_blank\">https://github.com/Kaggle/docker-python</a></p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1600694,
          "author_name": "hendrikgrondijs",
          "author_url": "",
          "post_date": "11/30/2021 16:26:32",
          "content": "<p>Thanks both for your replies. I just confirmed that the python versions indeed was the cause and just found your reply. I will use the docker image. Thank you!💯</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1636960,
      "author_name": "kdw920304",
      "author_url": "",
      "post_date": "01/03/2022 12:18:02",
      "content": "<p>Same error here.<br>\nPlease upload \"competition.cp37-win-amd64.pyd\" file also for windows os.<br>\n(\"competition.cpython-37m-x86_64-linux-gnu.so\")</p>\n<p>++ Kaggle notebooks use python version 3.7.10 but that version not support windows os.<br>\n\"3.7.9 was the last release to provide binary installers for Windows and macOS.\"<br>\n(<a href=\"https://www.python.org/downloads/release/python-3710/\" target=\"_blank\">https://www.python.org/downloads/release/python-3710/</a>)</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1599858": "When I try to import greatbarrierreef, I get an error saying 'no module named greatbarrierreef.competition'. Where am I going wrong?\n\n```\n      1 \n----> 2 from .competition import make_env\n      3 \n      4 __all__ = ['make_env']\n\nModuleNotFoundError: No module named 'greatbarrierreef.competition'\n```",
    "1599953": "You may need to add the competition dataset which includes the module.",
    "1599958": "And do this as shown in \"Evaluation\" page (I still have questions regarding the test APIs, though):\nimport greatbarrierreef\nenv = greatbarrierreef.make_env()",
    "1600484": "Why dont you do like this\n```\nINPUT_DIR = '../input/tensorflow-great-barrier-reef/'\nsys.path.insert(0, INPUT_DIR)\nimport greatbarrierreef\n```\nReference: https://www.kaggle.com/khanhlvg/inference-using-efficientdet-d0-model-tensorflow\n\nEDIT:\nI dont know why this just didnt worked\nchange the `INPUT_DIR = '../input/tensorflow-great-barrier-reef/greatbarrierreef'`",
    "1600645": "Same error here. Solutions mentioned do not solve the problem.\n\nUsing similar directory structure on localhost as on my Kaggle notebook \n\n```\nimport sys\nsys.path.append('../input/tensorflow-great-barrier-reef') \nimport greatbarrierreef\n```\n\nresults in\n\n```\nModuleNotFoundError: No module named 'greatbarrierreef.competition'\n```\n\nSo: it **does** find `greatbarrierreef` but errors when in the relative `from .competition` import inside the package.",
    "1600650": "sorry \nINPUT_DIR = ../input/tensorflow-great-barrier-reef/greatbarrierreef\nThis works\n![](https://i.ibb.co/ZmXdRkW/image.png)",
    "1600658": "Unfortunately this still doesn't seem to work for me ☹️\n\nStill same error\n\nedit: studying python docs on relative imports atm 😑",
    "1600659": "restart the kernel and try it again",
    "1600669": "Can't get the package to work at all... I'm on python 3.9.6\n\nSee the following:\n\n```\nhendrik@hendrik-Lenovo-ideapad-520S-14IKB:~/gsol/kaggle/gbr/input/tensorflow-great-barrier-reef$ l\nexample_sample_submission.csv  greatbarrierreef/  train.csv\nexample_test.npy               test.csv           train_images/\nhendrik@hendrik-Lenovo-ideapad-520S-14IKB:~/gsol/kaggle/gbr/input/tensorflow-great-barrier-reef$ python\nPython 3.9.6 (default, Aug 17 2021, 16:59:40) \n[GCC 7.5.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import greatbarrierreef\nTraceback (most recent call last):\n  File \"<stdin>\", line 1, in <module>\n  File \"/home/hendrik/gsol/kaggle/gbr/input/tensorflow-great-barrier-reef/greatbarrierreef/__init__.py\", line 2, in <module>\n    from .competition import make_env\nModuleNotFoundError: No module named 'greatbarrierreef.competition'\n```\n\nEdit: for completeness; it DOES work for me on the remote Kaggle notebook.",
    "1600679": "Pretty sure it has to do with that `competition.cpython-37m-x86_64-linux-gnu.so` file containing the API, instead of \"normal\" .py files.",
    "1600683": "Possible cause is the version difference of Python. Kaggle notebooks use 3.7.10 and my laptop uses 3.9.6.",
    "1600690": "Yeah, you need to be on the same python version to run this locally. The easiest way is to use Kaggle's docker image, which will give you an exact match of the notebooks environment - https://github.com/Kaggle/docker-python",
    "1600694": "Thanks both for your replies. I just confirmed that the python versions indeed was the cause and just found your reply. I will use the docker image. Thank you!💯",
    "1636960": "Same error here.\nPlease upload \"competition.cp37-win-amd64.pyd\" file also for windows os.\n(\"competition.cpython-37m-x86_64-linux-gnu.so\")\n\n\n++ Kaggle notebooks use python version 3.7.10 but that version not support windows os.\n\"3.7.9 was the last release to provide binary installers for Windows and macOS.\"\n(https://www.python.org/downloads/release/python-3710/)"
  },
  "source": "meta"
}