New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot be imported without tkinter #77

Closed
jgosmann opened this Issue Jun 4, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@jgosmann
Member

jgosmann commented Jun 4, 2018

The nengo-extras import fails if Python is not installed with tkinter. Can we fix this and have a release quickly? I'd like to use nengo-extras in my tutorial on Friday, but I am afraid that participants might run into this problem without any quick way to fix it due to a variety environments.

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-170-cae318af19f6> in <module>()
----> 1 import nengo_extras

~/Library/Python/3.6/lib/python/site-packages/nengo_extras/__init__.py in <module>()
      5 from .convnet import Conv2d, Pool2d
      6 from .neurons import FastLIF, SoftLIFRate
----> 7 from . import (
      8     camera, data, dists, graphviz, gui, networks, neurons, probe, vision)
      9 

~/Library/Python/3.6/lib/python/site-packages/nengo_extras/data.py in <module>()
      9 import numpy as np
     10 
---> 11 from .compat import pickle_load_bytes, urlretrieve
     12 
     13 

~/Library/Python/3.6/lib/python/site-packages/nengo_extras/compat.py in <module>()
      9     from io import StringIO
     10     from urllib.request import urlretrieve
---> 11     import tkinter
     12 
     13 

/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py in <module>()
     34 import sys
     35 
---> 36 import _tkinter # If this fails your Python may not be configured for Tk
     37 TclError = _tkinter.TclError
     38 from tkinter.constants import *

ModuleNotFoundError: No module named '_tkinter'
@jgosmann

This comment has been minimized.

Member

jgosmann commented Jun 4, 2018

Given that many things in nengo-extras are not as well tested across different environments, it might be best to reduce what we import by default? Because all I need is nengo_extras.learning_rules, but importing it is prevented by the nengo_extras default imports that fail.

@tbekolay

This comment has been minimized.

Member

tbekolay commented Jun 4, 2018

Yeah, that makes sense, I'll remove most of what's in __init__.py and we can hopefully do a release tonight or tomorrow.

@tbekolay

This comment has been minimized.

Member

tbekolay commented Jun 5, 2018

Done in #78.

@tbekolay tbekolay closed this Jun 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment