{"action":"opened","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6258","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6258/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6258/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/6258/events","html_url":"https://github.com/scikit-learn/scikit-learn/issues/6258","id":130223701,"number":6258,"title":"LatentDirichletAllocation.fit() gives joblib error when evaluate_every is not None.","user":{"login":"groceryheist","id":113311,"avatar_url":"https://avatars.githubusercontent.com/u/113311?v=3","gravatar_id":"","url":"https://api.github.com/users/groceryheist","html_url":"https://github.com/groceryheist","followers_url":"https://api.github.com/users/groceryheist/followers","following_url":"https://api.github.com/users/groceryheist/following{/other_user}","gists_url":"https://api.github.com/users/groceryheist/gists{/gist_id}","starred_url":"https://api.github.com/users/groceryheist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/groceryheist/subscriptions","organizations_url":"https://api.github.com/users/groceryheist/orgs","repos_url":"https://api.github.com/users/groceryheist/repos","events_url":"https://api.github.com/users/groceryheist/events{/privacy}","received_events_url":"https://api.github.com/users/groceryheist/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-01T01:14:24Z","updated_at":"2016-02-01T01:14:24Z","closed_at":null,"body":"\r\nhow to reproduce: \r\n\r\n```\r\nfrom sklearn.feature_extraction.text import CountVectorizer\r\nfrom sklearn.decomposition import LatentDirichletAllocation\r\n\r\ndocs = [\"help i have a bug yikes\" for i in range(1000)]\r\n\r\nvectorizer = CountVectorizer(input=docs,analyzer='word')\r\nlda_features = vectorizer.fit_transform(docs)\r\n\r\nlda_model = LatentDirichletAllocation(\r\n    n_topics=10,\r\n    learning_method='online',\r\n    evaluate_every=10,\r\n    n_jobs=4,\r\n)\r\nmodel = lda_model.fit(lda_features)\r\n\r\n```\r\n\r\nThe error only occurs when evaluate_every = 0. \r\n\r\nThe error is: \r\n```\r\nTraceback (most recent call last):\r\n  File \"topic_model.py\", line 59, in <module>\r\n    model = lda_model.fit(lda_features)\r\n  File \"/usr/local/lib/python3.4/dist-packages/sklearn/decomposition/online_lda.py\", line 520, in fit\r\n    random_init=False)\r\n  File \"/usr/local/lib/python3.4/dist-packages/sklearn/decomposition/online_lda.py\", line 358, in _e_step\r\n    for idx_slice in gen_even_slices(X.shape[0], n_jobs))\r\n  File \"/usr/local/lib/python3.4/dist-packages/sklearn/externals/joblib/parallel.py\", line 771, in __call__\r\n    n_jobs = self._initialize_pool()\r\n  File \"/usr/local/lib/python3.4/dist-packages/sklearn/externals/joblib/parallel.py\", line 518, in _initialize_pool\r\n    raise ImportError('[joblib] Attempting to do parallel computing '\r\nImportError: [joblib] Attempting to do parallel computing without protecting your import on a system that does not support forking. \r\nTo use parallel-computing in a script, you must protect your main loop using \"if __name__ == '__main__'\". \r\nPlease see the joblib documentation on Parallel for more information\r\n```\r\n\r\nThis is the error that windows users get when they don't run their code in \"if __name__ == \"__main__\": .  However, I am on linux.  \r\nThe error actually indicates that a threadpool is being reinitialized.   I suspect that the issue is that the threadpool is reinitialized after perplexity is evaluated. \r\n\r\n"}}