orsic / swiftnet

GNU General Public License v3.0
251 stars 54 forks source link

ModuleNotFoundError: No module named 'lib.cylib' #4

Closed nefelipk closed 5 years ago

nefelipk commented 5 years ago

Thank you very much for the source code! I downloaded swiftnet and installed all the requirements. But while trying to evaluate I get the error ModuleNotFoundError: No module named 'lib.cylib' Any ideas on how to solve this? Thanks in advance

orsic commented 5 years ago

@nefelipk thank you for your insight. Inside the lib/ directory run build.sh to create the cython module which is used to compute evaluation metrics(mIoU). Evaluation should work well once successfully building the module.

nefelipk commented 5 years ago

I have already done that.. But I keep getting the same error

orsic commented 5 years ago

@nefelipk did you make sure that lib/cyclib.so is created? Did the cython module compile properly?

zhl001 commented 5 years ago

Thanks for your share! When I run build.sh to create the cyclib.so, I get the error as following: log.txt I used anaconda python3.7 environment,so I change the build.sh as: g++ -shared -pthread -fPIC -fwrapv -O3 -Wall -fno-strict-aliasing \ -I/home/xxx/anaconda3/envs/py37/lib/python3.7/site-packages/numpy/core/include -I/home/xxx/anaconda3/envs/py37/include/python3.7m -o cylib.so cylib.cc

Thank you !!

zhl001 commented 5 years ago

Hi! Solved part of the problem. Now I get the remaining wrong log:

zhouhl@amax-Server:~/swiftnet/lib$ bash ./build.sh In file included from /home/zhouhl/anaconda3/envs/py37/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822:0, from /home/zhouhl/anaconda3/envs/py37/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12, from /home/zhouhl/anaconda3/envs/py37/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4, from cylib.cc:485: /home/zhouhl/anaconda3/envs/py37/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]

warning "Using deprecated NumPy API, disable it with " \

^ In file included from cylib.cc:488:0: cylib.h: In function ‘void impl_convert_colors_to_ids(int, int, int, int, uint8_t, uint8_t, uint64_t, float, float, float)’: cylib.h:36:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (std::size_t i = 0; i < num_classes; i++) { ^ cylib.cc: In function ‘void PyxExceptionSave(PyThreadState*, PyObject, PyObject, PyObject)’: cylib.cc:7403:21: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’ type = tstate->exc_type; ^ cylib.cc:7404:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’ value = tstate->exc_value; ^ cylib.cc:7405:19: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’ tb = tstate->exc_traceback; ^ cylib.cc: In function ‘void PyxExceptionReset(PyThreadState, PyObject, PyObject, PyObject)’: cylib.cc:7412:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’ tmp_type = tstate->exc_type; ^ cylib.cc:7413:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’ tmp_value = tstate->exc_value; ^ cylib.cc:7414:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’ tmp_tb = tstate->exc_traceback; ^ cylib.cc:7415:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’ tstate->exc_type = type; ^ cylib.cc:7416:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’ tstate->exc_value = value; ^ cylib.cc:7417:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’ tstate->exc_traceback = tb; ^ cylib.cc: In function ‘int PyxGetException(PyThreadState, PyObject, PyObject, PyObject)’: cylib.cc:7472:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’ tmp_type = tstate->exc_type; ^ cylib.cc:7473:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’ tmp_value = tstate->exc_value; ^ cylib.cc:7474:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’ tmp_tb = tstate->exc_traceback; ^ cylib.cc:7475:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’ tstate->exc_type = local_type; ^ cylib.cc:7476:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’ tstate->exc_value = local_value; ^ cylib.cc:7477:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’ tstate->exc_traceback = local_tb;

------------------ 原始邮件 ------------------ 发件人: "Marin Oršić"notifications@github.com; 发送时间: 2019年4月24日(星期三) 晚上10:00 收件人: "orsic/swiftnet"swiftnet@noreply.github.com; 抄送: "飞翔的貅貅"1287929156@qq.com; "Comment"comment@noreply.github.com; 主题: Re: [orsic/swiftnet] ModuleNotFoundError: No module named 'lib.cylib'(#4)

Closed #4.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

zhl001 commented 5 years ago

Did I need to specify the cpython path?

zhouhl@amax-Server:~/swiftnet/lib$ pip install cython Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Requirement already satisfied: cython in /home/zhouhl/anaconda3/lib/python3.6/site-packages (0.26.1)

------------------ 原始邮件 ------------------ 发件人: "Marin Oršić"notifications@github.com; 发送时间: 2019年4月24日(星期三) 晚上10:00 收件人: "orsic/swiftnet"swiftnet@noreply.github.com; 抄送: "飞翔的貅貅"1287929156@qq.com; "Comment"comment@noreply.github.com; 主题: Re: [orsic/swiftnet] ModuleNotFoundError: No module named 'lib.cylib'(#4)

Closed #4.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

zhl001 commented 5 years ago

I am very sorry to bother you. Now I have solved the problem by reinstalling the cython in python3.7 anaconda environment and get the cylib.so. Very grateful and best wishes to you !!!

------------------ 原始邮件 ------------------ 发件人: "Marin Oršić"notifications@github.com; 发送时间: 2019年4月24日(星期三) 晚上10:00 收件人: "orsic/swiftnet"swiftnet@noreply.github.com; 抄送: "飞翔的貅貅"1287929156@qq.com; "Comment"comment@noreply.github.com; 主题: Re: [orsic/swiftnet] ModuleNotFoundError: No module named 'lib.cylib'(#4)

Closed #4.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

saurabhghatnekar commented 5 years ago

I was facing a similar issue solved it by using the following in the build.sh file

g++ -shared -pthread -fPIC -fwrapv -O3 -Wall -fno-strict-aliasing -I /home/heimdall/miniconda3/envs/py37/lib/python3.7/site-packages/numpy/core/include/ -I /home/heimdall/miniconda3/envs/py37/include/python3.7m -o cylib.so cylib.cc -std=c++11

add ' -std=c++11 ' helped

chenslcool commented 3 years ago

I am very sorry to bother you. Now I have solved the problem by reinstalling the cython in python3.7 anaconda environment and get the cylib.so. Very grateful and best wishes to you !!!

thank you! I meet the same problem and fix it after seeing your words.