<?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>question [CDSW] Package import error during model deployment in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/CDSW-Package-import-error-during-model-deployment/m-p/365818#M239404</link>
    <description>&lt;P&gt;There is an error during cdsw model deployment where the package of code is not imported.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- CDSW version&lt;BR /&gt;1.9.2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Folder Configuration&lt;BR /&gt;/home/cdsw&lt;BR /&gt;l- ex_package_one&lt;BR /&gt;l&amp;nbsp; &amp;nbsp; l- ex_package_two&lt;BR /&gt;l&amp;nbsp; &amp;nbsp; l-ex_pkg_code.py&lt;BR /&gt;l&lt;BR /&gt;l- predict&lt;BR /&gt;l&amp;nbsp; &amp;nbsp; l- predict.py&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;predict.py is the code used in the model deployment.&lt;BR /&gt;&lt;BR /&gt;- Package import code within predict.py&lt;BR /&gt;....&lt;BR /&gt;from ex_package_one.ex_package_two import ex_pkg_code&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;- Error log&lt;BR /&gt;ModuleNotFoundError: No module named 'ex_package_one'&lt;BR /&gt;&lt;BR /&gt;- Attempt to resolve the error&lt;BR /&gt;I printed it out as os.getcwd() from predict.py and it came out as /cdsw/home.&lt;BR /&gt;&lt;BR /&gt;sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname("__file__"))))&lt;BR /&gt;The path was added using the above code, but the same error occurred.&lt;BR /&gt;&lt;BR /&gt;No package errors will occur if the code is transferred to /home/cdsw/predict.py.&lt;BR /&gt;&lt;BR /&gt;Is there any other way to solve this problem?&lt;BR /&gt;Thank you for any help.&lt;!--  /data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_230310_161032_931.sdocx  --&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Mar 2023 07:13:43 GMT</pubDate>
    <dc:creator>Hyeonseo</dc:creator>
    <dc:date>2023-03-10T07:13:43Z</dc:date>
    <item>
      <title>[CDSW] Package import error during model deployment</title>
      <link>https://community.cloudera.com/t5/Support-Questions/CDSW-Package-import-error-during-model-deployment/m-p/365818#M239404</link>
      <description>&lt;P&gt;There is an error during cdsw model deployment where the package of code is not imported.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- CDSW version&lt;BR /&gt;1.9.2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Folder Configuration&lt;BR /&gt;/home/cdsw&lt;BR /&gt;l- ex_package_one&lt;BR /&gt;l&amp;nbsp; &amp;nbsp; l- ex_package_two&lt;BR /&gt;l&amp;nbsp; &amp;nbsp; l-ex_pkg_code.py&lt;BR /&gt;l&lt;BR /&gt;l- predict&lt;BR /&gt;l&amp;nbsp; &amp;nbsp; l- predict.py&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;predict.py is the code used in the model deployment.&lt;BR /&gt;&lt;BR /&gt;- Package import code within predict.py&lt;BR /&gt;....&lt;BR /&gt;from ex_package_one.ex_package_two import ex_pkg_code&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;- Error log&lt;BR /&gt;ModuleNotFoundError: No module named 'ex_package_one'&lt;BR /&gt;&lt;BR /&gt;- Attempt to resolve the error&lt;BR /&gt;I printed it out as os.getcwd() from predict.py and it came out as /cdsw/home.&lt;BR /&gt;&lt;BR /&gt;sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname("__file__"))))&lt;BR /&gt;The path was added using the above code, but the same error occurred.&lt;BR /&gt;&lt;BR /&gt;No package errors will occur if the code is transferred to /home/cdsw/predict.py.&lt;BR /&gt;&lt;BR /&gt;Is there any other way to solve this problem?&lt;BR /&gt;Thank you for any help.&lt;!--  /data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_230310_161032_931.sdocx  --&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 07:13:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/CDSW-Package-import-error-during-model-deployment/m-p/365818#M239404</guid>
      <dc:creator>Hyeonseo</dc:creator>
      <dc:date>2023-03-10T07:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: [CDSW] Package import error during model deployment</title>
      <link>https://community.cloudera.com/t5/Support-Questions/CDSW-Package-import-error-during-model-deployment/m-p/365827#M239411</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/103920"&gt;@Hyeonseo&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;If we print package locations from predict.py respectively:&lt;/P&gt;&lt;PRE&gt;python -c 'import site; print(site.getsitepackages())'&lt;/PRE&gt;&lt;P&gt;do you find the result is different?&lt;/P&gt;&lt;P&gt;If we add all the package locations is there still such issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 08:55:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/CDSW-Package-import-error-during-model-deployment/m-p/365827#M239411</guid>
      <dc:creator>ywu</dc:creator>
      <dc:date>2023-03-10T08:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: [CDSW] Package import error during model deployment</title>
      <link>https://community.cloudera.com/t5/Support-Questions/CDSW-Package-import-error-during-model-deployment/m-p/365835#M239417</link>
      <description>&lt;P&gt;I tried with&amp;nbsp;sys.path.append("/home/cdsw") and it worked.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 10:12:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/CDSW-Package-import-error-during-model-deployment/m-p/365835#M239417</guid>
      <dc:creator>ZsoltH</dc:creator>
      <dc:date>2023-03-10T10:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: [CDSW] Package import error during model deployment</title>
      <link>https://community.cloudera.com/t5/Support-Questions/CDSW-Package-import-error-during-model-deployment/m-p/365860#M239425</link>
      <description>&lt;P&gt;Otherwise the issue is that ipython does not always define __file__ , it is empty in a model.&lt;/P&gt;&lt;P&gt;(Also __file__ should be referred without quotes ",&amp;nbsp;&lt;SPAN class="s1"&gt;os.path.dirname(__file__) )&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Mar 2023 13:01:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/CDSW-Package-import-error-during-model-deployment/m-p/365860#M239425</guid>
      <dc:creator>ZsoltH</dc:creator>
      <dc:date>2023-03-10T13:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: [CDSW] Package import error during model deployment</title>
      <link>https://community.cloudera.com/t5/Support-Questions/CDSW-Package-import-error-during-model-deployment/m-p/365933#M239446</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The package locations all appeared to be the same.&lt;BR /&gt;&lt;/SPAN&gt;(/usr/local/lib/python3.6/site-packages)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Writing code to add the "/home/cdsw/" path resolved the issue.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for suggesting a solution!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 05:05:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/CDSW-Package-import-error-during-model-deployment/m-p/365933#M239446</guid>
      <dc:creator>Hyeonseo</dc:creator>
      <dc:date>2023-03-13T05:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: [CDSW] Package import error during model deployment</title>
      <link>https://community.cloudera.com/t5/Support-Questions/CDSW-Package-import-error-during-model-deployment/m-p/365934#M239447</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I wrote a code to add the "/home/cdsw/" path, and the problem has been solved.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your help!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 05:09:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/CDSW-Package-import-error-during-model-deployment/m-p/365934#M239447</guid>
      <dc:creator>Hyeonseo</dc:creator>
      <dc:date>2023-03-13T05:09:50Z</dc:date>
    </item>
  </channel>
</rss>

