<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Solution for - &amp;quot;PythonException: 'ModuleNotFoundError: No module named 'spacy' in Machine Learning</title>
    <link>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12074#M612</link>
    <description>&lt;P&gt;@Aditya Singh​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you try installing it like &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%pip install spacy&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;instead?  This will be a notebook-scoped library and you can run it in a notebook cell. Hopefully this works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jan 2023 17:34:21 GMT</pubDate>
    <dc:creator>LandanG</dc:creator>
    <dc:date>2023-01-13T17:34:21Z</dc:date>
    <item>
      <title>Solution for - "PythonException: 'ModuleNotFoundError: No module named 'spacy'</title>
      <link>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12071#M609</link>
      <description>&lt;P&gt;I am actually trying to extract the adjective and noun phrases from the text column in spark data frame for which I've written the udf and applying on cleaned text column. However, I am getting this error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from pyspark.sql.functions import udf&lt;/P&gt;&lt;P&gt;from pyspark.sql.types import ArrayType, StringType&lt;/P&gt;&lt;P&gt;import spacy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Load spacy model&lt;/P&gt;&lt;P&gt;nlp = spacy.load("en_core_web_sm")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Define UDF to extract key phrases&lt;/P&gt;&lt;P&gt;def extract_adjective_noun_key_phrases(text):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;doc = nlp(text)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;key_phrases = []&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;for token in doc:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (token.pos_ == "ADJ" and token.nbor().pos_ == "NOUN") or (token.pos_ == "NOUN" and token.nbor().pos_ == "ADJ"):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;key_phrases.append(token.text + " " + token.nbor().text)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;return key_phrases&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;extract_adjective_noun_key_phrases_udf = udf(extract_adjective_noun_key_phrases, ArrayType(StringType()))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Apply UDF to text column in DataFrame&lt;/P&gt;&lt;P&gt;pqms = pqms.withColumn("adjective_noun_key_phrases", extract_adjective_noun_key_phrases_udf(col("cleaned_text")))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Print resulting DataFrame&lt;/P&gt;&lt;P&gt;display(pqms)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expected output here to extract the phrases and create a new column for the same in spark data frame. Any help or suggestion on this will be a great help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 15:13:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12071#M609</guid>
      <dc:creator>Vicky1215</dc:creator>
      <dc:date>2023-01-13T15:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Solution for - "PythonException: 'ModuleNotFoundError: No module named 'spacy'</title>
      <link>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12072#M610</link>
      <description>&lt;P&gt;Hi @Aditya Singh​&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What cluster node types and DBR version are you using? Also are you installing spacy manually? Usually, the ModuleNotFoundError indicates that the library you are importing has not been installed or installed correctly. You could try on DBR 11.3 LTS ML that comes pre-installed with spacy&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 16:59:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12072#M610</guid>
      <dc:creator>LandanG</dc:creator>
      <dc:date>2023-01-13T16:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: Solution for - "PythonException: 'ModuleNotFoundError: No module named 'spacy'</title>
      <link>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12073#M611</link>
      <description>&lt;P&gt;Hi LandanG, Thanks for your quick response. I am using DBR 9.1 LTS (includes Apache Spark 3.1.2, Scala 2.12), not sure what cluster node types means and I am trying to install spacy manually using- import sys&lt;/P&gt;&lt;P&gt;!{sys.executable} -m pip install spacy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any other way we can install spacy as I don't have access to install libraries directly to clusters from pypi or maven repository?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 17:22:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12073#M611</guid>
      <dc:creator>Vicky1215</dc:creator>
      <dc:date>2023-01-13T17:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Solution for - "PythonException: 'ModuleNotFoundError: No module named 'spacy'</title>
      <link>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12074#M612</link>
      <description>&lt;P&gt;@Aditya Singh​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you try installing it like &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;%pip install spacy&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;instead?  This will be a notebook-scoped library and you can run it in a notebook cell. Hopefully this works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 17:34:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12074#M612</guid>
      <dc:creator>LandanG</dc:creator>
      <dc:date>2023-01-13T17:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Solution for - "PythonException: 'ModuleNotFoundError: No module named 'spacy'</title>
      <link>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12075#M613</link>
      <description>&lt;P&gt;Thanks for your suggestion LandanG. Now, I am able to install notebook-scoped spacy library and could see when i run %pip freeze. However, when I am importing it - import spacy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its throwing new error now- ModuleNotFoundError: No module named 'spacy'.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 18:28:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12075#M613</guid>
      <dc:creator>Vicky1215</dc:creator>
      <dc:date>2023-01-13T18:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Solution for - "PythonException: 'ModuleNotFoundError: No module named 'spacy'</title>
      <link>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12076#M614</link>
      <description>&lt;P&gt;@Aditya Singh​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;goto compute click the cluster you needed click the Libraries&amp;nbsp;tab and select&amp;nbsp;PyPI.&lt;/P&gt;&lt;P&gt;Enter a PyPI package name. To install a specific version of a library use this format for the library:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;library&amp;gt;==&amp;lt;version&amp;gt;  For example,&amp;nbsp; spacy==3.4.4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2023 04:50:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12076#M614</guid>
      <dc:creator>sher</dc:creator>
      <dc:date>2023-01-14T04:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Solution for - "PythonException: 'ModuleNotFoundError: No module named 'spacy'</title>
      <link>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12077#M615</link>
      <description>&lt;P&gt;only init script will work here&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2023 07:44:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/machine-learning/solution-for-quot-pythonexception-modulenotfounderror-no-module/m-p/12077#M615</guid>
      <dc:creator>Aviral-Bhardwaj</dc:creator>
      <dc:date>2023-01-14T07:44:04Z</dc:date>
    </item>
  </channel>
</rss>

