shahrukhqasim / TIES-2.0

Code for: S.R. Qasim, H. Mahmood, and F. Shafait, Rethinking Table Recognition using Graph Neural Networks (2019)
MIT License
276 stars 69 forks source link

ModuleNotFoundError: No module named 'iterators' #2

Closed rinkstiekema closed 5 years ago

rinkstiekema commented 5 years ago

When I try to run the program on windows, I get the error: python: can't open file 'python/bin/iterate/table_adjacency_parsing': [Errno 2] No such file or directory

When changing the command to python bin/iterate/table_adjacency_parsing.py, I get the traceback:

Traceback (most recent call last):
  File "bin/iterate/table_adjacency_parsing.py", line 2, in <module>
    from iterators.table_adjacency_parsing_iterator import TableAdjacencyParsingIterator
ModuleNotFoundError: No module named 'iterators'
shahrukhqasim commented 5 years ago

Hi

Have you added the python directory to $PYTHONPATH?

Either that or add . to $PYTHONPATH and then run from inside of python.

Let me know if it doesn't work.

rinkstiekema commented 5 years ago

I have tried adding PYTHONPATH and $PYTHONPATH, with the path to the python folder of your project, to the environment variables (both local user and system). Then restarted my command prompt and retried. It still gives me: python: can't open file 'bin/iterate/table_adjacency_parsing': [Errno 2] No such file or directory

shahrukhqasim commented 5 years ago

Sorry I missed the WIndows part. I have set it up on Ubuntu it works there. For windows, you'll have to resolve all the dependencies; it may be hard so I recommend you to do it on Linux or more preferably Ubuntu.

But the above two errors are not because of that. The first error is because you are running the command from the python folder. So there is no more python folder inside of it. So you have to remove python as you did.

Now it cannot recognize the module iterators but a simple cd will show that it is present. Hence, I am suspecting there could be some other issue. My first guess would be the python version because they changed the structures etc in 3.5+. Is it possible that you are running python 2.7?

rinkstiekema commented 5 years ago

Whether I am running python bin/iterate/table_adjacency_parsing from the root directory, or the python directory, does not matter. Both give python: can't open file 'bin/iterate/table_adjacency_parsing': [Errno 2] No such file or directory

When I instead use the full path to the table_adjacency_parsing.py file (and include the .py extension), it complains about the 'iterators' module. Since i'm using Python 3.7.3, this surprises me as the file indeed exists. My IDE also knows where to locate it. Any ideas?

I can try on a linux machine, but would prefer running it on windows as well.

shahrukhqasim commented 5 years ago

Well, for now, I don't think windows is the issue.

Can you check which directory are you in when you run the above command using pwd command? You have to be inside the python directory when you issue the above command.

shahrukhqasim commented 5 years ago

And which IDE are you using? I can probably help you if you are using PyCharm.

rinkstiekema commented 5 years ago

Am inside TIES-2.0/python/. What I do not understand is why the command does not include the .py extension, can you elaborate why this is? Am using Visual Studio Code for editing, but run from command line.

shahrukhqasim commented 5 years ago

You are right. It should include .py extension. My bad.

rinkstiekema commented 5 years ago

Since python will only look inside the current directory (I assume that is why you want to add the path to the PYTHONPATH, although I'm not really sure how to do so), it won't find the files inside the iterators folder. I added the following lines to make it work:

import os 
import sys
dir_path = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(dir_path, '..', '..'))
rinkstiekema commented 5 years ago

Also want to make you aware that the package tensorflow-gpu==1.12.0 is invalid.

Collecting tensorflow-gpu==1.12.0 (from -r requirements.txt (line 1))
  Could not find a version that satisfies the requirement tensorflow-gpu==1.12.0 (from -r requirements.txt (line 1)) (from versions: 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.14.0rc0, 1.14.0rc1, 2.0.0a0, 2.0.0b0, 2.0.0b1)
No matching distribution found for tensorflow-gpu==1.12.0 (from -r requirements.txt (line 1))
shahrukhqasim commented 5 years ago

I am not sure about your path hack. If it works, fine.

I tried installing the tensorflow-gpu==1.12.0. It is working on my Ubuntu machine however fails to work on MacOS. So I am assuming that has something to do with windows. Consult tensorflow website to see the correct way to install tensorflow-gpu on Windows. If you couldn't get tensorflow-gpu==1.12.0 to work, you can also use tensorflow-gpu==1.13.

Sharathmk99 commented 4 years ago

@rinkstiekema were you able to run the program successfully?

rinkstiekema commented 4 years ago

@rinkstiekema were you able to run the program successfully?

I do not remember but as I closed the issue I do assume so.

Sharathmk99 commented 4 years ago

@rinkstiekema I was able to train the model and accuracy was good. I'm struck in implementing maximal clique to get the output as table. If you have solved this problem, can you help?