pelednoam/mmvt

Blender 2.79b Not Compatible with tkinter

alexrockhill opened this issue · 2 comments

It looks like there were some developments and tkinter isn't included in the new blender python3.5m package. This causes issues with the current version of MMVT when importing matplotlib.

https://developer.blender.org/feed/?after=6540497215700866334

[karima:mmvt] (nmr-stable60-env) Traceback (most recent call last):
File "/autofs/space/karima_001/users/alex/software/mmvt_root_alex/mmvt_blend/empty_subject.blend/run_mmvt.py", line 12, in
File "/autofs/space/karima_001/users/alex/software/mmvt_root_alex/mmvt/src/mmvt_addon/mmvt_addon.py", line 29, in
import colors_utils
File "/autofs/space/karima_001/users/alex/software/mmvt_root_alex/mmvt/src/mmvt_addon/colors_utils.py", line 5, in
import matplotlib.pyplot as plt
File "/autofs/space/karima_001/users/alex/software/blender-2.79b-linux-glibc219-x86_64/2.79/python/lib/python3.5/site-packages/matplotlib/pyplot.py", line 2374, in
switch_backend(rcParams["backend"])
File "/autofs/space/karima_001/users/alex/software/blender-2.79b-linux-glibc219-x86_64/2.79/python/lib/python3.5/site-packages/matplotlib/pyplot.py", line 207, in switch_backend
backend_mod = importlib.import_module(backend_name)
File "/autofs/space/karima_001/users/alex/software/blender-2.79b-linux-glibc219-x86_64/2.79/python/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/autofs/space/karima_001/users/alex/software/blender-2.79b-linux-glibc219-x86_64/2.79/python/lib/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 1, in
from . import _backend_tk
File "/autofs/space/karima_001/users/alex/software/blender-2.79b-linux-glibc219-x86_64/2.79/python/lib/python3.5/site-packages/matplotlib/backends/_backend_tk.py", line 5, in
import tkinter as Tk
ImportError: No module named 'tkinter'

Adding these to the first two lines of src/mmvt_addon/colors_utils.py solved the installer issue but might not be a long-term fix.

import matplotlib
matplotlib.use('Agg')

The matt_hilbert brain was inflated when I loaded MMVT but I just changed to inflated and back to pial and it fixed.

But then I get the following non-fatal traceback while running MMVT, which is probably due to the file being generated in an older version of python:

Traceback (most recent call last):
File "/autofs/space/karima_001/users/alex/software/mmvt_root_alex/mmvt/src/mmvt_addon/mmvt_addon.py", line 774, in main
load_all_panels(addon_prefs)
File "/autofs/space/karima_001/users/alex/software/mmvt_root_alex/mmvt/src/mmvt_addon/mmvt_addon.py", line 722, in load_all_panels
panel.init(mmvt)
File "/autofs/space/karima_001/users/alex/software/mmvt_root_alex/mmvt/src/mmvt_addon/connections_panel.py", line 1005, in init
conn_files = [f for f in conn_files if all([k in set(np.load(f).keys()) for k in conn_keys])]
File "/autofs/space/karima_001/users/alex/software/mmvt_root_alex/mmvt/src/mmvt_addon/connections_panel.py", line 1005, in
conn_files = [f for f in conn_files if all([k in set(np.load(f).keys()) for k in conn_keys])]
File "/autofs/space/karima_001/users/alex/software/mmvt_root_alex/mmvt/src/mmvt_addon/connections_panel.py", line 1005, in
conn_files = [f for f in conn_files if all([k in set(np.load(f).keys()) for k in conn_keys])]
File "/autofs/space/karima_001/users/alex/software/blender-2.79b-linux-glibc219-x86_64/2.79/python/lib/python3.5/site-packages/numpy/lib/npyio.py", line 426, in load
pickle_kwargs=pickle_kwargs)
File "/autofs/space/karima_001/users/alex/software/blender-2.79b-linux-glibc219-x86_64/2.79/python/lib/python3.5/site-packages/numpy/lib/npyio.py", line 182, in init
_zip = zipfile_factory(fid)
File "/autofs/space/karima_001/users/alex/software/blender-2.79b-linux-glibc219-x86_64/2.79/python/lib/python3.5/site-packages/numpy/lib/npyio.py", line 112, in zipfile_factory
return zipfile.ZipFile(file, *args, **kwargs)
File "/autofs/space/karima_001/users/alex/software/blender-2.79b-linux-glibc219-x86_64/2.79/python/lib/python3.5/zipfile.py", line 1026, in init
self._RealGetContents()
File "/autofs/space/karima_001/users/alex/software/blender-2.79b-linux-glibc219-x86_64/2.79/python/lib/python3.5/zipfile.py", line 1094, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

Exception ignored in: <bound method NpzFile.del of <numpy.lib.npyio.NpzFile object at 0x2af2f51cac88>>
Traceback (most recent call last):
File "/autofs/space/karima_001/users/alex/software/blender-2.79b-linux-glibc219-x86_64/2.79/python/lib/python3.5/site-packages/numpy/lib/npyio.py", line 219, in del
self.close()
File "/autofs/space/karima_001/users/alex/software/blender-2.79b-linux-glibc219-x86_64/2.79/python/lib/python3.5/site-packages/numpy/lib/npyio.py", line 210, in close
if self.zip is not None:
AttributeError: 'NpzFile' object has no attribute 'zip'

Well, this is a problem. We need to understand the NpzFile error. Also, I think we don't need to import matplotlib. Until now, we could find a workaround.