conda-forge / sqlite-feedstock

A conda-smithy repository for sqlite.
BSD 3-Clause "New" or "Revised" License
2 stars 38 forks source link

ImportError: libsqlite3.so.0: cannot open shared object file: No such file or directory #107

Closed zoobab closed 3 months ago

zoobab commented 4 months ago

Solution to issue cannot be found in the documentation.

Issue

I am using pysqlite3==0.4.6 in a conda environment.

I have the issue that some code coverage python tool does not find the lib in a conda environment:

$ coverage erase
Traceback (most recent call last):
  File "/opt/conda/bin/coverage", line 5, in <module>
    from coverage.cmdline import main
  File "/opt/conda/lib/python3.11/site-packages/coverage/__init__.py", line [24](https://gitlab.res.sys.shared.fortis/AAIW/light-industrialisation/postgres_backup_job/-/jobs/2033987#L24), in <module>
    from coverage.control import (
  File "/opt/conda/lib/python3.11/site-packages/coverage/control.py", line 29, in <module>
    from coverage.collector import Collector, HAS_CTRACER
  File "/opt/conda/lib/python3.11/site-packages/coverage/collector.py", line 20, in <module>
    from coverage.data import CoverageData
  File "/opt/conda/lib/python3.11/site-packages/coverage/data.py", line [25](https://gitlab.res.sys.shared.fortis/AAIW/light-industrialisation/postgres_backup_job/-/jobs/2033987#L25), in <module>
    from coverage.sqldata import CoverageData
  File "/opt/conda/lib/python3.11/site-packages/coverage/sqldata.py", line 16, in <module>
    import sqlite3
  File "/opt/conda/lib/python3.11/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/opt/conda/lib/python3.11/sqlite3/dbapi2.py", line [27](https://gitlab.res.sys.shared.fortis/AAIW/light-industrialisation/postgres_backup_job/-/jobs/2033987#L27), in <module>
    from _sqlite3 import *
ImportError: libsqlite3.so.0: cannot open shared object file: No such file or directory

If I change the LD_LIBRARY_PATH to this it works:

ENV LD_LIBRARY_PATH="/opt/conda/pkgs/libsqlite-3.45.2-h2797004_0/lib/:$LD_LIBRARY_PATH"

It's a bit ugly because I would have expected that by changing the LD_LIBRARY_PATH to ""/opt/conda/lib" it would work, but no.

A symlink fix would solve the issue maybe?

Installed packages

(base) mambauser@8d9384dc7d5b:/tmp$ micromamba list
List of packages in environment: "/opt/conda"

  Name              Version       Build               Channel           
──────────────────────────────────────────────────────────────────────────
  _libgcc_mutex     0.1           conda_forge         conda-forge       
  _openmp_mutex     4.5           2_gnu               conda-forge       
  bzip2             1.0.8         h7b6447c_0          anaconda-pkgs-main
  ca-certificates   2023.08.22    h06a4308_0          anaconda-pkgs-main
  expat             2.5.0         h6a678d5_0          anaconda-pkgs-main
  icu               73.2          h59595ed_0          conda-forge       
  keyutils          1.6.1         h166bdaf_0          conda-forge       
  krb5              1.21.3        h659f571_0          conda-forge       
  ld_impl_linux-64  2.38          h1181459_1          anaconda-pkgs-main
  libedit           3.1.20191231  he28a2e2_2          conda-forge       
  libffi            3.4.4         h6a678d5_0          anaconda-pkgs-main
  libgcc-ng         14.1.0        h77fa898_0          conda-forge       
  libgomp           14.1.0        h77fa898_0          conda-forge       
  libiconv          1.17          hd590300_2          conda-forge       
  libnsl            2.0.1         hd590300_0          conda-forge       
  libpq             16.3          ha72fbe1_0          conda-forge       
  libsqlite         3.45.2        h2797004_0          conda-forge       
  libstdcxx-ng      14.1.0        hc0a3c3a_0          conda-forge       
  libuuid           2.38.1        h0b41bf4_0          conda-forge       
  libxml2           2.12.7        hc051c1a_1          conda-forge       
  libzlib           1.3.1         h4ab18f5_1          conda-forge       
  ncurses           6.4           h6a678d5_0          anaconda-pkgs-main
  openssl           3.3.1         h4ab18f5_1          conda-forge       
  pip               24.0          pyhd8ed1ab_0        conda-forge       
  postgresql        16.3          h8e811e2_0          conda-forge       
  pysqlite3         0.4.6         pyh911a504_0        conda-forge       
  python            3.11.0        he550d4f_1_cpython  conda-forge       
  readline          8.2           h5eee18b_0          anaconda-pkgs-main
  setuptools        70.1.1        pyhd8ed1ab_0        conda-forge       
  sqlite            3.45.2        h2c6b66d_0          conda-forge       
  tk                8.6.13        noxft_h4845f30_101  conda-forge       
  tzcode            2024a         h3f72095_0          conda-forge       
  tzdata            2023c         h04d1e81_0          anaconda-pkgs-main
  wheel             0.37.1        pyhd3eb1b0_0        anaconda-pkgs-main
  xz                5.4.2         h5eee18b_0          anaconda-pkgs-main
  zlib              1.3.1         h4ab18f5_1          conda-forge

Environment info

(base) mambauser@8d9384dc7d5b:/tmp$ micromamba info

                                           __
          __  ______ ___  ____ _____ ___  / /_  ____ _
         / / / / __ `__ \/ __ `/ __ `__ \/ __ \/ __ `/
        / /_/ / / / / / / /_/ / / / / / / /_/ / /_/ /
       / .___/_/ /_/ /_/\__,_/_/ /_/ /_/_.___/\__,_/
      /_/

            environment : base (active)
           env location : /opt/conda
      user config files : /home/mambauser/.mambarc
 populated config files : /opt/conda/.condarc
                          /opt/conda/.condarc
       libmamba version : 1.4.3
     micromamba version : 1.4.3
           curl version : libcurl/7.88.1 OpenSSL/3.1.0 zlib/1.2.13 zstd/1.5.2 libssh2/1.10.0 nghttp2/1.52.0
     libarchive version : libarchive 3.6.2 zlib/1.2.13 bz2lib/1.0.8 libzstd/1.5.2
       virtual packages : __unix=0=0
                          __linux=3.10.0=0
                          __glibc=2.31=0
                          __archspec=1=x86_64
               channels : https://mycompany.com/artifactory/api/conda/anaconda-pkgs-main/linux-64
                          https://mycompany.com/artifactory/api/conda/anaconda-pkgs-main/noarch
                          https://mycompany.com/artifactory/api/conda/conda-forge/linux-64
                          https://mycompany.com/artifactory/api/conda/conda-forge/noarch
       base environment : /opt/conda
               platform : linux-64
hmaarrfk commented 3 months ago

You are mixing the default channel and conda-forge.

This is not supported.

I'm working on instructions to help with this: https://github.com/conda-forge/conda-forge.github.io/pull/2107

Try to follow those then re-open the issue if you can create a clean environment with only "conda-forge" and it still occurs.