Skip to content

Conversation

@matthewfeickert
Copy link

@matthewfeickert matthewfeickert commented Jun 28, 2023

  • Avoid warning of

Warning: Empirical distributions on disk may perform slow because GNU DBM is not available. Please install and configure gdbm library for Python for better speed.

fork preview: Binder

@matthewfeickert matthewfeickert force-pushed the feat/use-binder-config-files branch from 4daed23 to 293f212 Compare June 28, 2023 09:43
@matthewfeickert
Copy link
Author

Hm, interesting user problem in general with pyenv on a Debian-like distro:

$ /usr/bin/python3 --version
Python 3.10.6
$ /usr/bin/python3 -c 'import dbm.gnu'
$ /usr/bin/python3 -c 'import dbm.gnu; import _gdbm; print(_gdbm)'
<module '_gdbm' from '/usr/lib/python3.10/lib-dynload/_gdbm.cpython-310-x86_64-linux-gnu.so'>   
$ command -v python
/home/feickert/.pyenv/shims/python
$ python -c 'import dbm.gnu'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/feickert/.pyenv/versions/3.10.4/lib/python3.10/dbm/gnu.py", line 3, in <module>
    from _gdbm import *
ModuleNotFoundError: No module named '_gdbm'

and also in Binder

jovyan@jupyter-matthewfeickert-2dmlhep-2dpyprob-2dqojh5ws0:~$ command -v python3
/srv/conda/envs/notebook/bin/python3
jovyan@jupyter-matthewfeickert-2dmlhep-2dpyprob-2dqojh5ws0:~$ python3 --version
Python 3.7.12
jovyan@jupyter-matthewfeickert-2dmlhep-2dpyprob-2dqojh5ws0:~$ python3 -c 'import dbm; print(dbm); import dbm.gnu'
<module 'dbm' from '/srv/conda/envs/notebook/lib/python3.7/dbm/__init__.py'>
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/srv/conda/envs/notebook/lib/python3.7/dbm/gnu.py", line 3, in <module>
    from _gdbm import *
ModuleNotFoundError: No module named '_gdbm'
jovyan@jupyter-matthewfeickert-2dmlhep-2dpyprob-2dqojh5ws0:~$ ls -l /srv/conda/envs/notebook/lib/python3.7/dbm/
total 32
-rw-rw-r-- 1 jovyan jovyan 12279 Oct 26  2021 dumb.py
-rw-rw-r-- 1 jovyan jovyan    72 Oct 26  2021 gnu.py
-rw-rw-r-- 1 jovyan jovyan  5783 Oct 26  2021 __init__.py
-rw-rw-r-- 1 jovyan jovyan    70 Oct 26  2021 ndbm.py
drwxr-xr-x 2 jovyan jovyan  4096 Jun 28 09:45 __pycache__
jovyan@jupyter-matthewfeickert-2dmlhep-2dpyprob-2dqojh5ws0:~$ find /usr -type f -iname "*_gdbm*"
/usr/lib/x86_64-linux-gnu/apr-util-1/apr_dbm_gdbm-1.so
/usr/lib/python3.8/lib-dynload/_gdbm.cpython-38-x86_64-linux-gnu.so
/usr/lib/python3.6/lib-dynload/_gdbm.cpython-36m-x86_64-linux-gnu.so
/usr/lib/python3.7/lib-dynload/_gdbm.cpython-37m-x86_64-linux-gnu.so
jovyan@jupyter-matthewfeickert-2dmlhep-2dpyprob-2dqojh5ws0:~$

(so not sure why that isn't showing up)

whereas in python:3.11

$ docker run --rm -ti python:3.11 /bin/bash
root@d57162c2a374:/# python -c 'import dbm.gnu; print (dbm)'
<module 'dbm' from '/usr/local/lib/python3.11/dbm/__init__.py'>
root@d57162c2a374:/# python -c 'import _gdbm; print(_gdbm)'
<module '_gdbm' from '/usr/local/lib/python3.11/lib-dynload/_gdbm.cpython-311-x86_64-linux-gnu.so'>
root@d57162c2a374:/# find /usr -type f -iname "*_gdbm*"
/usr/lib/x86_64-linux-gnu/apr-util-1/apr_dbm_gdbm-1.so
/usr/local/lib/python3.11/lib-dynload/_gdbm.cpython-311-x86_64-linux-gnu.so
* Avoid warning of

> Warning: Empirical distributions on disk may perform slow because
> GNU DBM is not available. Please install and configure gdbm library
> for Python for better speed.

  - c.f. https://docs.python.org/3/library/dbm.html#module-dbm.gnu for
  more information on the dependence of dbm.gnu on the GNU library gdbm.
@matthewfeickert matthewfeickert force-pushed the feat/use-binder-config-files branch from 293f212 to f48f30f Compare June 28, 2023 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant