Narasimha1997 / smartreply

Unofficial port of Google's smart reply runtime (powers gmail and assistant) model to python, allowing developers to leverage intelligent smart reply as an API in Web and embedded systems that supports Linux, a loader (ld.so), a fully POSIX C++ Runtime and Python interpreter.
MIT License
56 stars 9 forks source link

ImportError: cannot import name 'smartreply' from 'runtime.lib' #3

Closed YatinMahajann closed 3 years ago

YatinMahajann commented 3 years ago

Is there any file that is missing in runtime/lib named smartreply? The only file available there is named as smartreply.cpython-36m-x86_64-linux-gnu.so

Narasimha1997 commented 3 years ago

@YatinMahajann Hey, can you give me more details. On which OS you are trying to run?

YatinMahajann commented 3 years ago

@Narasimha1997 I am using : Ubuntu 19.04 Os Type : 64-bit It is a x86_64 machine

Narasimha1997 commented 3 years ago

@YatinMahajann Okay, seems fine. Did you try building it from source or using the pre-built .so file that is present already in runtime/lib?

In the latter case, I would recommend you to use the Dockerfile provided in the repo to build the container image and use it.

If you don't want to use it inside the container, can you provide the output of the command :

cd runtime/lib
ldd smartreply...........so
YatinMahajann commented 3 years ago

@Narasimha1997 here is the requested output : linux-vdso.so.1 (0x00007ffc86363000) libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fbc6d70f000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fbc6d5c1000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fbc6d5a0000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fbc6d59a000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fbc6d58f000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fbc6d575000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbc6d388000) /lib64/ld-linux-x86-64.so.2 (0x00007fbc6dca6000)

I am not using it in the container, I am directly trying to run server.py

and here is the exact error :+1: Traceback (most recent call last): File "server.py", line 2, in from runtime import SmartReplyRuntime File "Smart_Reply/smartreply-master/runtime/init.py", line 1, in from runtime.lib import smartreply ImportError: cannot import name 'smartreply' from 'runtime.lib' (unknown location)

Narasimha1997 commented 3 years ago

@YatinMahajann Okay, you can get the complete information about the platform it is supposed to run by reading the smartreply.cpython-36m-x86_64-linux-gnu.so filename.

Here cpython-36m tells you, it requires Python 3.6 x86_64-linux-gnu - Is a host-triple, it has the following format,architecture-os-abi - In this case, x86_64 machine, running Linux and providing GNU (POSIX) ABI. Which is in par with your machine.

So make sure you have right version of python installed.

If atleast anyone of these parameters are different, the .so file will be ignored as a CPython extension, that's why you are getting module not found error.

YatinMahajann commented 3 years ago

@Narasimha1997 I have Python 3.7.4 installed. So the cpython-36m file here is only compatible and can only run with Python 3.6 versions?

Narasimha1997 commented 3 years ago

@YatinMahajann Yes, as of now. So try using a python 3.6 runtime.

Maybe we can write a script that generates wheel for multiple versions. If you're interested in contributing such a script, you can let me know.

Or, you can build the package from source by following the steps provided in the README.md

Narasimha1997 commented 3 years ago

@YatinMahajann Hi, I have created a new repository with much cleaner code base and CMake powered build system with automate release system. You can check the repository here :

py-smartreply

Looking forward for your review and contributions.