8000 Aborted (core dumped) · Issue #137 · coin-or/CyLP · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Aborted (core dumped) #137

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

Closed
cafunechen opened this issue Dec 8, 2021 · 7 comments
Closed

Aborted (core dumped) #137

cafunechen opened this issue Dec 8, 2021 · 7 comments

Comments

@cafunechen
Copy link
cafunechen commented Dec 8, 2021

Hi, i install cylp according to:
1、 conda create -n cbc python=3.7 coin-or-cbc -c conda-forge
2、conda activate cbc
3、pip install cylp

it's ok to execute “import cylp"
but when i execute the demo

import numpy as np
from cylp.cy import CyClpSimplex
from cylp.py.modeling.CyLPModel import CyLPArray

s = CyClpSimplex()

# Add variables
x = s.addVariable('x', 3)
y = s.addVariable('y', 2)

# Create coefficients and bounds
A = np.matrix([[1., 2., 0],[1., 0, 1.]])
B = np.matrix([[1., 0, 0], [0, 0, 1.]])
D = np.matrix([[1., 2.],[0, 1]])
a = CyLPArray([5, 2.5])
b = CyLPArray([4.2, 3])
x_u= CyLPArray([2., 3.5])

# Add constraints
s += A * x <= a
s += 2 <= B * x + D * y <= b
s += y >= 0
s += 1.1 <= x[1:3] <= x_u

# Set the objective function
c = CyLPArray([1., -2., 3.])
s.objective = c * x + 2 * y.sum()

# Solve using primal Simplex
s.primal()
print s.primalVariableSolution['x']

the error occurs:

7f400058c000-7f400258c000 rw-p 00000000 00:00 0
7f4002594000-7f4002598000 r--p 00000000 103:04 5817767                   ~/miniconda3/envs/cbc/lib/python3.7/site-packages/cylp/cy/CyCglCutGeneratorBase.cpython-37m-x86_64-linux-gnu.so
7f4002598000-7f400259d000 r-xp 00004000 103:04 5817767                   ~/miniconda3/envs/cbc/lib/python3.7/site-packages/cylp/cy/CyCglCutGeneratorBase.cpython-37m-x86_64-linux-gnu.so
7f400259d000-7f400259f000 r--p 00009000 103:04 5817767                   ~/miniconda3/envs/cbc/lib/python3.7/site-packages/cylp/cy/CyCglCutGeneratorBase.cpython-37m-x86_64-linux-gnu.so
7f400259f000
...
7f401f662000-7f401f669000 r--s 00000000 103:04 4196451                   /usr/lib64/gconv/gconv-modules.cache
...
7f401f669000-7f401f66a000 rw-p 00000000 00:00 0
7f401f66a000-7f401f66b000 r--p 00021000 103:04 4067138                   /usr/lib64/ld-2.17.so
7f401f66b000-7f401f66c000 rw-p 00022000 103:04 4067138                   /usr/lib64/ld-2.17.so
7f401f66c000-7f401f66d000 rw-p 00000000 00:00 0
7f401f66d000-7f401f6c8000 r--p 00000000 103:04 5812395                  ~/miniconda3/envs/cbc/bin/python3.7
7f401f6c8000-7f401f8b6000 r-xp 0005b000 103:04 5812395                   ~/miniconda3/envs/cbc/bin/python3.7
7f401f8b6000-7f401f967000 r--p 00249000 103:04 5812395                   ~/miniconda3/envs/cbc/bin/python3.7
7f401f968000-7f401f96b000 r--p 002fa000 103:04 5812395                  ~/miniconda3/envs/cbc/bin/python3.7
7f401f96b000-7f401f9d4000 rw-p 002fd000 103:04 5812395                  ~/miniconda3/envs/cbc/bin/python3.7
7f401f9d4000-7f401f9f4000 rw-p 00000000 00:00 0
7f402100b000-7f402154b000 rw-p 00000000 00:00 0                          [heap]
7ffc0599e000-7ffc059bf000 rw-p 00000000 00:00 0                          [stack]
7ffc059f4000-7ffc059f6000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted (core dumped)

i don't know what mistake has happened ,Please help me! thanks a lot

@tkralphs
Copy link
Member

