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

Numpy: Run error #750

Closed
penetest opened this issue Jul 9, 2019 · 2 comments
Closed

Numpy: Run error #750

penetest opened this issue Jul 9, 2019 · 2 comments

Comments

@penetest
Copy link

penetest commented Jul 9, 2019

I try to run this code,

System.setProperty("org.bytedeco.openblas.load", "mkl");

        Py_Initialize();
        String path = null;
        try {
            path = cachePackage().getAbsolutePath();
        } catch (IOException e) {
            e.printStackTrace();
        }
        PyList_Insert(PySys_GetObject("path"), 0, PyUnicode_FromString(path));
        if (_import_array() < 0) {
            System.err.println("numpy.core.multiarray failed to import");
            PyErr_Print();
            System.exit(-1);
        }
        PyObject globals = PyModule_GetDict(PyImport_AddModule("__main__"));

        int[] dimsx = {1, 2, 2, 3, 4, 3, 5};

        PyArrayObject input = new PyArrayObject(new PointerPointer(dimsx));

        PyDict_SetItemString(globals, "x", input);
//        PyDict_SetItemString(globals, "output", out);

        PyRun_StringFlags("import numpy as np; z = np.unique(np.array(x)); print(z)", Py_single_input, globals, globals, null);
        PyObject z = PyDict_GetItemString(globals, "z");
//        IntPointer data = new IntPointer(PyArray_BYTES(z)).capacity(PyArray_Size(z));
        System.out.println("z = " + z);

but show some error:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f3be113ed50, pid=1735, tid=0x00007f3ca2ab1700
#
# JRE version: OpenJDK Runtime Environment (8.0_212-b03) (build 1.8.0_212-8u212-b03-2~deb9u1-b03)
# Java VM: OpenJDK 64-Bit Server VM (25.212-b03 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libpython3.6m.so.1.0+0xf8d50]  PyType_IsSubtype+0x0
#
# Core dump written. Default location: /data/dataflow-cpython-numpy/core or core.1735
#
# An error report file with more information is saved as:
# /data/dataflow-cpython-numpy/hs_err_pid1735.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted (core dumped)
@saudet
Copy link
Member

saudet commented Jul 9, 2019

Duplicate of #712

@saudet saudet marked this as a duplicate of #712 Jul 9, 2019
@saudet saudet closed this as completed Jul 9, 2019
@saudet
Copy link
Member

saudet commented Jul 9, 2019

Please try again with version 1.5.1. This has been fixed!

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

No branches or pull requests

2 participants