<div dir="ltr">Hei!<div><br></div><div>Yritän dockerisoida python voikkoa linux containeriin, mutta saan "AttributeError: /usr/lib/x86_64-linux-gnu/libvoikko.so.1: undefined symbol: voikkoGetAttributeValues" -errorin</div><div>(Lopullinen tavoite tehdä aws lambda funktiolle docker container)<br><br></div><div>Olisiko jollakulla toimivaa Linux container esimerkkiä tai neuvoja miten alla olevan containerin saisi toimimaan? :)<br>Virhe liittyy ehkä versionumeroihin? Mutta en ole keksinyt miten ne saisi korjattua</div><div>Tarvitsen vain sanojen perusmuotoistamis ominaisuuden</div><div><br></div><div>app/app.py<br></div><div><span style="color:rgba(0,0,0,0.847);font-family:-apple-system-font;font-size:12px">```</span><br></div><div><div style="color:rgba(0,0,0,0.847);font-family:-apple-system-font;font-size:12px"><span style="font-family:Menlo;font-size:9pt;color:rgb(0,0,128);font-weight:bold">import </span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:9pt">libvoikko</span></div><div style="color:rgba(0,0,0,0.847);font-family:-apple-system-font;font-size:12px"><pre style="white-space:pre-wrap;color:rgb(0,0,0);font-family:Menlo;font-size:9pt"><span style="color:rgb(0,0,128);font-weight:bold">import </span>os<br><br>v = libvoikko.Voikko(<span style="color:rgb(0,128,128);font-weight:bold">u"fi"</span>)<br><br><pre style="white-space:pre-wrap;font-family:Menlo;font-size:9pt"><span style="color:rgb(0,0,128)">print</span>(v.analyze(<span style="color:rgb(102,0,153)">word</span>=<span style="color:rgb(0,128,128);font-weight:bold">"kissoja"</span>))</pre></pre></div><div style="color:rgba(0,0,0,0.847);font-family:-apple-system-font;font-size:12px">```<br><div><br></div><div><span style="color:rgb(34,34,34);font-family:Arial,Helvetica,sans-serif;font-size:small">Dockerfile</span><br></div><div>```</div><div><span style="font-family:Menlo;font-size:9pt;color:rgb(0,0,128);font-weight:bold">FROM </span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:9pt">python:</span><span style="font-family:Menlo;font-size:9pt;color:rgb(0,0,255)">3.7</span><span style="font-family:Menlo;font-size:9pt;color:rgb(0,0,128);font-weight:bold">-</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:9pt">buster</span></div><div><pre style="white-space:pre-wrap;color:rgb(0,0,0);font-family:Menlo;font-size:9pt"><br><span style="color:rgb(128,128,128);font-style:italic"># Installing lambda runtime interface console<br></span><span style="color:rgb(0,0,128);font-weight:bold">RUN </span>pip install awslambdaric<br><br><span style="color:rgb(0,0,128);font-weight:bold">RUN </span>pip install libvoikko<br><br><span style="color:rgb(0,0,128);font-weight:bold">RUN </span>apt-get update \<br>    <span style="color:rgb(0,0,128);font-weight:bold">&& </span>apt-get install <span style="color:rgb(0,0,128);font-weight:bold">-</span>y voikko-fi python-libvoikko<br><br><span style="color:rgb(128,128,128);font-style:italic">##Place the executable file in the container.<br></span><span style="color:rgb(0,0,128);font-weight:bold">ARG </span><span style="color:rgb(102,14,122);font-weight:bold;font-style:italic">APP_DIR</span>=<span style="color:rgb(0,128,0);font-weight:bold">"/home/app/"<br></span><span style="color:rgb(0,0,128);font-weight:bold">WORKDIR </span>${<span style="color:rgb(102,14,122);font-weight:bold;font-style:italic">APP_DIR</span>}<br><span style="color:rgb(0,0,128);font-weight:bold">COPY </span>app ${<span style="color:rgb(102,14,122);font-weight:bold;font-style:italic">APP_DIR</span>}<br><span style="color:rgb(128,128,128);font-style:italic">#<br></span><span style="color:rgb(0,0,128);font-weight:bold">CMD </span>[<span style="color:rgb(0,128,0);font-weight:bold">"python"</span>, <span style="color:rgb(0,128,0);font-weight:bold">"app.py" </span>]</pre></div><div>```<br></div></div></div><div><br></div><div>Buildaan & ajan containerin:<br>$docker build -t lambda .<br><br>Niin ajaessa tulee seuraava virhe:<br>$ docker run lambda<br>Traceback (most recent call last):<br>  File "app.py", line 7, in <module><br>    v = libvoikko.Voikko(u"fi")<br>  File "/usr/local/lib/python3.7/site-packages/libvoikko.py", line 436, in __init__<br>    self.__lib = self.__getLib()<br>  File "/usr/local/lib/python3.7/site-packages/libvoikko.py", line 422, in __getLib<br>    return VoikkoLibrary.open(path=cls._sharedLibrarySearchPath)<br>  File "/usr/local/lib/python3.7/site-packages/libvoikko.py", line 302, in open<br>    return cls(fileName)<br>  File "/usr/local/lib/python3.7/site-packages/libvoikko.py", line 404, in __init__<br>    self.voikkoGetAttributeValues.argtypes = [c_void_p, c_char_p]<br>  File "/usr/local/lib/python3.7/ctypes/__init__.py", line 377, in __getattr__<br>    func = self.__getitem__(name)<br>  File "/usr/local/lib/python3.7/ctypes/__init__.py", line 382, in __getitem__<br>    func = self._FuncPtr((name_or_ordinal, self))<br>AttributeError: /usr/lib/x86_64-linux-gnu/libvoikko.so.1: undefined symbol: voikkoGetAttributeValues<br><br></div><div>Kiitos paljon kaikesta avusta,</div><div>E. Nikkari<br><br>(lähetin viestin kahdesti, koska ensimmäisellä kerralla en ollut listalla, pahoittelut jos se tuli kahteen kertaan! :) )</div></div>