I just repeated the steps and it was successful for me, though I had to make some slight modifications to get it to work. Since you don't mention having to do this, I suspect something is corrupted up in your environment. The most obvious source of problems (which I also ran into) is that it is easy to accidentally execute the wrong version of pip when in a conda environment. To be safe, you should do

python -m pip install cylp

I guess that the pip you are using must be the wrong one, since if it was the right one you would have next run into the problem that numpy must be installed manually before installing cylp. I don't have a workaround for this at the moment, although I'm sure there must be one. So you should either install numpy when creating the environment by doing

conda create -n cbc python=3.7 coin-or-cbc numpy -c conda-forge

or if the environment is already created, then do

python-m pip install numpy

If there were no errors when you installed cylp in this clean environment, then you were probably using the wrong version of pip. I don't know exactly how you were then able to import cylp, but in any case, it works fine for me once I install numpy and also use the right version of pip.

@tkralphs
Copy link
Member

Another indication that something weird is going on is that the script in the README (and the on you copied above was accidentally a Python 2 script, so if you didn't get any error when you ran it, then you ran it in Python 2 (unless you corrected this and didn't mention it). The README has now been modified to reflect all of the small glitches I ran into and that are discussed above.

@tkralphs
Copy link
Member
tkralphs commented Dec 10, 2021

@cafunechen I'm confused, since you said here that it works on Linux.

But anyway, for this current error, it looks like maybe you are mixing conda Python with the Python that comes with OS X or something. This kind of corruption is pretty common on OS X. The version of cylp getting loaded is from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cylp/ as you see in the error and this is not where a conda package installed in a conda environment should be located. You probably need to research a little more about how conda and Apple's installed Python interact to be able to debug this yourself. It's difficult for me to really tell what's going on.

It would probably work to just delete the directory /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cylp/ or uninstall cylp from within the OS X Python. But none of this is really a problem with CyLP.

@cafunechen
Copy link
Author
cafunechen commented Dec 11, 2021

