Skip to content
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

Deprecated Functions and Explicit Specialization with Python 3.11 #334

Open
aeaotst opened this issue Jan 4, 2023 · 3 comments
Open

Deprecated Functions and Explicit Specialization with Python 3.11 #334

aeaotst opened this issue Jan 4, 2023 · 3 comments

Comments

@aeaotst
Copy link

aeaotst commented Jan 4, 2023

Hello,

I've tried adding matplotlib-cpp to my project as a sanity-checking tool but I've encountered a handful of errors when building. Specifically:

1>C:\Users\user\Source\repos\project\matplotlibcpp.h(174,9): error C4996: 'Py_SetProgramName': deprecated in 3.11 1>C:\Users\user\Source\repos\project\matplotlibcpp.h(182,9): error C4996: 'PySys_SetArgv': deprecated in 3.11 1>C:\Users\user\Source\repos\project\matplotlibcpp.h(354,10): error C2766: explicit specialization; 'matplotlibcpp::detail::select_npy_type<int64_t>' has already been defined 1>C:\Users\user\Source\repos\project\matplotlibcpp.h(345,10): message : see previous definition of 'select_npy_type<__int64>' 1>C:\Users\user\Source\repos\project\matplotlibcpp.h(356,10): error C2766: explicit specialization; 'matplotlibcpp::detail::select_npy_type<uint64_t>' has already been defined 1>C:\Users\user\Source\repos\project\matplotlibcpp.h(349,10): message : see previous definition of 'select_npy_type<unsigned __int64>'

I'm on Windows 10 using Visual Studio 2022 and, as you may have guessed, Python 3.11. Initially tried linking the relevant files manually, then again using vcpkg, with the error unsurprisingly persisting. I've resolved to just push my data into pyplot via fstream since that's probably less hassle than trying to solve this or change Python versions, but I figured I'd raise the issue.

@WildRackoon
Copy link

This is probably a duplicate issue of #196

@yu113887
Copy link

I meet same problem. Did you solve this problem?

@mithgil
Copy link

mithgil commented Sep 13, 2024

I also got these issues. The warnings you're encountering are related to deprecated functions in the Python C API. These functions, such as Py_SetProgramName and PySys_SetArgv, are marked as deprecated in Python 3.11 and later versions. And I currently use 3.12 version. The matplotlibcpp library you're using is calling these deprecated functions, which are still valid but marked for removal in future Python versions.

So maybe downgrade your python to <3.10 or wait for the maintainers to update the header file and fix these warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants