0

When importing a ".so" library (platform linux) I am getting different results between jupyterlab and ipython.

Inside jupyterlab:

 import poly2cart as pc
 ---------------------------------------------------------------------------
 ImportError                               Traceback (most recent call last)
 <ipython-input-2-da886bba5df7> in <module>
 ----> 1 import poly2cart as pc

 ImportError: dlopen: cannot load any more object with static TLS

but it loads without any problems in ipython:

Python 3.6.5 (default, Jun 21 2022, 15:30:47)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.3 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import poly2cart as ps
In [2]:

what I have checked in jupyterlab:

  from platform import python_version
  print(python_version())
  3.6.5

So both are using the same python. Furthermore, this library was created using f2py shipped with the same version. How can this issue be resolved?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
wander95
  • 1,298
  • 1
  • 15
  • 22
  • 1
    Are you sure they are using the same kernel? Doubtful you have two Python 3.6.5 installations on your computer, but it is possible – OneCricketeer Jun 29 '22 at 21:16
  • 1
    there is only one 3.6.5 kernel on this system – wander95 Jun 29 '22 at 21:17
  • 1
    Do you have both open at the same time? `cannot load any more` seems oddly specific. Maybe try closing ipython session and restart the Juptyer kernel – OneCricketeer Jun 29 '22 at 21:18
  • 1
    I'd compare sys.executable (to look for venvs) and compare sys.path in both environments. – creanion Jun 29 '22 at 21:18
  • I just checked sys.executable is the same – wander95 Jun 29 '22 at 21:20
  • also restarted jupyter; didn't help – wander95 Jun 29 '22 at 21:22
  • My suspicion is that jupyterlab is picking something else from the path that ipython does not – wander95 Jun 29 '22 at 21:25
  • See similar questions https://stackoverflow.com/questions/40270183/importerror-dlopen-cannot-load-any-more-object-with-static-tls It seems like it's a conflict between different modules. And in jupyter something else has already been imported. So the set of loaded modules i different (check sys.modules?) – creanion Jun 29 '22 at 21:27

1 Answers1

1

For those encountering this problem, I was able to solve this by compiling the module with the system compilers instead of the ones I used

wander95
  • 1,298
  • 1
  • 15
  • 22
  • Can you clarify "system compilers"? What "ones" where you using? – OneCricketeer Jun 29 '22 at 22:41
  • 1
    The system compilers were gcc 4.x when the os was installed. The "ones" I was using were the latest intel ones. While this is not the perfect solution, but it worked – wander95 Jun 29 '22 at 22:52