numpy required for C++ library to work with python bindings
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
Beginne damit, den Fehler mit dem gezeigten BOOST_PYTHON_MODULE(test_lib)-Einstiegspunkt zu reproduzieren, und vergleiche Python-Ausführungen mit und ohne vorherigen Import von numpy. Verfolge den Initialisierungspfad hinter test_lib.initialize() und sammle ausreichend Quellcode, um festzustellen, ob der numpy-Import erforderlich ist; abgeschlossen ist die Aufgabe, wenn du die Abhängigkeit erklärst oder den fehlschlagenden Initialisierungsschritt identifizierst.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
I've added Boost python bindings into a C++ library. Calling the initialization method of this C++ library from python will fail if numpy is not imported into python before importing my C++ library. There are no errors but the C++ library spits out it failed to initialize. Why would numpy be required in python for my boost bindings to work with this C++ library? See example below.
C++
// Boost imports I'm using
#include <boost/python.hpp>
#include <boost/python/dict.hpp>
#include <boost/python/object.hpp>
using namespace boost;
static bool InitializePy() {
// Call library initialize here
}
BOOST_PYTHON_MODULE(test_lib)
{
python::def("initialize", InitializePy);
}
Python
# import numpy
import test_lib
# Without importing numpy, this initialization will fail
test_lib.initialize()
I can share more source if anyone would like a look but the way I see it, regardless of what else is being done in C++, numpy needing to be imported in python is odd to me.
- Vorherrschende Sprache
- C++
- Sterne
- 537
- Forks
- 223
- Ø Merge
- 11 Std. 22 Min.
- Gemergte PRs (30 T.)
- 2
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus boostorg/python
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 84/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
-
BoostDetectToolset-1.90.0.cmake file not found in an include() call in boost_python-config.cmake Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 48/100
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 25/100
Alle Issues in boostorg/python
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
duckdb/duckdb-wasm#2258 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
objectionary/eo-graphs#75 ·
-
Coarray integration tests carry no LABELS, so run_tests.py silently skips them under every backend Offencoarray
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
FISCO-BCOS/FISCO-BCOS#5642 ·