{
  "id": 12802,
  "title": "Anyone getting \"parallelizing error\" for scikit learn based models in python?",
  "url": "/competitions/malware-classification/discussion/12802",
  "author_name": "",
  "post_date": "2015-03-13T18:33:52.577Z",
  "votes": 1,
  "comment_count": 6,
  "views": 5078,
  "content": "<p>I am getting the following error:<br><br>Attempting to do parallel computing without protecting your import on a system that does not support forking. To use parallel-computing in a script, you must protect you main loop using &quot;if __name__ == '__main__'&quot;. Please see the joblib documentation on Parallel for more information.</p>\n<p>....I added the if__name== ....part as suggested but the results are only a small subset of all the test labels (approx 200).......</p>\n<p>Can anyone help?</p>\n<p>Thanks a lot!</p>",
  "messages": [
    {
      "id": "66137",
      "postDate": "03/13/2015 18:33:52",
      "content": "<p>I am getting the following error:<br><br>Attempting to do parallel computing without protecting your import on a system that does not support forking. To use parallel-computing in a script, you must protect you main loop using &quot;if __name__ == '__main__'&quot;. Please see the joblib documentation on Parallel for more information.</p>\n<p>....I added the if__name== ....part as suggested but the results are only a small subset of all the test labels (approx 200).......</p>\n<p>Can anyone help?</p>\n<p>Thanks a lot!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "66168",
      "postDate": "03/14/2015 08:20:08",
      "content": "<p>Let me guess... you are using Windows right?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "66182",
      "postDate": "03/14/2015 14:13:24",
      "content": "<p>[quote=NxGTR;66168]</p>\n<p>Let me guess... you are using Windows right?</p>\n<p>[/quote]</p>\n<p>Yes....*sigh*</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "66186",
      "postDate": "03/14/2015 15:32:04",
      "content": "<p>I bought a cheap SSD, installed Ubuntu, and have been extremely glad that I did. (I boot from whichever drive&nbsp;for the operating system I want).</p>\n<p>Of course, there's overhead and other issues going to Linux, but you avoid all sorts of other headaches.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "66187",
      "postDate": "03/14/2015 15:54:05",
      "content": "<p>That parallelizing error is when you put your code outside of a main loop. Wrapping your code inside:</p>\n<p>imports</p>\n<p>def code():</p>\n<p>if __name__ == '__main__':</p>\n<p>&nbsp;code()</p>\n<p>should solve that (and I think you solved that already).</p>\n<p>&gt; the results are only a small subset of all the test labels (approx 200)</p>\n<p>That's a new problem, which requires its own question (with clarifying code). Seems unrelated to parallelizing, but an inaccuracy in the code somewhere. Let us know.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "66193",
      "postDate": "03/14/2015 17:22:18",
      "content": "<p>I second <em>@inversion</em> comment, in the past I have run in a lots of weird errors with Windows&nbsp;that I do not use it anymore for this kind of stuff.</p>\n<p>Take a look here:&nbsp;https://pythonhosted.org/joblib/parallel.html</p>\n<p>Microsoft reading this post? I think MS Windows is the best OS ever.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "66933",
      "postDate": "03/18/2015 10:30:57",
      "content": "<p>Thanks &nbsp;guys....don't currently have the time to invest in learning and setting up linux.....so I just transferred to R and things are good so far.....</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 66168,
      "author_name": "carloshuertas",
      "author_url": "",
      "post_date": "03/14/2015 08:20:08",
      "content": "<p>Let me guess... you are using Windows right?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 66182,
      "author_name": "udatta",
      "author_url": "",
      "post_date": "03/14/2015 14:13:24",
      "content": "<p>[quote=NxGTR;66168]</p>\n<p>Let me guess... you are using Windows right?</p>\n<p>[/quote]</p>\n<p>Yes....*sigh*</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 66186,
      "author_name": "inversion",
      "author_url": "",
      "post_date": "03/14/2015 15:32:04",
      "content": "<p>I bought a cheap SSD, installed Ubuntu, and have been extremely glad that I did. (I boot from whichever drive&nbsp;for the operating system I want).</p>\n<p>Of course, there's overhead and other issues going to Linux, but you avoid all sorts of other headaches.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 66187,
      "author_name": "triskelion",
      "author_url": "",
      "post_date": "03/14/2015 15:54:05",
      "content": "<p>That parallelizing error is when you put your code outside of a main loop. Wrapping your code inside:</p>\n<p>imports</p>\n<p>def code():</p>\n<p>if __name__ == '__main__':</p>\n<p>&nbsp;code()</p>\n<p>should solve that (and I think you solved that already).</p>\n<p>&gt; the results are only a small subset of all the test labels (approx 200)</p>\n<p>That's a new problem, which requires its own question (with clarifying code). Seems unrelated to parallelizing, but an inaccuracy in the code somewhere. Let us know.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 66193,
      "author_name": "carloshuertas",
      "author_url": "",
      "post_date": "03/14/2015 17:22:18",
      "content": "<p>I second <em>@inversion</em> comment, in the past I have run in a lots of weird errors with Windows&nbsp;that I do not use it anymore for this kind of stuff.</p>\n<p>Take a look here:&nbsp;https://pythonhosted.org/joblib/parallel.html</p>\n<p>Microsoft reading this post? I think MS Windows is the best OS ever.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 66933,
      "author_name": "udatta",
      "author_url": "",
      "post_date": "03/18/2015 10:30:57",
      "content": "<p>Thanks &nbsp;guys....don't currently have the time to invest in learning and setting up linux.....so I just transferred to R and things are good so far.....</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "66137": "",
    "66168": "",
    "66182": "",
    "66186": "",
    "66187": "",
    "66193": "",
    "66933": ""
  },
  "source": "meta"
}