Importing pybgs crashes python runtime
Describe the bug
I have attempted to install pybgs both via pip:
pip install pybgs --force-reinstall --no-cache-dir
and from sources after cloning the repository via setup.py:
python setup.py build
python setup.py install
within a conda environment. In both cases I manage to install the library but when I attempt to import it the python runtime crashes:
$ python
Python 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:50:56)
[Clang 11.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pybgs
Fatal Python error: _PyInterpreterState_Get(): no current thread state
Python runtime state: unknown
[1] 79583 abort python
To Reproduce
Install the library, either via pip or setup.py, and attempt to import it via import pybgs.
Expected behavior
The library is expected to import without crashing the python runtime.
System information
Desktop (please complete the following information):
- OS: macOS 11.6
- Python version: 3.8.12
- OpenCV version: 3.4.7
- conda version: 4.10.3
Additional context
Building the library with CMake and running the example run_video.sh is successful. I have tried multiple different python versions, but the result is always the same.
Installed packages
# Name Version Build Channel
bzip2 1.0.8 h0d85af4_4 conda-forge
c-ares 1.17.2 h0d85af4_0 conda-forge
ca-certificates 2021.10.8 h033912b_0 conda-forge
cairo 1.16.0 he43a7df_1008 conda-forge
certifi 2021.10.8 py38h50d1736_0 conda-forge
cmake 3.19.6 h04fa861_0
cycler 0.10.0 py_2 conda-forge
expat 2.4.1 he49afe7_0 conda-forge
ffmpeg 4.1.3 h5c2b479_0 conda-forge
fontconfig 2.13.1 h10f422b_1005 conda-forge
freetype 2.10.4 h4cff582_1 conda-forge
gettext 0.19.8.1 hd1a6beb_1008 conda-forge
giflib 5.2.1 hbcb3906_2 conda-forge
gmp 6.2.1 h2e338ed_0 conda-forge
gnutls 3.6.13 h756fd2b_1 conda-forge
graphite2 1.3.13 h2e338ed_1001 conda-forge
harfbuzz 2.9.1 h159f659_1 conda-forge
hdf5 1.10.5 nompi_h500d6d3_1114 conda-forge
icu 68.1 h74dc148_0 conda-forge
imutils 0.5.4 py38h50d1736_0 conda-forge
jasper 1.900.1 h636a363_1006 conda-forge
jpeg 9d hbcb3906_0 conda-forge
kiwisolver 1.3.2 py38h12bbefe_0 conda-forge
krb5 1.19.2 h289aae4_2 conda-forge
lame 3.100 h35c211d_1001 conda-forge
lcms2 2.11 h11f7e16_1 conda-forge
libblas 3.9.0 12_osx64_openblas conda-forge
libcblas 3.9.0 12_osx64_openblas conda-forge
libcurl 7.79.1 h97da3c1_1 conda-forge
libcxx 12.0.1 habf9029_0 conda-forge
libedit 3.1.20191231 h0678c8f_2 conda-forge
libev 4.33 haf1e3a3_1 conda-forge
libffi 3.4.2 he49afe7_4 conda-forge
libgfortran 5.0.0 9_3_0_h6c81a4c_23 conda-forge
libgfortran5 9.3.0 h6c81a4c_23 conda-forge
libglib 2.70.0 hf1fb8c0_1 conda-forge
libiconv 1.16 haf1e3a3_0 conda-forge
liblapack 3.9.0 12_osx64_openblas conda-forge
liblapacke 3.9.0 12_osx64_openblas conda-forge
libnghttp2 1.43.0 hfd382f3_1 conda-forge
libopenblas 0.3.18 openmp_h3351f45_0 conda-forge
libopencv 3.4.7 py38_9 conda-forge
libpng 1.6.37 h7cec526_2 conda-forge
libssh2 1.10.0 hd3787cc_2 conda-forge
libtiff 4.1.0 ha78913b_3 conda-forge
libuv 1.42.0 h0d85af4_0 conda-forge
libwebp 1.0.2 hd3bf737_5 conda-forge
libxml2 2.9.12 h93ec3fd_0 conda-forge
libzlib 1.2.11 h9173be1_1013 conda-forge
llvm-openmp 12.0.1 hda6cdc1_1 conda-forge
lz4-c 1.9.3 he49afe7_1 conda-forge
matplotlib-base 3.4.3 py38hc7d2367_1 conda-forge
ncurses 6.2 h2e338ed_4 conda-forge
nettle 3.6 hedd7734_0 conda-forge
numpy 1.21.3 py38h49b9922_0 conda-forge
olefile 0.46 pyh9f0ad1d_1 conda-forge
opencv 3.4.7 py38_9 conda-forge
openh264 1.8.0 hd9629dc_1000 conda-forge
openssl 3.0.0 h0d85af4_1 conda-forge
pcre 8.45 he49afe7_0 conda-forge
pillow 8.1.0 py38hc1d52f7_1 conda-forge
pip 21.2.4 py38hecd8cb5_0
pixman 0.40.0 hbcb3906_0 conda-forge
py-opencv 3.4.7 py38h5ca1d4c_9 conda-forge
pybgs 3.0.0.post2 pypi_0 pypi
pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
python 3.8.12 h43ca1e7_2_cpython conda-forge
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python_abi 3.8 2_cp38 conda-forge
readline 8.1 h05e3726_0 conda-forge
rhash 1.4.1 h35c211d_0 conda-forge
scipy 1.7.1 py38hd329d04_0 conda-forge
setuptools 58.2.0 py38h50d1736_0 conda-forge
six 1.16.0 pyh6c4a22f_0 conda-forge
sqlite 3.36.0 h23a322b_2 conda-forge
tk 8.6.11 h5dbffcc_1 conda-forge
tornado 6.1 py38h96a0964_1 conda-forge
wheel 0.37.0 pyhd8ed1ab_1 conda-forge
x264 1!152.20180806 h1de35cc_0 conda-forge
xz 5.2.5 haf1e3a3_1 conda-forge
zlib 1.2.11 h9173be1_1013 conda-forge
zstd 1.4.9 h582d3a0_0 conda-forge
Hello @jnissin , Sorry for my absence, I had to put the bgslibrary in standby for a long time. I will try to reproduce your issue in my local environment. I come back to you soon as possible, Thanks Andrews
Hi, Is there any update on this? I installed pybgs on opencv 3.4.7 using pip and I am getting the same error at importing the library.
Thanks Xavi
Hello @jnissin @xavibou , sorry for my delayed feedback. I just released a new version of the BGSLibrary, now v3.1.0. I tested it on Windows, Mac and Linux, both compiling the C++ library on OpenCV 3.4.7, 3.4.16 and 4.6.0. I also tested its respective Python wrapper and GT user interface. Everything is working for me, could you please check in your side if this new version fix your issues? Thanks in advance, Andrews