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

Importing opencv fails with "ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: cannot allocate memory in static TLS block" #350

Closed
emdioh opened this issue Jul 29, 2020 · 4 comments

Comments

@emdioh
Copy link

emdioh commented Jul 29, 2020

Environment data

  • debugpy version: 1.0.0b12
  • OS and version: Ubuntu 20.04.1 LTS
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.8.2 - coming with the distro
  • Python3-Opencv version: 4.2.0+dfsg-5
  • Using VS Code or Visual Studio: VS Code

Actual behavior

Debugging scripts that import opencv2 fail to run at "import cv2" statement

$python -m debugpy --listen 1234 -c "import cv2"

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/yolo/.local/lib/python3.8/site-packages/debugpy/__main__.py", line 45, in <module>
    cli.main()
  File "/home/yolo/.local/lib/python3.8/site-packages/debugpy/server/cli.py", line 430, in main
    run()
  File "/home/yolo/.local/lib/python3.8/site-packages/debugpy/server/cli.py", line 330, in run_code
    eval(code, {})
  File "<string>", line 1, in <module>
ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: cannot allocate memory in static TLS block

Expected behavior

Import succeeds, the script can run under the debugger.

Steps to reproduce:

  1. install debugpy 1.0.0b12
  2. python -m debugpy --listen 1234 -c "import cv2"

Notes

Version 1.0.0b11 works.

@int19h
Copy link
Contributor

int19h commented Aug 12, 2020

This sounds like https://bugs.launchpad.net/ubuntu/+source/opencv/+bug/1890170 - from the various reports there, it looks like cv2 might have some conflicts with other packages employing native code?

@fabioz
Copy link
Collaborator

fabioz commented Aug 21, 2020

Since it works with a previous version and not this one, this may be the same thing as:

#356

where the environment variables in the launch appear to be different from one launch to the other due to an upgrade.

@emdioh can you run the script below in 1.0.0.b11 and 1.0.0.b12 and check if the environment variables are different from one case to the other?

import sys
print(sys.version)

import os
for key, val in sorted(os.environ.items()):
    print(key)
    for v in val.split(os.pathsep):
        print('    %s' % v)  

print('\nsys.path:')
for v in sys.path:
    print('    %s' % (v,)) 
print('\n')

@emdioh
Copy link
Author

emdioh commented Aug 24, 2020 via email

@int19h
Copy link
Contributor

int19h commented Aug 25, 2020

Sounds like we accidentally fixed it.

@int19h int19h closed this as completed Aug 25, 2020
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

3 participants