I get the following error when I do a simple command a=1
(or any other command) once an Intel python3
shell is launched on a Debian 10:
Python 3.7.11 (default, Sep 9 2021, 02:06:38)
[GCC 9.3.0] :: Intel Corporation on linux
Type "help", "copyright", "credits" or "license" for more information.
Intel(R) Distribution for Python is brought to you by Intel Corporation.
Please check out: https://software.intel.com/en-us/python-distribution
(.startup.py)
(imported numpy as np)
(imported matplotlib.pyplot as plt)
(imported scipy.interpolate CubicSpline)
(imported scipy.interpolate interp1d)
(imported os)
(imported sys)
(imported glob)
(imported re)
>>> a=1
free(): invalid pointer
zsh: abort /opt/intel/oneapi/intelpython/python3.7/bin/python3.7
What is happening?
Permissions seem to be OK:
-rwxrwxr-x 1 19712 20M Sep 9 04:16 /opt/intel/oneapi/intelpython/python3.7/bin/python3.7
I don't understand.
Edit 1
A gdb on python3 allows to get more informations :
gdb python3
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python3...done.
(gdb) file python3
Load new symbol table from "python3"? (y or n) y
Reading symbols from python3...done.
(gdb) r
Starting program: /opt/intel/oneapi/intelpython/python3.7/bin/python3
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Python 3.7.11 (default, Sep 9 2021, 02:06:38)
[GCC 9.3.0] :: Intel Corporation on linux
Type "help", "copyright", "credits" or "license" for more information.
Intel(R) Distribution for Python is brought to you by Intel Corporation.
Please check out: https://software.intel.com/en-us/python-distribution
(.startup.py)
(imported numpy as np)
(imported matplotlib.pyplot as plt)
(imported scipy.interpolate CubicSpline)
(imported scipy.interpolate interp1d)
(imported os)
(imported sys)
(imported glob)
(imported re)
>>> a=1
free(): invalid pointer
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7c56535 in __GI_abort () at abort.c:79
#2 0x00007ffff7cad508 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff7db828d "%s\n")
at ../sysdeps/posix/libc_fatal.c:181
#3 0x00007ffff7cb3c1a in malloc_printerr (str=str@entry=0x7ffff7db643b "free(): invalid pointer")
at malloc.c:5341
#4 0x00007ffff7cb542c in _int_free (av=<optimized out>, p=<optimized out>, have_lock=<optimized out>)
at malloc.c:4165
#5 0x00005555555f7abd in PyOS_Readline (sys_stdin=<optimized out>,
sys_stdout=0x7ffff7df0760 <_IO_2_1_stdout_>, prompt=0x7ffff7656f20 ">>> ")
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Parser/myreadline.c:377
#6 0x0000555555704c02 in tok_nextc (tok=0x55555633ca00)
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Parser/tokenizer.c:939
#7 0x000055555572c017 in tok_get (p_end=<optimized out>, p_start=<optimized out>, tok=<optimized out>)
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Parser/tokenizer.c:1373
#8 PyTokenizer_Get (p_end=<optimized out>, p_start=<optimized out>, tok=<optimized out>)
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Parser/tokenizer.c:1835
#9 parsetok (tok=<optimized out>, g=<optimized out>, start=<optimized out>, err_ret=<optimized out>,
flags=<optimized out>) at /home/sat_bot/base/conda-bld/python_1631149597897/work/Parser/parsetok.c:208
#10 0x00005555557cd310 in PyParser_ASTFromFileObject (fp=<optimized out>, filename=0x7ffff7778530,
enc=<optimized out>, start=<optimized out>, ps1=<optimized out>, ps2=<optimized out>,
flags=0x7fffffffd860, errcode=0x7fffffffd784, arena=0x7ffff783e390)
--Type <RET> for more, q to quit, c to continue without paging--
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Python/pythonrun.c:1222
#11 0x0000555555640ee6 in PyRun_InteractiveOneObjectEx (fp=0x7ffff7defa00 <_IO_2_1_stdin_>,
filename=0x7ffff7778530, flags=0x7fffffffd860)
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Python/pythonrun.c:236
#12 0x00005555556411cc in PyRun_InteractiveLoopFlags (fp=0x7ffff7defa00 <_IO_2_1_stdin_>,
filename_str=<optimized out>, flags=0x7fffffffd860)
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Python/pythonrun.c:120
#13 0x00005555557cd85e in PyRun_AnyFileExFlags (fp=0x7ffff7defa00 <_IO_2_1_stdin_>,
filename=0x5555557ce4b8 "<stdin>", closeit=0, flags=0x7fffffffd860)
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Python/pythonrun.c:78
#14 0x00005555557cdbdc in pymain_run_file (p_cf=0x7fffffffd860, filename=<optimized out>,
fp=0x7ffff7defa00 <_IO_2_1_stdin_>)
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Modules/main.c:462
#15 pymain_run_filename (cf=0x7fffffffd860, pymain=0x7fffffffd970)
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Modules/main.c:1655
#16 pymain_run_python (pymain=0x7fffffffd970)
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Modules/main.c:2916
#17 pymain_main (pymain=0x7fffffffd970)
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Modules/main.c:3456
#18 0x00005555557cdd2c in _Py_UnixMain (argc=<optimized out>, argv=<optimized out>)
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Modules/main.c:3491
#19 0x00007ffff7c5809b in __libc_start_main (main=0x555555641820 <main>, argc=1, argv=0x7fffffffdac8,
--Type <RET> for more, q to quit, c to continue without paging--
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdab8)
at ../csu/libc-start.c:308
#20 0x0000555555733be9 in _start ()
at /home/sat_bot/base/conda-bld/python_1631149597897/work/Parser/parser.c:325
(gdb)
Are there any useful clues among all this information?
Edit 2
If I launch the shell as root, there isn't this issue:
# python3.7
Python 3.7.11 (default, Sep 9 2021, 02:06:38)
[GCC 9.3.0] :: Intel Corporation on linux
Type "help", "copyright", "credits" or "license" for more information.
Intel(R) Distribution for Python is brought to you by Intel Corporation.
Please check out: https://software.intel.com/en-us/python-distribution
(.startup.py)
(imported numpy as np)
(imported matplotlib.pyplot as plt)
(imported scipy.interpolate CubicSpline)
(imported scipy.interpolate interp1d)
(imported os)
(imported sys)
Traceback (most recent call last):
File "/root/.startup.py", line 16, in <module>
import readline
ImportError: /opt/intel/oneapi/intelpython/python3.7/lib/python3.7/site-packages/readline.cpython-37m-x86_64-linux-gnu.so: undefined symbol: tputs
>>> a=1
>>> a=np.arange(10)
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>>
Edit 3
I kept researching on this issue.
If I do, like suggested:
$ sudo python3.7
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a=range(10)
>>> a
range(0, 10)
>>>
Then, I have no errors but all libraries from ~/.startup.py
:
print("(.startup.py)")
import numpy as np
print("(imported numpy as np)")
import matplotlib.pyplot as plt
print("(imported matplotlib.pyplot as plt)")
from scipy.interpolate import CubicSpline
print("(imported scipy.interpolate CubicSpline)")
from scipy.interpolate import interp1d
print("(imported scipy.interpolate interp1d)")
import atexit
print("(imported os)")
import os
print("(imported sys)")
import sys
import readline
import rlcompleter
print("(imported glob)")
import glob
print("(imported re)")
import re
are not available.
I think the conflict comes from the fact that with $ sudo pthon3.7
, I call the binary /usr/bin/python3.7
and not /opt/intel/oneapi/intelpython/python3.7/bin/python3.7
.
How to make distinguish the two versions? or maybe how could I avoid conflicts between both?
I mention also that with /opt/intel/oneapi/intelpython/python3.7/bin/python3.7
, the python shell displays:
Python 3.7.11 (default, Sep 9 2021, 02:06:38)
[GCC 9.3.0] :: Intel Corporation on linux
That would mean that GCC-9.3.0 is installed on my system but this is not actually true: maybe this Intel python expects a gcc-9.3
which is not basically installed.
Is this a good track?