limaosen0 / AS-GCN

The model architecture of AS-GCN (for human action recognition)
BSD 2-Clause "Simplified" License
290 stars 71 forks source link

import_class not found #4

Open jingong opened 5 years ago

Anirudh257 commented 5 years ago

It is present in the Torchlight folder. Have you built torchlight from setup.py? If yes, then, you may need to change the relative import here:

from torchlight import import_class

tcxia commented 5 years ago

I've run this code "python setup.py install", but I still can't import it.

Anirudh257 commented 5 years ago

@MarsTT, you will have to check the paths for the import_class function within torchlight. I think that import_class is in torchlight/io.py. https://github.com/limaosen0/AS-GCN/blob/ab6951c3e6fc1b22bb4a0dc87a33cca228aa69fe/torchlight/torchlight/io.py#L181. So, you may need to change the line to

from torchlight.io import import_class

You can repeat these steps for the other functions in the code.

dangao250 commented 4 years ago

我也有同样的问题 请问您解决了吗

dangao250 commented 4 years ago

I've run this code "python setup.py install", but I still can't import it.

Have you solved it?

Anirudh257 commented 4 years ago

@dangao250 You can follow the steps outlined by me. It worked.

dangao250 commented 4 years ago

You can follow the steps outlined by me. It worked.

I did what you did, but I still made a mistake image

Anirudh257 commented 4 years ago

1) In torchlight directory, you will another torchlight directory which has 3 files:

  1. gpu.py
  2. init.py
  3. io.py.

Copy these to the outer torchlight directory like below image

2) In all your files, you have to make changes in the torchlight import code.

from torchlight.io import import_class

should be the correct code.

For example, in processor/io.py file, the import line changes to:

image

dangao250 commented 4 years ago

It is present in the Torchlight folder. Have you built torchlight from setup.py? If yes, then, you may need to change the relative import here:

from torchlight import import_class

image How to solve this error?

dangao250 commented 4 years ago
  1. In torchlight directory, you will another torchlight directory which has 3 files:

  2. gpu.py

  3. init.py

  4. io.py.

Copy these to the outer torchlight directory like below image

  1. In all your files, you have to make changes in the torchlight import code.
from torchlight.io import import_class

should be the correct code.

For example, in processor/io.py file, the import line changes to:

image

image How can you solve this problem?

dangao250 commented 4 years ago

image How do you solve this problem?

dangao250 commented 4 years ago
  1. In torchlight directory, you will another torchlight directory which has 3 files:

  2. gpu.py

  3. init.py

  4. io.py.

Copy these to the outer torchlight directory like below image

  1. In all your files, you have to make changes in the torchlight import code.
from torchlight.io import import_class

should be the correct code.

For example, in processor/io.py file, the import line changes to:

image

How do you solve this problem?

dangao250 commented 4 years ago

How do you solve this problem? image

Anirudh257 commented 4 years ago

There is no IO class in torchlight. It is present in io.py file in torchlight folder. For this and other similar issues, you will have to read the 3 files present in the torchlight folder.

wly1998 commented 4 years ago

I replaced the torchlight/torchlight/ Init.py file here with theInit.py file under the stgcn project, and then ran setup.py again. This works.

ywang0218 commented 4 years ago

I replaced the torchlight/torchlight/ Init.py file here with theInit.py file under the stgcn project, and then ran setup.py again. This works.

Did you change from torchlight. import import_class to from torchlight.io import import_class? I did what you said but got an error: ModuleNotFoundError: No module named 'processor.demo'

Anirudh257 commented 4 years ago

@ywang0218 You can comment the line processor.demo

Thomas-yx commented 4 years ago

Surprising! It worked. Thank you very much!

a726 commented 4 years ago

Surprising! It worked. Thank you very much!

Hello, may I ask you is how to solve ‘ImportError: can not import name 'import_class'’.

Thomas-yx commented 4 years ago

Hi,it's so easy.You can use this sentence 'from torchlight.io import_class' instead of the original sentence. Because the function of 'import_class' is in the io.py rather than the file of torchlight.I hope my answer can help you.

------------------ 原始邮件 ------------------ 发件人: "limaosen0/AS-GCN" <notifications@github.com>; 发送时间: 2020年8月10日(星期一) 中午12:01 收件人: "limaosen0/AS-GCN"<AS-GCN@noreply.github.com>; 抄送: "苦海两颗糖"<2296384501@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [limaosen0/AS-GCN] import_class not found (#4)

Surprising! It worked. Thank you very much!

Hello, may I ask you is how to solve ‘ImportError: can not import name 'import_class'’.

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

a726 commented 4 years ago

OK,thanks.发自我的华为手机-------- 原始邮件 --------发件人: Thomas_y notifications@github.com日期: 2020年8月10日周一 下午2:24收件人: limaosen0/AS-GCN AS-GCN@noreply.github.com抄送: Xiaoyuan Zhang 306835421@qq.com, Comment comment@noreply.github.com主 题: Re: [limaosen0/AS-GCN] import_class not found (#4)

Hi,it's so easy.You can use this sentence 'from torchlight.io import_class' instead of the original sentence. Because the function of 'import_class' is in the io.py

rather than the file of torchlight.I hope my answer can help you.

------------------ 原始邮件 ------------------

发件人: "limaosen0/AS-GCN" <notifications@github.com>;

发送时间: 2020年8月10日(星期一) 中午12:01

收件人: "limaosen0/AS-GCN"<AS-GCN@noreply.github.com>;

抄送: "苦海两颗糖"<2296384501@qq.com>;"Comment"<comment@noreply.github.com>;

主题: Re: [limaosen0/AS-GCN] import_class not found (#4)

Surprising! It worked. Thank you very much!

Hello, may I ask you is how to solve ‘ImportError: can not import name 'import_class'’.

You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or unsubscribe.

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

babaee74 commented 2 years ago

I've run this code "python setup.py install", but I still can't import it.

you need to add the outer torchlight folder to the system path, just run the code below:

import sys sys.path.insert(0, '/content/drive/MyDrive/ST-GCN/torchlight')

that will solve this problem but it probably add the isue of no mudule name torchlight in processor.process.py which you need to modify this file and add

import torchlight.torchlight as torchlight instead of import torchlight