bug coredum infos:

Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:21)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cylp.cy import CyClpSimplex
>>> s = CyClpSimplex()
*** Error in `python': double free or corruption (out): 0x00007fdb013f9400 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x81329)[0x7fdafdf75329]
/home/ZZZ/anaconda3/envs/cbc/lib/libstdc++.so.6(_ZNSs6assignERKSs+0x41)[0x7fdaf3e6e9a5]
/home/ZZZ/anaconda3/envs/cbc/lib/python3.7/site-packages/cylp/cy/CyClpSimplex.cpython-37m-x86_64-linux-gnu.so(_ZN11IClpSimplexC1EP7_objectPFiPvEPFiS2_iE+0x105)[0x7fdaf3c616c5]
/home/ZZZ/anaconda3/envs/cbc/lib/python3.7/site-packages/cylp/cy/CyClpSimplex.cpython-37m-x86_64-linux-gnu.so(+0x41803)[0x7fdaf3c7c803]
python(_PyObject_FastCallKeywords+0xb0)[0x7fdaff3acab0]
python(+0x191f79)[0x7fdaff3adf79]
python(_PyEval_EvalFrameDefault+0xa94)[0x7fdaff3d4074]
python(_PyEval_EvalCodeWithName+0x33d)[0x7fdaff319ccd]
python(PyEval_EvalCodeEx+0x39)[0x7fdaff31add9]
python(PyEval_EvalCode+0x1b)[0x7fdaff3f752b]
python(+0x23e5b3)[0x7fdaff45a5b3]
python(+0xdc71f)[0x7fdaff2f871f]
python(PyRun_InteractiveLoopFlags+0xed)[0x7fdaff2f88d1]
python(+0xdc970)[0x7fdaff2f8970]
python(+0x248d49)[0x7fdaff464d49]
python(_Py_UnixMain+0x3c)[0x7fdaff464e9c]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7fdafdf16555]
python(+0x1c761d)[0x7fdaff3e361d]

my environment are:
1、python ->3.7.12

2、

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
ca-certificates           2021.10.8            ha878542_0    conda-forge
coin-or-cbc               2.10.5               h9c3ff4c_6    conda-forge
coin-or-cgl               0.60.3               he7e83c3_2    conda-forge
coin-or-clp               1.17.6               h256e9bb_3    conda-forge
coin-or-osi               0.108.6              h3b589db_2    conda-forge
coin-or-utils             2.11.4               h573740c_3    conda-forge
cylp                      0.91.4                   pypi_0    pypi
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
libblas                   3.9.0           12_linux64_openblas    conda-forge
libcblas                  3.9.0           12_linux64_openblas    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 11.2.0              h1d223b6_11    conda-forge
libgfortran-ng            11.2.0              h69a702a_11    conda-forge
libgfortran5              11.2.0              h5c6108e_11    conda-forge
libgomp                   11.2.0              h1d223b6_11    conda-forge
liblapack                 3.9.0           12_linux64_openblas    conda-forge
liblapacke                3.9.0           12_linux64_openblas    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libopenblas               0.3.18          pthreads_h8fe5266_0    conda-forge
libstdcxx-ng              11.2.0              he4da1e4_11    conda-forge
libzlib                   1.2.11            h36c2ea0_1013    conda-forge
ncurses                   6.2                  h58526e2_4    conda-forge
numpy                     1.21.4           py37h31617e3_0    conda-forge
openssl                   3.0.0                h7f98852_2    conda-forge
pandas                    1.3.4                    pypi_0    pypi
pip                       21.3.1             pyhd8ed1ab_0    conda-forge
pkg-config                0.29.2            h36c2ea0_1008    conda-forge
python                    3.7.12          hf930737_100_cpython    conda-forge
python-dateutil           2.8.2                    pypi_0    pypi
python_abi                3.7                     2_cp37m    conda-forge
pytz                      2021.3                   pypi_0    pypi
readline                  8.1                  h46c0cb4_0    conda-forge
scipy                     1.7.3                    pypi_0    pypi
setuptools                59.4.0           py37h89c1867_0    conda-forge
six                       1.16.0                   pypi_0    pypi
sqlite                    3.37.0               h9cd32fc_0    conda-forge
tk                        8.6.11               h27826a3_1    conda-forge
wheel                     0.37.0             pyhd8ed1ab_1    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
zlib                      1.2.11            h36c2ea0_1013    conda-forge

3、gcc -> gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)

please offer your environment, thanks

@cafunechen
Copy link
Author
cafunechen commented Dec 13, 2021

hi,i guess the error occurs for the version of glibc compilation is inconsistent with the system version,Is there a specific version about glibc

@tkralphs
Copy link
Member

There is no specific version of libc. CyLP is built from source on OS X and Linux, so you get whatever libc version the compiler links to (OS X doesn't actually use glibc, but instead uses the LLVM libc I believe).

This is just a stab in the dark, but could you take a look at #105 and try building this commit: 875d5d5? If this fixes it, then we would have a clue.

@cafunechen
Copy link
Author
cafunechen commented Dec 14, 2021

There is no specific version of libc. CyLP is built from source on OS X and Linux, so you get whatever libc version the compiler links to (OS X doesn't actually use glibc, but instead uses the LLVM libc I believe).

This is just a stab in the dark, but could you take a look at #105 and try building this commit: 875d5d5? If this fixes it, then we would have a clue.

Please forgive my late reply for jet lag
i bulid the cylp 875d5d5,
through python setup.py install (I don't know if I misunderstood the meaning of build)and the

from cylp.cy import CyClpSimplex

occurs

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/CyLP/cylp/cy/__init__.py", line 1, in <module>
    from .CyCoinIndexedVector import CyCoinIndexedVector
ModuleNotFoundError: No module named 'cylp.cy.CyCoinIndexedVector'

Whether this version [875d5d5] is special import way in some dependency packages?
and

import cylp 

it still normal, no errors reported.
by the way ,the OS problem mentioned last time has been solved and can be used normally, thanks! but I want to use cylp on Linux, the reason I installed it on a MAC is just make sure my installation steps correctly.
I tried it on three Linux servers, maybe all three servers have the same system configuration problem as you said. To be honest, I am also very confused, and don't know how to solve, also don't know where the problem is.

At first, I thought that the CBC was not installed correctly, so I tried all of them (binary, source, coinbrew...), but when I type in CBC at the terminal, he CBC solver

Welcome to the CBC MILP Solver
Version: 2.10.5
Build Date: Nov  3 2021

CoinSolver takes input from arguments ( - switches to stdin)
Enter ? for list of commands or help
Coin:

so i guess cbc is not the cause;In my poor knowledge, I guess it's a compilation problem for our Linux system, i am not sure....

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

2 participants
0