Title: Random error of PyCapsule_New called with null pointer error when using seaborn matplotlib numpy and pandas · Issue #121290 · python/cpython · GitHub
Open Graph Title: Random error of PyCapsule_New called with null pointer error when using seaborn matplotlib numpy and pandas · Issue #121290 · python/cpython
X Title: Random error of PyCapsule_New called with null pointer error when using seaborn matplotlib numpy and pandas · Issue #121290 · python/cpython
Description: Bug report Bug description: import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.datasets import load_diabetes data = load_diabetes() df = pd.DataFrame(data.data, columns=data.feature_...
Open Graph Description: Bug report Bug description: import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.datasets import load_diabetes data = load_diabetes() df = pd.Da...
X Description: Bug report Bug description: import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.datasets import load_diabetes data = load_diabetes() df = pd.Da...
Opengraph URL: https://github.com/python/cpython/issues/121290
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Random error of PyCapsule_New called with null pointer error when using seaborn matplotlib numpy and pandas","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\n```python\r\nimport pandas as pd\r\nimport numpy as np\r\nimport seaborn as sns\r\nimport matplotlib.pyplot as plt\r\nfrom sklearn.datasets import load_diabetes\r\n\r\n\r\ndata = load_diabetes()\r\ndf = pd.DataFrame(data.data, columns=data.feature_names)\r\ndf['target'] = data.target\r\n\r\ndf = df.drop_duplicates()\r\ndf = df.ffill()\r\n\r\ndf.hist(bins=30, grid=False)\r\nplt.suptitle('Histograms of Numerical Features')\r\nplt.show()\r\nsns.pairplot(df[['target', 'age', 'bmi', 's4', 's5']])\r\nplt.suptitle('Pair Plot of Target and Selected Features', y=1.02)\r\nplt.show()\r\ncorr_matrix = df.corr()\r\nsns.heatmap(corr_matrix, annot=True, cmap='coolwarm', fmt='.2f')\r\nplt.title('Heatmap of Correlation Matrix')\r\nplt.show()\r\nsns.boxplot(data=df.select_dtypes(include=[np.number]))\r\nplt.title('Boxplots for Numerical Features')\r\nplt.xticks(rotation=90)\r\nplt.show()\r\nplt.scatter(df['bmi'], df['age'], c=df['target'], cmap='viridis', alpha=0.6)\r\nplt.colorbar(label='Diabetes Progression')\r\nplt.xlabel('BMI')\r\nplt.ylabel('Age')\r\nplt.title('Scatter Plot of BMI vs Age Color-Coded by Target')\r\nplt.show()\r\n```\r\n\r\n#################\r\nThe above code is randomly giving the following error:\r\n```python\r\nTraceback (most recent call last):\r\n File \"D:/python work/p10.py\", line 20, in \u003cmodule\u003e\r\n sns.pairplot(df[['target', 'age', 'bmi', 's4', 's5']])\r\n File \"C:\\Users\\admin\\AppData\\Roaming\\Python\\Python312\\site-packages\\seaborn\\axisgrid.py\", line 2119, in pairplot\r\n grid = PairGrid(data, vars=vars, x_vars=x_vars, y_vars=y_vars, hue=hue,\r\n File \"C:\\Users\\admin\\AppData\\Roaming\\Python\\Python312\\site-packages\\seaborn\\axisgrid.py\", line 1280, in __init__\r\n fig = plt.figure(figsize=figsize)\r\n File \"C:\\Users\\admin\\AppData\\Roaming\\Python\\Python312\\site-packages\\matplotlib\\pyplot.py\", line 1022, in figure\r\n manager = new_figure_manager(\r\n File \"C:\\Users\\admin\\AppData\\Roaming\\Python\\Python312\\site-packages\\matplotlib\\pyplot.py\", line 545, in new_figure_manager\r\n return _get_backend_mod().new_figure_manager(*args, **kwargs)\r\n File \"C:\\Users\\admin\\AppData\\Roaming\\Python\\Python312\\site-packages\\matplotlib\\backend_bases.py\", line 3521, in new_figure_manager\r\n return cls.new_figure_manager_given_figure(num, fig)\r\n File \"C:\\Users\\admin\\AppData\\Roaming\\Python\\Python312\\site-packages\\matplotlib\\backend_bases.py\", line 3526, in new_figure_manager_given_figure\r\n return cls.FigureCanvas.new_manager(figure, num)\r\n File \"C:\\Users\\admin\\AppData\\Roaming\\Python\\Python312\\site-packages\\matplotlib\\backend_bases.py\", line 1811, in new_manager\r\n return cls.manager_class.create_with_canvas(cls, figure, num)\r\n File \"C:\\Users\\admin\\AppData\\Roaming\\Python\\Python312\\site-packages\\matplotlib\\backends\\_backend_tk.py\", line 479, in create_with_canvas\r\n with _restore_foreground_window_at_end():\r\n File \"C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\contextlib.py\", line 137, in __enter__\r\n return next(self.gen)\r\n File \"C:\\Users\\admin\\AppData\\Roaming\\Python\\Python312\\site-packages\\matplotlib\\backends\\_backend_tk.py\", line 43, in _restore_foreground_window_at_end\r\n foreground = _c_internal_utils.Win32_GetForegroundWindow()\r\nValueError: PyCapsule_New called with null pointer\r\n```\r\nSometime it executes successfully and sometimes it doesn't. If there is no bug then please provide me solution for this.\r\n\r\n### CPython versions tested on:\r\n\r\n3.12\r\n\r\n### Operating systems tested on:\r\n\r\nWindows","author":{"url":"https://github.com/fx-Chintu","@type":"Person","name":"fx-Chintu"},"datePublished":"2024-07-02T19:54:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/121290/cpython/issues/121290"}
| 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:024bf9bd-150b-85ea-8011-5b6969ed6d70 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AF34:39E76C:23903EE:30611A5:6A542506 |
| html-safe-nonce | 46c358411adb2f4637d5c54090286c329716cd73b7e784b268b5201f15e8b1fb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjM0OjM5RTc2QzoyMzkwM0VFOjMwNjExQTU6NkE1NDI1MDYiLCJ2aXNpdG9yX2lkIjoiNjQ5MTEyNjM2ODQ5NTIxNTg3OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | cde3184b87a377e2c41c564050b9263f2c05f1c961aa2ff53b7a856c48d1c118 |
| hovercard-subject-tag | issue:2387040455 |
| 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/python/cpython/121290/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9be5eb182d40e0c9ca0444a6e414566e9b784bb05beb67ba98ef5a8045602902/python/cpython/issues/121290 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9be5eb182d40e0c9ca0444a6e414566e9b784bb05beb67ba98ef5a8045602902/python/cpython/issues/121290 |
| og:image:alt | Bug report Bug description: import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.datasets import load_diabetes data = load_diabetes() df = pd.Da... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fx-Chintu |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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