interrogator / corpkit

A toolkit for corpus linguistics
Other
199 stars 27 forks source link

corpkit_gui(): "ImportError: No module named 'Tables'" #36

Closed alischinsky closed 8 years ago

alischinsky commented 8 years ago

When attempting to run the corpkit GUI with Python 3.5.2 under Ubuntu Linux 16.04.1, the Tables module from tkintertable cannot be found.

Trace log is attached.

interrogator commented 8 years ago

Where is the log attached? :)

alischinsky commented 8 years ago

Sorry about that. Log here. corpkit_gui.txt

interrogator commented 8 years ago

That's happening in the tkintertable module, due to, I believe, Python 3 compatibility issues. Try installing my fork instead: https://www.github.com/interrogator/tkintertable --- the erroring lines have been replaced to:

from tkintertable.Tables import *
from tkintertable.TableModels import *

There may be a couple of other bugs using the GUI in Python 3. I'd love to get them fixed, so just let me know if you encounter more.

interrogator commented 8 years ago

I've made some fixes for Python 3 use of the GUI, it seems to work alright now. They're in the master now, so reinstall corpkit from here if you're having trouble...

alischinsky commented 8 years ago

I've reinstalled and the exception doesn't happen any more. Now the command executes, but the GUI window doesn't appear. I'm not sure how to log what's happening for debugging purposes.

FWIW, the python2 version seems to run fine (though the window is too large for my laptop screen, and I cannot see the status bar).

interrogator commented 8 years ago

Thanks for the updates. Interesting issue. My guess is that it's caused by the PIL/Pillow imaging libraries. PIL works on Python 2, but Pillow is needed for Python 3. Instructions for Linux installation are at http://pillow.readthedocs.io/en/3.2.x/installation.html. If you don't have it installed, that's definitely going to stop the app from working, so try that and let me know. If you already have it though, disregard this.

As for Python 2, yes, I need to figure out how the display sizing works. If you're really desperate you can probably change your screen resolution, but I'll look into a proper fix shortly.

alischinsky commented 8 years ago

I had Pillow 3.1.2 installed previously. I've just upgraded it to 3.3.0 to no visible effect.

I can't do much about resolution; my laptop monitor doesn't go beyond 1366×768.

interrogator commented 8 years ago

Alright, that's useful. So, I've put up a new version that will still load even with PIL/Pillow problems. That might not be your issue though.

All stderr and stdout is being piped to the status bar, which we can't see. To stop that piping, you need to open up the corpkit/gui.py file, and stop this piping. Here is the original, around line 273:

        # redirect stdout for log
        self.redir = RedirectText(self.status_text, self.log_stream)
        sys.stdout = self.redir
        sys.stderr = self.redir

Comment out the last two lines:

        # redirect stdout for log
        self.redir = RedirectText(self.status_text, self.log_stream)
        #sys.stdout = self.redir
        #sys.stderr = self.redir

And now the error should show up in wherever you called the GUI. It'd be awesome if you could show me that. If the error is PIL/Pillow related, try reinstalling the repo, as I've pushed those fixes just now.

alischinsky commented 8 years ago

Log attached: corpkit_gui_20160811.txt

The error does not seem to be PIL-related, but rather a matplotlib issue. I have matplotlib 1.5.1 installed, and my /usr/local/lib/python3.4/dist-packages/matplotlib/mpl-data/stylelib exists.

interrogator commented 8 years ago

Alright, that was my fault, some weird old code to detect which matplotlib styles are available, when now there is simply a style.available attrib.

I've pushed a fix---you can just replace corpkit/gui.py with the newest one in the master branch if you want. I'm testing with matplotlib v2.x, but it shouldn't matter.

Thanks for your patience with this---great to know that these bugs are being fixed, as I hope to do future releases of the .app with Python 3.

interrogator commented 8 years ago

Oh, whoops, I just realised, I'm currently working on some of the resolution issues. If you have any resolution weirdness, disregard for now :)

alischinsky commented 8 years ago

It runs now! Thanks for the help (though I'll have to find another computer to actually use the GUI, since the resolution issue is a killer)

interrogator commented 8 years ago

Awesome. If you encounter any more issues, please do submit them, I don't use the GUI myself that much, but would like it to be stable.

As for resolution, my newest pushes have started addressing it, but there's still more to be done. I'll file an issue that you can watch.