-
Notifications
You must be signed in to change notification settings - Fork 26
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
[python] Do not copy libtiledbsoma.so
into package_data
if it already exists
#1937
Conversation
package_data
if it already exists
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1937 +/- ##
==========================================
- Coverage 76.84% 71.77% -5.08%
==========================================
Files 136 101 -35
Lines 10689 6926 -3763
Branches 207 211 +4
==========================================
- Hits 8214 4971 -3243
+ Misses 2375 1853 -522
- Partials 100 102 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
package_data
if it already existslibtiledbsoma.so
into package_data
if it already exists
I tested to confirm that the git clone https://github.com/single-cell-data/TileDB-SOMA.git test-soma-copying
cd test-soma-copying
git checkout viviannguyen/do-not-cp-in-edit-mode
python -m venv ./venv-soma
source ./venv-soma/bin/activate
pip install --prefer-binary tiledb wheel
## tiledb-0.24.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
pip install --prefer-binary apis/python/requirements_dev.txt
python -c "import tiledb; print(tiledb.version())"
## (0, 24, 0)
python -c "import tiledb; print(tiledb.libtiledb.version())"
## (2, 18, 2)
cd apis/python/
python setup.py bdist_wheel
unzip -l dist/tiledbsoma-1.5.0rc0.post82.dev2249632267-cp310-cp310-linux_x86_64.whl | grep '\.so'
## 1417912 2023-12-01 15:32 tiledbsoma/libtiledbsoma.so
## 839072 2023-12-01 15:32 tiledbsoma/pytiledbsoma.cpython-310-x86_64-linux-gnu.so
ldd build/lib.linux-x86_64-cpython-310/tiledbsoma/libtiledbsoma.so | grep libtiledb
## libtiledb.so.2.18 => /home/jdblischak/test-soma-copying/dist/lib/libtiledb.so.2.18 (0x00007fdad1642000) Note however that wget https://files.pythonhosted.org/packages/6e/2b/22cbf22a6e24d1b876ddea3bae6ef730ce97a6c38ddf017b6040436f7594/tiledbsoma-1.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
unzip -l tiledbsoma-1.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | grep '\.so'
## 42973497 2023-11-13 15:17 tiledbsoma.libs/libtiledb-9844ae44.so.2.17
## 2089017 2023-11-13 15:17 tiledbsoma.libs/libtiledbsoma-a235b3e5.so
## 785249 2023-11-13 15:17 tiledbsoma/pytiledbsoma.cpython-310-x86_64-linux-gnu.so
## 1909369 2023-11-13 15:17 tiledbsoma/libtiledbsoma.so Please let me know if I need to investigate further. For now, I've confirmed that |
I tested with |
I checked the various installation methods with and without an external mkdir -p /tmp/test-soma-copy
cd /tmp/test-soma-copy
# install python dependencies
python -m venv ./venv-soma
conda deactivate
source ./venv-soma/bin/activate
pip install --prefer-binary cmake pybind11-global typeguard sparse wheel
# `pip install` copies libtiledbsoma.so
git clone https://github.com/single-cell-data/TileDB-SOMA.git pip-install
cd pip-install
git checkout viviannguyen/do-not-cp-in-edit-mode
cd apis/python
pip install .
find $VIRTUAL_ENV -name 'libtiledbsoma.so'
## /tmp/test-soma-copy/venv-soma/lib/python3.10/site-packages/tiledbsoma/libtiledbsoma.so
find $VIRTUAL_ENV -name 'libtiledbsoma.so' | xargs ldd | grep libtiledb
## libtiledb.so.2.18 => /tmp/test-soma-copy/pip-install/dist/lib/libtiledb.so.2.18 (0x00007ff9e1d0b000)
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## libtiledb=2.18.2
cd /tmp/test-soma-copy/
rm -rf pip-install/
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## OSError: libtiledbsoma.so: cannot open shared object file: No such file or directory
pip uninstall --yes tiledbsoma
# `pip install -e` copies libtiledbsoma.so
git clone https://github.com/single-cell-data/TileDB-SOMA.git pip-install-e
cd pip-install-e
git checkout viviannguyen/do-not-cp-in-edit-mode
cd apis/python
pip install -e .
find . -name 'libtiledbsoma.so'
## ./src/tiledbsoma/libtiledbsoma.so
find . -name 'libtiledbsoma.so' | xargs ldd | grep libtiledb
## libtiledb.so.2.18 => /tmp/test-soma-copy/pip-install-e/dist/lib/libtiledb.so.2.18 (0x00007fb4308a0000)
pip uninstall --yes tiledbsoma
cd /tmp/test-soma-copy/
rm -rf pip-install-e/
# bdist_wheel copies libtiledbsoma.so
git clone https://github.com/single-cell-data/TileDB-SOMA.git wheel
cd wheel
git checkout viviannguyen/do-not-cp-in-edit-mode
cd apis/python
python setup.py bdist_wheel
unzip -l dist/tiledbsoma-1.5.0rc0.post83.dev3915525106-cp310-cp310-linux_x86_64.whl | grep '\.so'
## 1417912 2023-12-04 19:50 tiledbsoma/libtiledbsoma.so
## 839072 2023-12-04 19:51 tiledbsoma/pytiledbsoma.cpython-310-x86_64-linux-gnu.so
cd /tmp/test-soma-copy/
rm -rf wheel
# install pre-built libtiledb
mkdir -p external
wget --quiet https://github.com/jdblischak/centralized-tiledb-nightlies/releases/download/2023-12-03/libtiledb-2023-12-03.tar.gz
tar -C external -xzf libtiledb-2023-12-03.tar.gz
export TILEDB_PATH=$(pwd)/external
export LD_LIBRARY_PATH=$(pwd)/external/lib:$LD_LIBRARY_PATH
# install pre-built libtiledbsoma
wget --quiet https://github.com/jdblischak/centralized-tiledb-nightlies/releases/download/2023-12-03/libtiledbsoma-2023-12-03.tar.gz
tar -C external -xzf libtiledbsoma-2023-12-03.tar.gz
export TILEDBSOMA_PATH=$(pwd)/external
# `pip install` does not copy external libtiledbsoma.so
git clone https://github.com/single-cell-data/TileDB-SOMA.git pip-install-ext
cd pip-install-ext
git checkout viviannguyen/do-not-cp-in-edit-mode
cd apis/python
pip install .
find $VIRTUAL_ENV -name 'libtiledbsoma.so'
find $VIRTUAL_ENV -name 'pytiledbsoma*\.so' | xargs ldd | grep libtiledb
## libtiledbsoma.so => /tmp/test-soma-copy/external/lib/libtiledbsoma.so (0x00007fb8a1d3e000)
## libtiledb.so.2.18 => /tmp/test-soma-copy/external/lib/libtiledb.so.2.18 (0x00007fb89f782000)
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## libtiledb=2.18.0
cd /tmp/test-soma-copy/
rm -rf pip-install-ext/
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## libtiledb=2.18.0
pip uninstall --yes tiledbsoma
# `pip install -e` does not copy external libtiledbsoma.so
git clone https://github.com/single-cell-data/TileDB-SOMA.git pip-install-e-ext
cd pip-install-e-ext
git checkout viviannguyen/do-not-cp-in-edit-mode
cd apis/python
pip install -e .
find . -name 'libtiledbsoma.so'
find . -name 'pytiledbsoma*.so' | xargs ldd | grep libtiledb
## libtiledbsoma.so => /tmp/test-soma-copy/external/lib/libtiledbsoma.so (0x00007f3e88dbd000)
## libtiledb.so.2.18 => /tmp/test-soma-copy/external/lib/libtiledb.so.2.18 (0x00007f3e86801000)
pip uninstall --yes tiledbsoma
cd /tmp/test-soma-copy/
rm -rf pip-install-e-ext/
# bdist_wheel does not copy external libtiledbsoma.so
git clone https://github.com/single-cell-data/TileDB-SOMA.git wheel-ext
cd wheel-ext
git checkout viviannguyen/do-not-cp-in-edit-mode
cd apis/python
python setup.py bdist_wheel
unzip -l dist/tiledbsoma-1.5.0rc0.post83.dev3915525106-cp310-cp310-linux_x86_64.whl | grep '\.so'
## 839072 2023-12-04 20:05 tiledbsoma/pytiledbsoma.cpython-310-x86_64-linux-gnu.so
cd /tmp/test-soma-copy/
rm -rf wheel-ext
# `setup.py install --single-version-externally-managed` does not copy external libtiledbsoma.so
# https://github.com/TileDB-Inc/tiledbsoma-feedstock/blob/4175b10522b7f6e1ac8687b9ab729224b85896a4/recipe/build-tiledbsoma-py.sh#L8
git clone https://github.com/single-cell-data/TileDB-SOMA.git single-version
cd single-version
git checkout viviannguyen/do-not-cp-in-edit-mode
cd apis/python
python setup.py install --single-version-externally-managed --record record.txt
find $VIRTUAL_ENV -name 'libtiledbsoma.so'
find $VIRTUAL_ENV -name 'pytiledbsoma*\.so' | xargs ldd | grep libtiledb
## libtiledbsoma.so => /tmp/test-soma-copy/external/lib/libtiledbsoma.so (0x00007f12ef483000)
## libtiledb.so.2.18 => /tmp/test-soma-copy/external/lib/libtiledb.so.2.18 (0x00007f12ecec7000)
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## libtiledb=2.18.0
cd /tmp/test-soma-copy/
rm -rf single-version
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## libtiledb=2.18.0
pip uninstall --yes tiledbsoma |
However, while we are on the subject of copying shared objects, I am confused by the behavior for copying # continuing from above
# `pip install` does not copy needed libtiledb.so
unset LD_LIBRARY_PATH
unset TILEDB_PATH
unset TILEDBSOMA_PATH
git clone https://github.com/single-cell-data/TileDB-SOMA.git main
cd main
cd apis/python
pip install .
find $VIRTUAL_ENV -name '*tile*.so'
## /tmp/test-soma-copy/venv-soma/lib/python3.10/site-packages/tiledbsoma/libtiledbsoma.so
## /tmp/test-soma-copy/venv-soma/lib/python3.10/site-packages/tiledbsoma/pytiledbsoma.cpython-310-x86_64-linux-gnu.so
## /tmp/test-soma-copy/venv-soma/lib/python3.10/site-packages/tiledb/libtiledb.cpython-310-x86_64-linux-gnu.so
find $VIRTUAL_ENV -name 'libtiledbsoma.so' | xargs ldd | grep libtiledb
## libtiledb.so.2.18 => /tmp/test-soma-copy/main/dist/lib/libtiledb.so.2.18 (0x00007f682fa5a000)
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## libtiledb=2.18.2
cd /tmp/test-soma-copy/
rm -rf main/
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## OSError: libtiledbsoma.so: cannot open shared object file: No such file or directory
pip uninstall --yes tiledbsoma |
I'll go ahead and add to this PR copying |
a39d3c6
to
8f8d1ec
Compare
I made the changes but will need to follow up again tomorrow or early next week with tests so that the |
I'll also plan on re-running my tests. Thanks! |
450dfc1
to
4a2a06f
Compare
Alright got the codecov tests passing. |
I tested this morning from the latest commit. mkdir -p /tmp/test-soma-copy
cd /tmp/test-soma-copy
# install python dependencies
python -m venv ./venv-soma
conda deactivate
source ./venv-soma/bin/activate
pip install --prefer-binary cmake pybind11-global typeguard sparse wheel
# `pip install` copies libtiledbsoma.so but not libtiledb.so
git clone https://github.com/single-cell-data/TileDB-SOMA.git pip-install
cd pip-install
git checkout viviannguyen/do-not-cp-in-edit-mode
cd apis/python
pip install .
find $VIRTUAL_ENV -name 'libtiledb.so'
find $VIRTUAL_ENV -name 'libtiledbsoma.so'
## /tmp/test-soma-copy/venv-soma/lib/python3.10/site-packages/tiledbsoma/libtiledbsoma.so
find $VIRTUAL_ENV -name 'libtiledbsoma.so' | xargs ldd | grep libtiledb
## libtiledb.so.2.18 => /tmp/test-soma-copy/pip-install/dist/lib/libtiledb.so.2.18 (0x00007f83b0dda000)
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## libtiledb=2.18.2
cd /tmp/test-soma-copy/
rm -rf pip-install/
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## OSError: libtiledbsoma.so: cannot open shared object file: No such file or directory |
4a2a06f
to
0e2e71c
Compare
Yeah I was only copying |
Now mkdir -p /tmp/test-soma-copy
cd /tmp/test-soma-copy
# install python dependencies
python -m venv ./venv-soma
conda deactivate
source ./venv-soma/bin/activate
pip install --prefer-binary cmake pybind11-global typeguard sparse wheel
# `pip install` copies libtiledbsoma.so and libtiledb.so but the linking is wrong
git clone https://github.com/single-cell-data/TileDB-SOMA.git pip-install
cd pip-install
git checkout viviannguyen/do-not-cp-in-edit-mode
cd apis/python
pip install .
find $VIRTUAL_ENV -name 'libtiledb.so*'
## /tmp/test-soma-copy/venv-soma/lib/python3.10/site-packages/tiledbsoma/libtiledb.so
## /tmp/test-soma-copy/venv-soma/lib/python3.10/site-packages/tiledbsoma/libtiledb.so.2.18
find $VIRTUAL_ENV -name 'libtiledbsoma.so*'
## /tmp/test-soma-copy/venv-soma/lib/python3.10/site-packages/tiledbsoma/libtiledbsoma.so
find $VIRTUAL_ENV -name 'libtiledbsoma.so*' | xargs ldd | grep libtiledb
## libtiledb.so.2.18 => /tmp/test-soma-copy/pip-install/dist/lib/libtiledb.so.2.18 (0x00007f0e9481c000)
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## libtiledb=2.18.2
cd /tmp/test-soma-copy/
rm -rf pip-install/
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## OSError: libtiledbsoma.so: cannot open shared object file: No such file or directory
find $VIRTUAL_ENV -name 'libtiledbsoma.so*' | xargs ldd | grep libtiledb
## libtiledb.so.2.18 => not found |
@nguyenv given the complexity of this copying behavior, do you think it would be worthwhile for me to write a GitHub Actions workflow to confirm this copying behavior? |
Yes I think that would be worthwhile. Thank you so much for doing that. I will see how to get libtiledbsoma to point to the correct libtiledb. |
Sorry I haven't put the pipeline together yet. I have been busy working on VCF stuff. I see that this PR has been linked to other Issues, so I quickly re-ran my test above. According to mkdir -p /tmp/test-soma-copy
cd /tmp/test-soma-copy
# install python dependencies
python -m venv ./venv-soma
conda deactivate
source ./venv-soma/bin/activate
pip install --prefer-binary cmake pybind11-global typeguard sparse wheel
# `pip install` copies libtiledbsoma.so and libtiledb.so
git clone https://github.com/single-cell-data/TileDB-SOMA.git pip-install
cd pip-install
git checkout viviannguyen/do-not-cp-in-edit-mode
cd apis/python
pip install .
find $VIRTUAL_ENV -name 'libtiledb.so*'
## /tmp/test-soma-copy/venv-soma/lib/python3.10/site-packages/tiledbsoma/libtiledb.so
## /tmp/test-soma-copy/venv-soma/lib/python3.10/site-packages/tiledbsoma/libtiledb.so.2.18
find $VIRTUAL_ENV -name 'libtiledbsoma.so*'
## /tmp/test-soma-copy/venv-soma/lib/python3.10/site-packages/tiledbsoma/libtiledbsoma.so
find $VIRTUAL_ENV -name 'libtiledbsoma.so*' | xargs ldd | grep libtiledb
## libtiledb.so.2.18 => /tmp/test-soma-copy/pip-install/dist/lib/libtiledb.so.2.18 (0x00007f7498eec000)
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## libtiledb=2.18.2
cd /tmp/test-soma-copy/
rm -rf pip-install/
python -c "import tiledbsoma; print(tiledbsoma.pytiledbsoma.version())"
## libtiledb=2.18.2
find $VIRTUAL_ENV -name 'libtiledbsoma.so*' | xargs ldd | grep libtiledb
## libtiledb.so.2.18 => not found
ldd $VIRTUAL_ENV/lib/python3.10/site-packages/tiledbsoma/pytiledbsoma.cpython-310-x86_64-linux-gnu.so | grep tile
## libtiledbsoma.so => not found |
Yeah it's finding it via |
Thanks for approving @jdblischak. Looks like I need someone else to approve the PR before I can merge though. |
Today I confirmed that the nightly builds in my centralized-tiledb-nightlies no longer create the unnecessary Also note that I started reporting the readelf -d apis/python/src/tiledbsoma/pytiledbsoma.*.so | grep R*PATH
## 0x000000000000001d (RUNPATH) Library runpath:
## [
## /opt/hostedtoolcache/Python/3.11.8/x64/lib:
## /home/runner/work/centralized-tiledb-nightlies/centralized-tiledb-nightlies/install-libtiledbsoma/lib:
## /home/runner/work/centralized-tiledb-nightlies/centralized-tiledb-nightlies/install-libtiledb/lib:
## /home/runner/work/centralized-tiledb-nightlies/centralized-tiledb-nightlies/install-libtiledbsoma/lib/x86_64-linux-gnu:
## /home/runner/work/centralized-tiledb-nightlies/centralized-tiledb-nightlies/install-libtiledbsoma/lib64:
## /home/runner/work/centralized-tiledb-nightlies/centralized-tiledb-nightlies/install-libtiledb/lib/x86_64-linux-gnu:
## /home/runner/work/centralized-tiledb-nightlies/centralized-tiledb-nightlies/install-libtiledb/lib64
## ] |
…eady exists (#1937) * Do not copy libtiledbsoma.so into package_data if it already exists * Add except ImportError * Copy TileDB shared object library if built from source * Format * Move load lib into __init__.py * Imports * Ignore __imit__.py * Also install and copy `libtiledb.so` * Set TileDB Path Location in `bld` Script * Need to also load tiledb shared object * Rebase on main * Remove `libtiledb.so` load * Update with more descriptive names * Add workflow to test Python shared object copying --------- Co-authored-by: John Blischak <jdblischak@gmail.com>
…eady exists (#1937) (#2163) * Do not copy libtiledbsoma.so into package_data if it already exists * Add except ImportError * Copy TileDB shared object library if built from source * Format * Move load lib into __init__.py * Imports * Ignore __imit__.py * Also install and copy `libtiledb.so` * Set TileDB Path Location in `bld` Script * Need to also load tiledb shared object * Rebase on main * Remove `libtiledb.so` load * Update with more descriptive names * Add workflow to test Python shared object copying --------- Co-authored-by: nguyenv <vivian@tiledb.com> Co-authored-by: John Blischak <jdblischak@gmail.com>
Issue and/or context:
Changes: