{
  "id": 177705,
  "title": "How to install l5kit on windows 10 anaconda environment(multi processing error)",
  "url": "/competitions/lyft-motion-prediction-autonomous-vehicles/discussion/177705",
  "author_name": "senkin13",
  "post_date": "2020-08-27T01:57:24.331000",
  "votes": 10,
  "comment_count": 24,
  "views": 0,
  "content": "<p>`---------------------------------------------------------------------------<br>\nValueError                                Traceback (most recent call last)<br>\n in <br>\n     10 <br>\n     11 from l5kit.data import LocalDataManager, ChunkedDataset<br>\n<strong>---&gt; 12 from l5kit.dataset import AgentDataset, EgoDataset</strong><br>\n     13 from l5kit.rasterization import build_rasterizer</p>\n<p>~\\Anaconda3\\lib\\site-packages\\l5kit\\dataset__init__.py in <br>\n<strong>----&gt; 1 from .agent import AgentDataset</strong><br>\n      2 from .ego import EgoDataset<br>\n      3 from .select_agents import select_agents<br>\n      4 <br>\n      5 <strong>all</strong> = [\"EgoDataset\", \"AgentDataset\", \"select_agents\"]</p>\n<p>~\\Anaconda3\\lib\\site-packages\\l5kit\\dataset\\agent.py in <br>\n     10 from ..rasterization import Rasterizer<br>\n     11 from .ego import EgoDataset<br>\n<strong>---&gt; 12 from .select_agents import TH_DISTANCE_AV, TH_EXTENT_RATIO, TH_YAW_DEGREE, select_agents</strong><br>\n     13 <br>\n     14 # WARNING: changing these values impact the number of instances selected for both train and inference!</p>\n<p>~\\Anaconda3\\lib\\site-packages\\l5kit\\dataset\\select_agents.py in <br>\n     19 from l5kit.data.filter import _get_label_filter  # TODO expose this without digging<br>\n     20 <br>\n<strong>---&gt; 21 multiprocessing.set_start_method(\"fork\", force=True)  # this fix loop in python 3.8 on MacOS</strong><br>\n     22 os.environ[\"BLOSC_NOLOCK\"] = \"1\"  # this is required for multiprocessing<br>\n     23 </p>\n<p>~\\Anaconda3\\lib\\multiprocessing\\context.py in set_start_method(self, method, force)<br>\n    244             self._actual_context = None<br>\n    245             return<br>\n--&gt; 246         self._actual_context = self.get_context(method)<br>\n    247 <br>\n    248     def get_start_method(self, allow_none=False):</p>\n<p>~\\Anaconda3\\lib\\multiprocessing\\context.py in get_context(self, method)<br>\n    236             return self._actual_context<br>\n    237         else:<br>\n--&gt; 238             return super().get_context(method)<br>\n    239 <br>\n    240     def set_start_method(self, method, force=False):</p>\n<p>~\\Anaconda3\\lib\\multiprocessing\\context.py in get_context(self, method)<br>\n    190             ctx = _concrete_contexts[method]<br>\n    191         except KeyError:<br>\n--&gt; 192             raise ValueError('cannot find context for %r' % method) from None<br>\n    193         ctx._check_available()<br>\n    194         return ctx</p>\n<p><strong>ValueError: cannot find context for 'fork'</strong>`</p>",
  "messages": [
    {
      "id": 987083,
      "postDate": "2020-08-27T01:57:24.330Z",
      "content": "<p>`---------------------------------------------------------------------------<br>\nValueError                                Traceback (most recent call last)<br>\n in <br>\n     10 <br>\n     11 from l5kit.data import LocalDataManager, ChunkedDataset<br>\n<strong>---&gt; 12 from l5kit.dataset import AgentDataset, EgoDataset</strong><br>\n     13 from l5kit.rasterization import build_rasterizer</p>\n<p>~\\Anaconda3\\lib\\site-packages\\l5kit\\dataset__init__.py in <br>\n<strong>----&gt; 1 from .agent import AgentDataset</strong><br>\n      2 from .ego import EgoDataset<br>\n      3 from .select_agents import select_agents<br>\n      4 <br>\n      5 <strong>all</strong> = [\"EgoDataset\", \"AgentDataset\", \"select_agents\"]</p>\n<p>~\\Anaconda3\\lib\\site-packages\\l5kit\\dataset\\agent.py in <br>\n     10 from ..rasterization import Rasterizer<br>\n     11 from .ego import EgoDataset<br>\n<strong>---&gt; 12 from .select_agents import TH_DISTANCE_AV, TH_EXTENT_RATIO, TH_YAW_DEGREE, select_agents</strong><br>\n     13 <br>\n     14 # WARNING: changing these values impact the number of instances selected for both train and inference!</p>\n<p>~\\Anaconda3\\lib\\site-packages\\l5kit\\dataset\\select_agents.py in <br>\n     19 from l5kit.data.filter import _get_label_filter  # TODO expose this without digging<br>\n     20 <br>\n<strong>---&gt; 21 multiprocessing.set_start_method(\"fork\", force=True)  # this fix loop in python 3.8 on MacOS</strong><br>\n     22 os.environ[\"BLOSC_NOLOCK\"] = \"1\"  # this is required for multiprocessing<br>\n     23 </p>\n<p>~\\Anaconda3\\lib\\multiprocessing\\context.py in set_start_method(self, method, force)<br>\n    244             self._actual_context = None<br>\n    245             return<br>\n--&gt; 246         self._actual_context = self.get_context(method)<br>\n    247 <br>\n    248     def get_start_method(self, allow_none=False):</p>\n<p>~\\Anaconda3\\lib\\multiprocessing\\context.py in get_context(self, method)<br>\n    236             return self._actual_context<br>\n    237         else:<br>\n--&gt; 238             return super().get_context(method)<br>\n    239 <br>\n    240     def set_start_method(self, method, force=False):</p>\n<p>~\\Anaconda3\\lib\\multiprocessing\\context.py in get_context(self, method)<br>\n    190             ctx = _concrete_contexts[method]<br>\n    191         except KeyError:<br>\n--&gt; 192             raise ValueError('cannot find context for %r' % method) from None<br>\n    193         ctx._check_available()<br>\n    194         return ctx</p>\n<p><strong>ValueError: cannot find context for 'fork'</strong>`</p>",
      "rawMarkdown": "`---------------------------------------------------------------------------\nValueError                                Traceback (most recent call last)\n<ipython-input-2-dcf842653d34> in <module>\n     10 \n     11 from l5kit.data import LocalDataManager, ChunkedDataset\n**---> 12 from l5kit.dataset import AgentDataset, EgoDataset**\n     13 from l5kit.rasterization import build_rasterizer\n\n~\\Anaconda3\\lib\\site-packages\\l5kit\\dataset\\__init__.py in <module>\n**----> 1 from .agent import AgentDataset**\n      2 from .ego import EgoDataset\n      3 from .select_agents import select_agents\n      4 \n      5 __all__ = [\"EgoDataset\", \"AgentDataset\", \"select_agents\"]\n\n~\\Anaconda3\\lib\\site-packages\\l5kit\\dataset\\agent.py in <module>\n     10 from ..rasterization import Rasterizer\n     11 from .ego import EgoDataset\n**---> 12 from .select_agents import TH_DISTANCE_AV, TH_EXTENT_RATIO, TH_YAW_DEGREE, select_agents**\n     13 \n     14 # WARNING: changing these values impact the number of instances selected for both train and inference!\n\n~\\Anaconda3\\lib\\site-packages\\l5kit\\dataset\\select_agents.py in <module>\n     19 from l5kit.data.filter import _get_label_filter  # TODO expose this without digging\n     20 \n**---> 21 multiprocessing.set_start_method(\"fork\", force=True)  # this fix loop in python 3.8 on MacOS**\n     22 os.environ[\"BLOSC_NOLOCK\"] = \"1\"  # this is required for multiprocessing\n     23 \n\n~\\Anaconda3\\lib\\multiprocessing\\context.py in set_start_method(self, method, force)\n    244             self._actual_context = None\n    245             return\n--> 246         self._actual_context = self.get_context(method)\n    247 \n    248     def get_start_method(self, allow_none=False):\n\n~\\Anaconda3\\lib\\multiprocessing\\context.py in get_context(self, method)\n    236             return self._actual_context\n    237         else:\n--> 238             return super().get_context(method)\n    239 \n    240     def set_start_method(self, method, force=False):\n\n~\\Anaconda3\\lib\\multiprocessing\\context.py in get_context(self, method)\n    190             ctx = _concrete_contexts[method]\n    191         except KeyError:\n--> 192             raise ValueError('cannot find context for %r' % method) from None\n    193         ctx._check_available()\n    194         return ctx\n\n**ValueError: cannot find context for 'fork'**`",
      "votes": 10
    },
    {
      "id": 987852,
      "postDate": "2020-08-27T15:16:49.767Z",
      "content": "<p>The fork multiprocessing method is not supported in Windows (discussed a little <a href=\"https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods\" target=\"_blank\">here</a>.<br>\nIt looks like the main use of this function is for creating a chopped validation dataset. So you may be able to just create the chopped dataset in linux but otherwise use windows. Though you may need to modify the sample code to directly use a pre-chopped validation dataset as I believe it will try to recreate it even if it exists (<code>create_chopped_dataset</code> will create a folder called <code>sample_chopped_100</code> when you run it on the sample dataset, just use this as the key for <code>dm.requires</code> and load it as in the example, adding the mask and ground truth csv stuff).</p>\n<p>You could use Kaggle to run <code>create_chopped_dataset</code> and then download that. Or you could set up WSL (Windows Subsystem for Linux) which lets you run a linux environment on windows easily. WSL2 has recently been released which has full linux support (some issues with WSL1 but may be fine for l5kit). This lets you run linux programs and input/output from your windows files. So would work well here.  No GPU access but that is actually coming, available in latest windows insider builds so when released (hopefully next year) you'll be able to run the fuil Linux PyTorch/TF on Windows with CUDA. So worth learning as a programmer who uses windows.</p>",
      "rawMarkdown": "The fork multiprocessing method is not supported in Windows (discussed a little [here](https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods).\nIt looks like the main use of this function is for creating a chopped validation dataset. So you may be able to just create the chopped dataset in linux but otherwise use windows. Though you may need to modify the sample code to directly use a pre-chopped validation dataset as I believe it will try to recreate it even if it exists (`create_chopped_dataset` will create a folder called `sample_chopped_100` when you run it on the sample dataset, just use this as the key for `dm.requires` and load it as in the example, adding the mask and ground truth csv stuff).\n\nYou could use Kaggle to run `create_chopped_dataset` and then download that. Or you could set up WSL (Windows Subsystem for Linux) which lets you run a linux environment on windows easily. WSL2 has recently been released which has full linux support (some issues with WSL1 but may be fine for l5kit). This lets you run linux programs and input/output from your windows files. So would work well here.  No GPU access but that is actually coming, available in latest windows insider builds so when released (hopefully next year) you'll be able to run the fuil Linux PyTorch/TF on Windows with CUDA. So worth learning as a programmer who uses windows.",
      "votes": 3,
      "replies": [
        {
          "id": 987873,
          "postDate": "2020-08-27T15:29:29.713Z",
          "content": "<p>Thank you so much for your detailed explanation.I am using WSL now,it worked well.👍</p>",
          "rawMarkdown": "Thank you so much for your detailed explanation.I am using WSL now,it worked well.👍"
        },
        {
          "id": 992120,
          "postDate": "2020-08-31T00:45:47.567Z",
          "content": "<p>Can I ask how did you pip3 install l5kit for that WSL because the regular -r requirements.txt exits with code 1.  Telling me that directory site-packages doesn't exist in home/usr/../python3.8/ and it doesn't have permissions.  Which is true but most are getting installed into home//.local/…./python3.8/site-packages.  So I tried changing --target=that directory.  But then it exits with code 1, and says error: option --home not recognized.  The entire error is a bit long.  </p>",
          "rawMarkdown": "Can I ask how did you pip3 install l5kit for that WSL because the regular -r requirements.txt exits with code 1.  Telling me that directory site-packages doesn't exist in home/usr/../python3.8/ and it doesn't have permissions.  Which is true but most are getting installed into home/<username>/.local/..../python3.8/site-packages.  So I tried changing --target=that directory.  But then it exits with code 1, and says error: option --home not recognized.  The entire error is a bit long.  "
        },
        {
          "id": 992683,
          "postDate": "2020-08-31T10:51:07.927Z",
          "content": "<p>You use <code>pip3 install --user l5kit</code> to install to .local. Or you can use <code>sudo pip3 install l5kit</code> to install system-wide (<code>sudo</code> is super-user do which is basically run as administrator for linux). But installing things system-wide outside of the system package manager is not considered good practice.</p>",
          "rawMarkdown": "You use `pip3 install --user l5kit` to install to .local. Or you can use `sudo pip3 install l5kit` to install system-wide (`sudo` is super-user do which is basically run as administrator for linux). But installing things system-wide outside of the system package manager is not considered good practice.",
          "votes": 1
        },
        {
          "id": 992903,
          "postDate": "2020-08-31T14:05:06.773Z",
          "content": "<p>Thanks --user worked perfectly. </p>",
          "rawMarkdown": "Thanks --user worked perfectly. "
        },
        {
          "id": 993498,
          "postDate": "2020-09-01T01:24:25.540Z",
          "content": "<p><a href=\"https://www.kaggle.com/thomasbrandon\" target=\"_blank\">@thomasbrandon</a> are you sure it is possible to create chopped_data_100 from kaggle kernel?  because 'chop_dataset function' is calling 'zarr_scenes_chop'. And It tries to write in input directory but input directory is read only. So we have to find work around in kaggle kernel right?</p>",
          "rawMarkdown": "@thomasbrandon are you sure it is possible to create chopped_data_100 from kaggle kernel?  because 'chop_dataset function' is calling 'zarr_scenes_chop'. And It tries to write in input directory but input directory is read only. So we have to find work around in kaggle kernel right?"
        },
        {
          "id": 993824,
          "postDate": "2020-09-01T06:59:38.067Z",
          "content": "<p>Yeah, parent of location needs to be writeable as it doesn't let you set output location. I copied it into /tmp. I've only done that with the sample set running the Lyft example so may be some space issues with copying the full validate set. Should also be able to symlink it (something like <code>!mkdir /tmp/lyft &amp;&amp; ln -s {eval_data} /tmp/lyft/validate</code> and then point <code>create-chopped_dataset</code> to /tmp/lyft/validate).</p>",
          "rawMarkdown": "Yeah, parent of location needs to be writeable as it doesn't let you set output location. I copied it into /tmp. I've only done that with the sample set running the Lyft example so may be some space issues with copying the full validate set. Should also be able to symlink it (something like `!mkdir /tmp/lyft && ln -s {eval_data} /tmp/lyft/validate` and then point `create-chopped_dataset` to /tmp/lyft/validate).",
          "votes": 1
        },
        {
          "id": 994244,
          "postDate": "2020-09-01T13:36:46.330Z",
          "content": "<p>I don’t think this solution works. Or maybe I am just missing something. Thanks for the info though! </p>",
          "rawMarkdown": "I don’t think this solution works. Or maybe I am just missing something. Thanks for the info though! "
        },
        {
          "id": 994522,
          "postDate": "2020-09-01T16:54:50.633Z",
          "content": "<p>Both ways (copy and symlink) seem to work fine for me (creates and loads and I've evaluated with one, just on sample as noted). As shown <a href=\"https://www.kaggle.com/thomasbrandon/l5kit-chopped-dataset\" target=\"_blank\">here</a>.</p>",
          "rawMarkdown": "Both ways (copy and symlink) seem to work fine for me (creates and loads and I've evaluated with one, just on sample as noted). As shown [here](https://www.kaggle.com/thomasbrandon/l5kit-chopped-dataset).",
          "votes": 1
        },
        {
          "id": 994527,
          "postDate": "2020-09-01T17:04:51.230Z",
          "content": "<p><a href=\"https://www.kaggle.com/thomasbrandon\" target=\"_blank\">@thomasbrandon</a> you are really kind for creating notebook. Thanks for that. I did manage to do this not so sophisticated like you showed. so I give you that.  Question is can we do for validate.zarr? scene.zarr occupies more than 500 MB of HDD on kernel. The max HDD limit is 4 GB something. I tried it once and it said cant copy because limit exceeded. Am I still missing something? I will also post this comment on the  notebook for others.   </p>",
          "rawMarkdown": "@thomasbrandon you are really kind for creating notebook. Thanks for that. I did manage to do this not so sophisticated like you showed. so I give you that.  Question is can we do for validate.zarr? scene.zarr occupies more than 500 MB of HDD on kernel. The max HDD limit is 4 GB something. I tried it once and it said cant copy because limit exceeded. Am I still missing something? I will also post this comment on the  notebook for others.   "
        },
        {
          "id": 995414,
          "postDate": "2020-09-02T12:26:02.590Z",
          "content": "<p>I think it should just fit. The chopped_100_validate dataset I have is 3.5Gb (the whole validate is 8.5G). So think that will fit within the limits for kernel outputs. You would need to symlink as won't fit both the full validate and the chopped (I gather your error was trying to copy the whole validate, the symlink method won't use any space for the original data).</p>",
          "rawMarkdown": "I think it should just fit. The chopped_100_validate dataset I have is 3.5Gb (the whole validate is 8.5G). So think that will fit within the limits for kernel outputs. You would need to symlink as won't fit both the full validate and the chopped (I gather your error was trying to copy the whole validate, the symlink method won't use any space for the original data).",
          "votes": 1
        }
      ]
    },
    {
      "id": 988355,
      "postDate": "2020-08-28T01:58:12.303Z",
      "content": "<p>Here is the trick I used to fix it.</p>\n<p>The reason this does not work is windows have no multiprocessing option. ;-(</p>\n<p>Comment out these lines in the source code of the library</p>\n<ol>\n<li><code>multiprocessing.set_start_method(\"fork\", force=True) # this fix loop in python 3.8 on MacOS</code></li>\n<li><code>os.environ[\"BLOSC_NOLOCK\"] = \"1\" # this is required for multiprocessing</code></li>\n</ol>\n<p>Upvote if it helped, comment if not I will try my best to solve it.</p>",
      "rawMarkdown": "Here is the trick I used to fix it.\n\nThe reason this does not work is windows have no multiprocessing option. ;-(\n\nComment out these lines in the source code of the library\n\n21. `multiprocessing.set_start_method(\"fork\", force=True) # this fix loop in python 3.8 on MacOS`\n22. `os.environ[\"BLOSC_NOLOCK\"] = \"1\" # this is required for multiprocessing`\n\nUpvote if it helped, comment if not I will try my best to solve it.",
      "votes": 4
    },
    {
      "id": 988266,
      "postDate": "2020-08-27T23:48:04.833Z",
      "content": "<p><a href=\"https://www.kaggle.com/senkin13\" target=\"_blank\">@senkin13</a> ,</p>\n<p>note that the package developer mentioned that issue <a href=\"https://github.com/lyft/l5kit/issues/123#issuecomment-680825552\" target=\"_blank\">here</a>.</p>",
      "rawMarkdown": "@senkin13 ,\n\nnote that the package developer mentioned that issue [here](https://github.com/lyft/l5kit/issues/123#issuecomment-680825552).",
      "votes": 1
    },
    {
      "id": 988011,
      "postDate": "2020-08-27T17:38:14.087Z",
      "content": "<p>It works if you set num_workers to zero in the DataLoader. It's not ideal, but it might be a way to save a chunked dataset without installing Linux.</p>",
      "rawMarkdown": "It works if you set num_workers to zero in the DataLoader. It's not ideal, but it might be a way to save a chunked dataset without installing Linux.",
      "votes": 2
    },
    {
      "id": 993012,
      "postDate": "2020-08-31T15:32:07.757Z",
      "content": "<p>On windows I created an Anaconda environment and installed Pytorch 1.5.0 and Torchvison first. I then 'pip' installed l5kit and it seemed to work but was getting <strong>cannot find contact for 'fork'</strong>. </p>\n<p>I then commented out only this  line in the source code of the library<br>\n<code>multiprocessing.set_start_method(\"fork\", force=True) # this fix loop in python 3.8 on MacOS</code> </p>\n<p>This seems to be working fine without changing <code>num_workers=0</code></p>",
      "rawMarkdown": "On windows I created an Anaconda environment and installed Pytorch 1.5.0 and Torchvison first. I then 'pip' installed l5kit and it seemed to work but was getting **cannot find contact for 'fork'**. \n\nI then commented out only this  line in the source code of the library\n`multiprocessing.set_start_method(\"fork\", force=True) # this fix loop in python 3.8 on MacOS` \n\nThis seems to be working fine without changing `num_workers=0`",
      "replies": [
        {
          "id": 994164,
          "postDate": "2020-09-01T12:40:06.367Z",
          "content": "<p>May I ask you your Python version ?<br>\nI cannot work without <code>num_workers=0</code>. My version is Python3.8, torch 1.5.1+cu101 and torchvision 0.6.1+cu101.</p>",
          "rawMarkdown": "May I ask you your Python version ?\nI cannot work without `num_workers=0`. My version is Python3.8, torch 1.5.1+cu101 and torchvision 0.6.1+cu101.",
          "votes": 1,
          "replies": [
            {
              "id": 3204974,
              "postDate": "2025-05-19T05:54:30.330Z",
              "rawMarkdown": "",
              "isDeleted": true
            }
          ]
        }
      ]
    },
    {
      "id": 992536,
      "postDate": "2020-08-31T08:08:41.517Z",
      "content": "<p>To run l5kit on windows 10:</p>\n<p>If you get multiprocessing error while importing <br>\nComment out multiprocessing line</p>\n<p>Set cfg['val_data_loader']['num_workers']=0</p>\n<p>That's it rest will work with cuda if you have pytorch cuda installed</p>\n<p>For conda users<br>\nIn a empty env…<br>\n1) conda install pytorch==1.5.0 torchvision==0.6.0 cudatoolkit=10.2 -c pytorch<br>\n2) pip install l5kit </p>",
      "rawMarkdown": "To run l5kit on windows 10:\n\nIf you get multiprocessing error while importing \nComment out multiprocessing line\n\nSet cfg['val_data_loader']['num_workers']=0\n\nThat's it rest will work with cuda if you have pytorch cuda installed\n\nFor conda users\nIn a empty env...\n1) conda install pytorch==1.5.0 torchvision==0.6.0 cudatoolkit=10.2 -c pytorch\n2) pip install l5kit \n \n\n",
      "replies": [
        {
          "id": 999820,
          "postDate": "2020-09-06T04:01:56.943Z",
          "content": "<p><a href=\"https://www.kaggle.com/preethamrakshithp\" target=\"_blank\">@preethamrakshithp</a>   Fixed it</p>",
          "rawMarkdown": "@preethamrakshithp  ~~I am running same version and have set num workers to 0. But I still have the error. The same described > https://github.com/lyft/l5kit/issues/130 here. Did you guys end up finding solution?~~ Fixed it",
          "votes": 1
        }
      ]
    },
    {
      "id": 987630,
      "postDate": "2020-08-27T12:12:26.547Z",
      "content": "<p>same error</p>",
      "rawMarkdown": "same error",
      "replies": [
        {
          "id": 987759,
          "postDate": "2020-08-27T13:49:30.743Z",
          "content": "<p>I think it's not easy to use l5kit with windows,let's change our os to linux :)</p>",
          "rawMarkdown": "I think it's not easy to use l5kit with windows,let's change our os to linux :)",
          "votes": 2
        },
        {
          "id": 989510,
          "postDate": "2020-08-28T21:29:57.153Z",
          "content": "<p>Errors even on Mac. Not same but kernel crashes.</p>",
          "rawMarkdown": "Errors even on Mac. Not same but kernel crashes."
        }
      ]
    },
    {
      "id": 987088,
      "postDate": "2020-08-27T02:04:49.717Z",
      "content": "<p>is it possible to save AgentDataset to other data format with kaggle notebook then download to local?</p>",
      "rawMarkdown": "is it possible to save AgentDataset to other data format with kaggle notebook then download to local?",
      "replies": [
        {
          "id": 1001881,
          "postDate": "2020-09-07T16:37:34.423Z",
          "content": "<p>you can check this out for that. <a href=\"https://www.kaggle.com/kneroma/zarr-files-and-l5kit-data-for-dummies\" target=\"_blank\">https://www.kaggle.com/kneroma/zarr-files-and-l5kit-data-for-dummies</a><br>\nBTW how are you storing 22 GB data locally? I dont have that much space is there any other way?</p>",
          "rawMarkdown": "you can check this out for that. https://www.kaggle.com/kneroma/zarr-files-and-l5kit-data-for-dummies\nBTW how are you storing 22 GB data locally? I dont have that much space is there any other way?",
          "votes": 3
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 987852,
      "author_name": "Thomas Brandon",
      "author_url": "",
      "post_date": "2020-08-27T15:16:49.767000",
      "content": "<p>The fork multiprocessing method is not supported in Windows (discussed a little <a href=\"https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods\" target=\"_blank\">here</a>.<br>\nIt looks like the main use of this function is for creating a chopped validation dataset. So you may be able to just create the chopped dataset in linux but otherwise use windows. Though you may need to modify the sample code to directly use a pre-chopped validation dataset as I believe it will try to recreate it even if it exists (<code>create_chopped_dataset</code> will create a folder called <code>sample_chopped_100</code> when you run it on the sample dataset, just use this as the key for <code>dm.requires</code> and load it as in the example, adding the mask and ground truth csv stuff).</p>\n<p>You could use Kaggle to run <code>create_chopped_dataset</code> and then download that. Or you could set up WSL (Windows Subsystem for Linux) which lets you run a linux environment on windows easily. WSL2 has recently been released which has full linux support (some issues with WSL1 but may be fine for l5kit). This lets you run linux programs and input/output from your windows files. So would work well here.  No GPU access but that is actually coming, available in latest windows insider builds so when released (hopefully next year) you'll be able to run the fuil Linux PyTorch/TF on Windows with CUDA. So worth learning as a programmer who uses windows.</p>",
      "votes": 3,
      "replies": [
        {
          "id": 987873,
          "author_name": "senkin13",
          "author_url": "",
          "post_date": "2020-08-27T15:29:29.713000",
          "content": "<p>Thank you so much for your detailed explanation.I am using WSL now,it worked well.👍</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 992120,
          "author_name": "Todd Chaney",
          "author_url": "",
          "post_date": "2020-08-31T00:45:47.567000",
          "content": "<p>Can I ask how did you pip3 install l5kit for that WSL because the regular -r requirements.txt exits with code 1.  Telling me that directory site-packages doesn't exist in home/usr/../python3.8/ and it doesn't have permissions.  Which is true but most are getting installed into home//.local/…./python3.8/site-packages.  So I tried changing --target=that directory.  But then it exits with code 1, and says error: option --home not recognized.  The entire error is a bit long.  </p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 992683,
          "author_name": "Thomas Brandon",
          "author_url": "",
          "post_date": "2020-08-31T10:51:07.927000",
          "content": "<p>You use <code>pip3 install --user l5kit</code> to install to .local. Or you can use <code>sudo pip3 install l5kit</code> to install system-wide (<code>sudo</code> is super-user do which is basically run as administrator for linux). But installing things system-wide outside of the system package manager is not considered good practice.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 992903,
          "author_name": "Todd Chaney",
          "author_url": "",
          "post_date": "2020-08-31T14:05:06.773000",
          "content": "<p>Thanks --user worked perfectly. </p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 993498,
          "author_name": "The Brown Iceman",
          "author_url": "",
          "post_date": "2020-09-01T01:24:25.540000",
          "content": "<p><a href=\"https://www.kaggle.com/thomasbrandon\" target=\"_blank\">@thomasbrandon</a> are you sure it is possible to create chopped_data_100 from kaggle kernel?  because 'chop_dataset function' is calling 'zarr_scenes_chop'. And It tries to write in input directory but input directory is read only. So we have to find work around in kaggle kernel right?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 993824,
          "author_name": "Thomas Brandon",
          "author_url": "",
          "post_date": "2020-09-01T06:59:38.067000",
          "content": "<p>Yeah, parent of location needs to be writeable as it doesn't let you set output location. I copied it into /tmp. I've only done that with the sample set running the Lyft example so may be some space issues with copying the full validate set. Should also be able to symlink it (something like <code>!mkdir /tmp/lyft &amp;&amp; ln -s {eval_data} /tmp/lyft/validate</code> and then point <code>create-chopped_dataset</code> to /tmp/lyft/validate).</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 994244,
          "author_name": "The Brown Iceman",
          "author_url": "",
          "post_date": "2020-09-01T13:36:46.330000",
          "content": "<p>I don’t think this solution works. Or maybe I am just missing something. Thanks for the info though! </p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 994522,
          "author_name": "Thomas Brandon",
          "author_url": "",
          "post_date": "2020-09-01T16:54:50.633000",
          "content": "<p>Both ways (copy and symlink) seem to work fine for me (creates and loads and I've evaluated with one, just on sample as noted). As shown <a href=\"https://www.kaggle.com/thomasbrandon/l5kit-chopped-dataset\" target=\"_blank\">here</a>.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 994527,
          "author_name": "The Brown Iceman",
          "author_url": "",
          "post_date": "2020-09-01T17:04:51.230000",
          "content": "<p><a href=\"https://www.kaggle.com/thomasbrandon\" target=\"_blank\">@thomasbrandon</a> you are really kind for creating notebook. Thanks for that. I did manage to do this not so sophisticated like you showed. so I give you that.  Question is can we do for validate.zarr? scene.zarr occupies more than 500 MB of HDD on kernel. The max HDD limit is 4 GB something. I tried it once and it said cant copy because limit exceeded. Am I still missing something? I will also post this comment on the  notebook for others.   </p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 995414,
          "author_name": "Thomas Brandon",
          "author_url": "",
          "post_date": "2020-09-02T12:26:02.590000",
          "content": "<p>I think it should just fit. The chopped_100_validate dataset I have is 3.5Gb (the whole validate is 8.5G). So think that will fit within the limits for kernel outputs. You would need to symlink as won't fit both the full validate and the chopped (I gather your error was trying to copy the whole validate, the symlink method won't use any space for the original data).</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 988355,
      "author_name": "Harshit Sheoran",
      "author_url": "",
      "post_date": "2020-08-28T01:58:12.303000",
      "content": "<p>Here is the trick I used to fix it.</p>\n<p>The reason this does not work is windows have no multiprocessing option. ;-(</p>\n<p>Comment out these lines in the source code of the library</p>\n<ol>\n<li><code>multiprocessing.set_start_method(\"fork\", force=True) # this fix loop in python 3.8 on MacOS</code></li>\n<li><code>os.environ[\"BLOSC_NOLOCK\"] = \"1\" # this is required for multiprocessing</code></li>\n</ol>\n<p>Upvote if it helped, comment if not I will try my best to solve it.</p>",
      "votes": 4,
      "replies": []
    },
    {
      "id": 988266,
      "author_name": "nosound",
      "author_url": "",
      "post_date": "2020-08-27T23:48:04.833000",
      "content": "<p><a href=\"https://www.kaggle.com/senkin13\" target=\"_blank\">@senkin13</a> ,</p>\n<p>note that the package developer mentioned that issue <a href=\"https://github.com/lyft/l5kit/issues/123#issuecomment-680825552\" target=\"_blank\">here</a>.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 988011,
      "author_name": "Brian Smith",
      "author_url": "",
      "post_date": "2020-08-27T17:38:14.087000",
      "content": "<p>It works if you set num_workers to zero in the DataLoader. It's not ideal, but it might be a way to save a chunked dataset without installing Linux.</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 993012,
      "author_name": "Srinivas Gopal Krishna",
      "author_url": "",
      "post_date": "2020-08-31T15:32:07.757000",
      "content": "<p>On windows I created an Anaconda environment and installed Pytorch 1.5.0 and Torchvison first. I then 'pip' installed l5kit and it seemed to work but was getting <strong>cannot find contact for 'fork'</strong>. </p>\n<p>I then commented out only this  line in the source code of the library<br>\n<code>multiprocessing.set_start_method(\"fork\", force=True) # this fix loop in python 3.8 on MacOS</code> </p>\n<p>This seems to be working fine without changing <code>num_workers=0</code></p>",
      "votes": 0,
      "replies": [
        {
          "id": 994164,
          "author_name": "DONJYARAHOI",
          "author_url": "",
          "post_date": "2020-09-01T12:40:06.367000",
          "content": "<p>May I ask you your Python version ?<br>\nI cannot work without <code>num_workers=0</code>. My version is Python3.8, torch 1.5.1+cu101 and torchvision 0.6.1+cu101.</p>",
          "votes": 1,
          "replies": [
            {
              "id": 3204974,
              "author_name": "",
              "author_url": "",
              "post_date": "2025-05-19T05:54:30.330000",
              "content": "",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 992536,
      "author_name": "th-blitz",
      "author_url": "",
      "post_date": "2020-08-31T08:08:41.517000",
      "content": "<p>To run l5kit on windows 10:</p>\n<p>If you get multiprocessing error while importing <br>\nComment out multiprocessing line</p>\n<p>Set cfg['val_data_loader']['num_workers']=0</p>\n<p>That's it rest will work with cuda if you have pytorch cuda installed</p>\n<p>For conda users<br>\nIn a empty env…<br>\n1) conda install pytorch==1.5.0 torchvision==0.6.0 cudatoolkit=10.2 -c pytorch<br>\n2) pip install l5kit </p>",
      "votes": 0,
      "replies": [
        {
          "id": 999820,
          "author_name": "The Brown Iceman",
          "author_url": "",
          "post_date": "2020-09-06T04:01:56.943000",
          "content": "<p><a href=\"https://www.kaggle.com/preethamrakshithp\" target=\"_blank\">@preethamrakshithp</a>   Fixed it</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 987630,
      "author_name": "th-blitz",
      "author_url": "",
      "post_date": "2020-08-27T12:12:26.547000",
      "content": "<p>same error</p>",
      "votes": 0,
      "replies": [
        {
          "id": 987759,
          "author_name": "senkin13",
          "author_url": "",
          "post_date": "2020-08-27T13:49:30.743000",
          "content": "<p>I think it's not easy to use l5kit with windows,let's change our os to linux :)</p>",
          "votes": 2,
          "replies": []
        },
        {
          "id": 989510,
          "author_name": "Srinivas Gopal Krishna",
          "author_url": "",
          "post_date": "2020-08-28T21:29:57.153000",
          "content": "<p>Errors even on Mac. Not same but kernel crashes.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 987088,
      "author_name": "senkin13",
      "author_url": "",
      "post_date": "2020-08-27T02:04:49.717000",
      "content": "<p>is it possible to save AgentDataset to other data format with kaggle notebook then download to local?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 1001881,
          "author_name": "SujaydKhandekar",
          "author_url": "",
          "post_date": "2020-09-07T16:37:34.423000",
          "content": "<p>you can check this out for that. <a href=\"https://www.kaggle.com/kneroma/zarr-files-and-l5kit-data-for-dummies\" target=\"_blank\">https://www.kaggle.com/kneroma/zarr-files-and-l5kit-data-for-dummies</a><br>\nBTW how are you storing 22 GB data locally? I dont have that much space is there any other way?</p>",
          "votes": 3,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "987083": "`---------------------------------------------------------------------------\nValueError                                Traceback (most recent call last)\n<ipython-input-2-dcf842653d34> in <module>\n     10 \n     11 from l5kit.data import LocalDataManager, ChunkedDataset\n**---> 12 from l5kit.dataset import AgentDataset, EgoDataset**\n     13 from l5kit.rasterization import build_rasterizer\n\n~\\Anaconda3\\lib\\site-packages\\l5kit\\dataset\\__init__.py in <module>\n**----> 1 from .agent import AgentDataset**\n      2 from .ego import EgoDataset\n      3 from .select_agents import select_agents\n      4 \n      5 __all__ = [\"EgoDataset\", \"AgentDataset\", \"select_agents\"]\n\n~\\Anaconda3\\lib\\site-packages\\l5kit\\dataset\\agent.py in <module>\n     10 from ..rasterization import Rasterizer\n     11 from .ego import EgoDataset\n**---> 12 from .select_agents import TH_DISTANCE_AV, TH_EXTENT_RATIO, TH_YAW_DEGREE, select_agents**\n     13 \n     14 # WARNING: changing these values impact the number of instances selected for both train and inference!\n\n~\\Anaconda3\\lib\\site-packages\\l5kit\\dataset\\select_agents.py in <module>\n     19 from l5kit.data.filter import _get_label_filter  # TODO expose this without digging\n     20 \n**---> 21 multiprocessing.set_start_method(\"fork\", force=True)  # this fix loop in python 3.8 on MacOS**\n     22 os.environ[\"BLOSC_NOLOCK\"] = \"1\"  # this is required for multiprocessing\n     23 \n\n~\\Anaconda3\\lib\\multiprocessing\\context.py in set_start_method(self, method, force)\n    244             self._actual_context = None\n    245             return\n--> 246         self._actual_context = self.get_context(method)\n    247 \n    248     def get_start_method(self, allow_none=False):\n\n~\\Anaconda3\\lib\\multiprocessing\\context.py in get_context(self, method)\n    236             return self._actual_context\n    237         else:\n--> 238             return super().get_context(method)\n    239 \n    240     def set_start_method(self, method, force=False):\n\n~\\Anaconda3\\lib\\multiprocessing\\context.py in get_context(self, method)\n    190             ctx = _concrete_contexts[method]\n    191         except KeyError:\n--> 192             raise ValueError('cannot find context for %r' % method) from None\n    193         ctx._check_available()\n    194         return ctx\n\n**ValueError: cannot find context for 'fork'**`",
    "987852": "The fork multiprocessing method is not supported in Windows (discussed a little [here](https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods).\nIt looks like the main use of this function is for creating a chopped validation dataset. So you may be able to just create the chopped dataset in linux but otherwise use windows. Though you may need to modify the sample code to directly use a pre-chopped validation dataset as I believe it will try to recreate it even if it exists (`create_chopped_dataset` will create a folder called `sample_chopped_100` when you run it on the sample dataset, just use this as the key for `dm.requires` and load it as in the example, adding the mask and ground truth csv stuff).\n\nYou could use Kaggle to run `create_chopped_dataset` and then download that. Or you could set up WSL (Windows Subsystem for Linux) which lets you run a linux environment on windows easily. WSL2 has recently been released which has full linux support (some issues with WSL1 but may be fine for l5kit). This lets you run linux programs and input/output from your windows files. So would work well here.  No GPU access but that is actually coming, available in latest windows insider builds so when released (hopefully next year) you'll be able to run the fuil Linux PyTorch/TF on Windows with CUDA. So worth learning as a programmer who uses windows.",
    "988355": "Here is the trick I used to fix it.\n\nThe reason this does not work is windows have no multiprocessing option. ;-(\n\nComment out these lines in the source code of the library\n\n21. `multiprocessing.set_start_method(\"fork\", force=True) # this fix loop in python 3.8 on MacOS`\n22. `os.environ[\"BLOSC_NOLOCK\"] = \"1\" # this is required for multiprocessing`\n\nUpvote if it helped, comment if not I will try my best to solve it.",
    "988266": "@senkin13 ,\n\nnote that the package developer mentioned that issue [here](https://github.com/lyft/l5kit/issues/123#issuecomment-680825552).",
    "988011": "It works if you set num_workers to zero in the DataLoader. It's not ideal, but it might be a way to save a chunked dataset without installing Linux.",
    "993012": "On windows I created an Anaconda environment and installed Pytorch 1.5.0 and Torchvison first. I then 'pip' installed l5kit and it seemed to work but was getting **cannot find contact for 'fork'**. \n\nI then commented out only this  line in the source code of the library\n`multiprocessing.set_start_method(\"fork\", force=True) # this fix loop in python 3.8 on MacOS` \n\nThis seems to be working fine without changing `num_workers=0`",
    "992536": "To run l5kit on windows 10:\n\nIf you get multiprocessing error while importing \nComment out multiprocessing line\n\nSet cfg['val_data_loader']['num_workers']=0\n\nThat's it rest will work with cuda if you have pytorch cuda installed\n\nFor conda users\nIn a empty env...\n1) conda install pytorch==1.5.0 torchvision==0.6.0 cudatoolkit=10.2 -c pytorch\n2) pip install l5kit \n \n\n",
    "987630": "same error",
    "987088": "is it possible to save AgentDataset to other data format with kaggle notebook then download to local?"
  }
}