[BUG] Wonky bug with layouts module
See original GitHub issueExpected Behavior
import graspologic
works successfully in a jupyter notebook, after setting up from either github or the setup.py file manually (e.g., cloning package).
Actual Behavior
import graspologic
produces the following error from a jupyter notebook:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
File ~/.virtualenvs/graspy-fix/lib/python3.8/site-packages/pkg_resources/__init__.py:355, in get_provider(moduleOrReq)
354 try:
--> 355 module = sys.modules[moduleOrReq]
356 except KeyError:
KeyError: None
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 import graspologic
2 print(graspologic.__file__)
File <frozen importlib._bootstrap>:991, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:975, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:655, in _load_unlocked(spec)
File <frozen importlib._bootstrap>:618, in _load_backward_compatible(spec)
File <frozen zipimport>:259, in load_module(self, fullname)
File ~/.virtualenvs/graspy-fix/lib/python3.8/site-packages/graspologic-1.0.1-py3.8.egg/graspologic/__init__.py:9, in <module>
7 import graspologic.embed
8 import graspologic.inference
----> 9 import graspologic.layouts
10 import graspologic.models
11 import graspologic.nominate
File <frozen importlib._bootstrap>:991, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:975, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:655, in _load_unlocked(spec)
File <frozen importlib._bootstrap>:618, in _load_backward_compatible(spec)
File <frozen zipimport>:259, in load_module(self, fullname)
File ~/.virtualenvs/graspy-fix/lib/python3.8/site-packages/graspologic-1.0.1-py3.8.egg/graspologic/layouts/__init__.py:6, in <module>
1 # Copyright (c) Microsoft Corporation.
2 # Licensed under the MIT license.
5 from .classes import NodePosition
----> 6 from .colors import categorical_colors, sequential_colors
7 from .render import save_graph, show_graph
9 from .auto import layout_tsne, layout_umap # isort:skip
File <frozen importlib._bootstrap>:991, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:975, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:655, in _load_unlocked(spec)
File <frozen importlib._bootstrap>:618, in _load_backward_compatible(spec)
File <frozen zipimport>:259, in load_module(self, fullname)
File ~/.virtualenvs/graspy-fix/lib/python3.8/site-packages/graspologic-1.0.1-py3.8.egg/graspologic/layouts/colors.py:36, in <module>
32 dark: Dict[Any, Any] = thematic_json["dark"]
33 return light, dark
---> 36 _CACHED_LIGHT, _CACHED_DARK = _load_thematic_json(None)
39 def _get_colors(light_background: bool, theme_path: Optional[str]) -> Dict[Any, Any]:
40 light = _CACHED_LIGHT
File ~/.virtualenvs/graspy-fix/lib/python3.8/site-packages/graspologic-1.0.1-py3.8.egg/graspologic/layouts/colors.py:26, in _load_thematic_json(path)
24 else:
25 atexit.register(pkg_resources.cleanup_resources)
---> 26 include_path = pkg_resources.resource_filename(__package__, "include")
27 colors_path = os.path.join(include_path, "colors-100.json")
29 with open(colors_path) as thematic_json_io:
File ~/.virtualenvs/graspy-fix/lib/python3.8/site-packages/pkg_resources/__init__.py:1141, in ResourceManager.resource_filename(self, package_or_requirement, resource_name)
1139 def resource_filename(self, package_or_requirement, resource_name):
1140 """Return a true filesystem path for specified resource"""
-> 1141 return get_provider(package_or_requirement).get_resource_filename(
1142 self, resource_name
1143 )
File ~/.virtualenvs/graspy-fix/lib/python3.8/site-packages/pkg_resources/__init__.py:357, in get_provider(moduleOrReq)
355 module = sys.modules[moduleOrReq]
356 except KeyError:
--> 357 __import__(moduleOrReq)
358 module = sys.modules[moduleOrReq]
359 loader = getattr(module, '__loader__', None)
TypeError: __import__() argument 1 must be str, not None
Your Environment
- Python version: 3.8.2
- graspologic version: 1.0.1 (
devbranch)
Additional Details
The package builds/works successfully from a terminal session, so obviously my first thought was that I had mis-configured/not appropriately configured my jupyter kernel for the notebook. However, I verified manually that graspologic.__file__ pointed to the same thing in both places, which it did. Further verified that my jupyter kernel was the right version of python, which it was. Not really sure what to do from there. Not sure whether this is a jupyter issue, OS issue (mac), or a python issue relating to something else.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Issues for Drupal core | Drupal.org
Issues for Drupal core ; Pass along redirect destination with multi-step Layout Builder links, Needs work, Normal, Bug report, 10.1.x-dev ; Devise a...
Read more >Bug listing with status RESOLVED with resolution FIXED as at ...
status:RESOLVED resolution:FIXED severity:normal · Bug:361 - "make modules fails when HFS (Apple Macintosh FS) is built as module" status:RESOLVED ...
Read more >Bugs – Rachael Arnold
Specifically, a bug in the IIS FastCGI module and a size limit on ... I found some promising complaints about pngs going wonky...
Read more >[#3899] twi_keypad module can't be probed twice - Linux Bug Archive
Is this bug repeatable?: Yes Resolution: Fixed. Uboot version or rev.: Toolchain version or rev.: 08r1-8. App binary format: N/A. Summary: twi_keypad module...
Read more >Bug #1540532 “Wily update to v4.2.8-ckt3 stable release” : Bugs ...
Bug #1540532 reported by Kamal Mostafa on 2016-02-01. 16. This bug affects 2 people ... [media] rc: allow rc modules to be loaded...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Oh this is going to be so much fun to track down. Basically we try to look inside the module for the json file that contains the thematic color palette and use it. The current process was supposed to work everywhere - relative paths, or while packaged, etc - but it seems like Jupyter is putting you in an odd state that we didn’t expect. What’s most vexxing is that this absolutely works for other people in Jupyter, so there’s something else adding a new wrinkle that we didn’t expect at all.
Ok so I just brute forced it temporarily by literally wgetting and chmodding with problematically bad permissions to fix the issue for the specific deployment workflow I needed to work as seen https://github.com/neurodata/graph-stats-book/blob/accde1f0dcad134b2d7843fa637923db77d4068a/.github/workflows/deploy.yml#L29, so no longer critical to me, but definitely still seems to be a problem. The workflow we were building off was using
ubuntu-lateston a github workflow, and we were building usingpip install git+<appropriate path to graspologic>@devdirectly from the dev branch.