Title: bundled six 1.9.0 causes ImportError: No module named 'winreg' in Pympler · Issue #6537 · matplotlib/matplotlib · GitHub
Open Graph Title: bundled six 1.9.0 causes ImportError: No module named 'winreg' in Pympler · Issue #6537 · matplotlib/matplotlib
X Title: bundled six 1.9.0 causes ImportError: No module named 'winreg' in Pympler · Issue #6537 · matplotlib/matplotlib
Description: To help us understand and resolve your issue please check that you have provided the information below. Matplotlib version, Python version and Platform (Windows, OSX, Linux ...) 1.5.1, 2.7.11/3.5.1, Fedora rawhide How did you install Mat...
Open Graph Description: To help us understand and resolve your issue please check that you have provided the information below. Matplotlib version, Python version and Platform (Windows, OSX, Linux ...) 1.5.1, 2.7.11/3.5.1...
X Description: To help us understand and resolve your issue please check that you have provided the information below. Matplotlib version, Python version and Platform (Windows, OSX, Linux ...) 1.5.1, 2.7.11/3.5.1...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/6537
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bundled six 1.9.0 causes ImportError: No module named 'winreg' in Pympler","articleBody":"To help us understand and resolve your issue please check that you have provided\nthe information below.\n- [x] Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)\n\n\u003e 1.5.1, 2.7.11/3.5.1, Fedora rawhide\n- [x] How did you install Matplotlib and Python (pip, anaconda, from source ...)\n\n\u003e From Fedora package.\n- [ ] If possible please supply a [Short, Self Contained, Correct, Example](http://sscce.org/)\n that demonstrates the issue i.e a small piece of code which reproduces the issue\n and can be run with out any other (or as few as possible) external dependencies.\n\n\u003e Try building Pympler (http://pythonhosted.org/Pympler/) and running its tests (`python3 setup.py test`). On armv7hl, I get this exception:\n\u003e \n\u003e ```\n\u003e Traceback (most recent call last):\n\u003e File \"/builddir/build/BUILD/Pympler-0.4.3/test/tracker/test_classtracker.py\", line 178, in test_snapshot_members\n\u003e self.tracker.create_snapshot(compute_total=True)\n\u003e File \"/builddir/build/BUILDROOT/python-Pympler-0.4.3-1.fc25.noarch/usr/lib/python3.5/site-packages/pympler/classtracker.py\", line 567, in create_snapshot\n\u003e snapshot.asizeof_total = asizeof.asizeof(all=True, code=True)\n\u003e File \"/builddir/build/BUILDROOT/python-Pympler-0.4.3-1.fc25.noarch/usr/lib/python3.5/site-packages/pympler/asizeof.py\", line 2191, in asizeof\n\u003e s = _asizer.asizeof(*t)\n\u003e File \"/builddir/build/BUILDROOT/python-Pympler-0.4.3-1.fc25.noarch/usr/lib/python3.5/site-packages/pympler/asizeof.py\", line 1783, in asizeof\n\u003e s, _ = self._sizes(objs, None)\n\u003e File \"/builddir/build/BUILDROOT/python-Pympler-0.4.3-1.fc25.noarch/usr/lib/python3.5/site-packages/pympler/asizeof.py\", line 1753, in _sizes\n\u003e s[i] = self._sizer(o, 0, sized)\n\u003e File \"/builddir/build/BUILDROOT/python-Pympler-0.4.3-1.fc25.noarch/usr/lib/python3.5/site-packages/pympler/asizeof.py\", line 1729, in _sizer\n\u003e s += z(o, d, None)\n\u003e File \"/builddir/build/BUILDROOT/python-Pympler-0.4.3-1.fc25.noarch/usr/lib/python3.5/site-packages/pympler/asizeof.py\", line 1729, in _sizer\n\u003e s += z(o, d, None)\n\u003e File \"/builddir/build/BUILDROOT/python-Pympler-0.4.3-1.fc25.noarch/usr/lib/python3.5/site-packages/pympler/asizeof.py\", line 1729, in _sizer\n\u003e s += z(o, d, None)\n\u003e File \"/builddir/build/BUILDROOT/python-Pympler-0.4.3-1.fc25.noarch/usr/lib/python3.5/site-packages/pympler/asizeof.py\", line 1729, in _sizer\n\u003e s += z(o, d, None)\n\u003e File \"/builddir/build/BUILDROOT/python-Pympler-0.4.3-1.fc25.noarch/usr/lib/python3.5/site-packages/pympler/asizeof.py\", line 1728, in _sizer\n\u003e for o in r(obj, False):\n\u003e File \"/builddir/build/BUILDROOT/python-Pympler-0.4.3-1.fc25.noarch/usr/lib/python3.5/site-packages/pympler/asizeof.py\", line 536, in _refs\n\u003e for _, o in _dir2(obj, **kwds):\n\u003e File \"/builddir/build/BUILDROOT/python-Pympler-0.4.3-1.fc25.noarch/usr/lib/python3.5/site-packages/pympler/asizeof.py\", line 347, in _dir2\n\u003e if hasattr(obj, slots):\n\u003e File \"/usr/lib/python3.5/site-packages/matplotlib/externals/six.py\", line 116, in __getattr__\n\u003e _module = self._resolve()\n\u003e File \"/usr/lib/python3.5/site-packages/matplotlib/externals/six.py\", line 113, in _resolve\n\u003e return _import_module(self.mod)\n\u003e File \"/usr/lib/python3.5/site-packages/matplotlib/externals/six.py\", line 80, in _import_module\n\u003e __import__(name)\n\u003e ImportError: No module named 'winreg'\n\u003e ```\n\nThe bundled six.py has this:\n\n```\nclass _MovedItems(_LazyModule):\n \"\"\"Lazy loading of moved objects\"\"\"\n __path__ = [] # mark as package\n\n\n_moved_attributes = [\n...\n MovedModule(\"winreg\", \"_winreg\"),\n]\n```\n\nwhile python-six-1.10.0 (latest version) has this:\n\n```\n# Add windows specific modules.\nif sys.platform == \"win32\":\n _moved_attributes += [\n MovedModule(\"winreg\", \"_winreg\"),\n ]\n```\n\nI applied this patch:\n\n```\ndiff -up matplotlib-1.5.1/setupext.py.six matplotlib-1.5.1/setupext.py\n--- matplotlib-1.5.1/setupext.py.six 2016-01-10 23:20:20.000000000 +0100\n+++ matplotlib-1.5.1/setupext.py 2016-05-18 13:44:21.534494158 +0200\n@@ -1026,6 +1026,18 @@ class Qhull(SetupPackage):\n ext.sources.extend(glob.glob('extern/qhull/*.c'))\n\n\n+class Six(SetupPackage):\n+ name = \"six\"\n+\n+ def check(self):\n+ try:\n+ import six\n+ except ImportError:\n+ return 'not found. pip may install it below.'\n+\n+ return 'version %s' % six.__version__\n+\n+\n class TTConv(SetupPackage):\n name = \"ttconv\"\n\ndiff -up matplotlib-1.5.1/setup.py.six matplotlib-1.5.1/setup.py\n--- matplotlib-1.5.1/setup.py.six 2016-01-10 23:20:20.000000000 +0100\n+++ matplotlib-1.5.1/setup.py 2016-05-18 13:44:21.528494040 +0200\n@@ -84,7 +84,7 @@ mpl_packages = [\n setupext.Delaunay(),\n setupext.QhullWrap(),\n setupext.Tri(),\n- setupext.Externals(),\n+ setupext.Six(),\n 'Optional subpackages',\n setupext.SampleData(),\n setupext.Toolkits(),\n```\n\nand replaced all imports from bundled **six** to system-wide **six** without any adverse effects. Please consider unbundling **six** and using system-wide version.\n","author":{"url":"https://github.com/rathann","@type":"Person","name":"rathann"},"datePublished":"2016-06-05T21:59:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/6537/matplotlib/issues/6537"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3d7a4f5c-e697-df67-50e9-5cc4e3d0656f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A4A2:43AB7:D7976B:12A8344:6A53AC94 |
| html-safe-nonce | b2101a548ecbf5b12bb4761f6e95274b9aa8a2f7c27fcd1ee9d535fca9bd90e2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNEEyOjQzQUI3OkQ3OTc2QjoxMkE4MzQ0OjZBNTNBQzk0IiwidmlzaXRvcl9pZCI6IjM2NTkxMjc5MzExMjM1MTA0MjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6a176980cab36289ad14167e087fdc9303bd002c42429971dab3f728b53ad0cb |
| hovercard-subject-tag | issue:158577396 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/6537/issue_layout |
| twitter:image | https://opengraph.githubassets.com/230d126aee1f8d14387f91ab5845a8f6a6a08887bcc9b2817c3b5f7a110f3251/matplotlib/matplotlib/issues/6537 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/230d126aee1f8d14387f91ab5845a8f6a6a08887bcc9b2817c3b5f7a110f3251/matplotlib/matplotlib/issues/6537 |
| og:image:alt | To help us understand and resolve your issue please check that you have provided the information below. Matplotlib version, Python version and Platform (Windows, OSX, Linux ...) 1.5.1, 2.7.11/3.5.1... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rathann |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width