-
Notifications
You must be signed in to change notification settings - Fork 33
Build instructions
Note: PyPI and conda packages are available which can be installed without building from source. See install instructions.
When building from source, this package will download and install the native TileDB library unless the --tiledb
argument is provided or TileDB Embedded is installed in global system path.
Note: if the Numpy and Cython dependencies are not installed, pip will try to build them from source. This can take a long time and make the install appear to "hang." Pass the -v flag to pip to monitor the build process.
If you wish to use a custom version of the TileDB library and the install location is not in the compiler search path, use the --tiledb
argument to setup.py
or create a requirements.txt file that specifies the tiledb install path manually.
$ cat > tiledb_requirements.txt <<EOF
tiledb==<version> --install-option="--tiledb=<path/to/tiledb/install>"
EOF
$ pip install -r tiledb_requirements.txt
Do not forget to put the built .so / .dylib / .dll on the dynamic linker path, otherwise TileDB-Py will fail to load the shared library upon import.
TileDB-Py Build Dependencies:
- NumPy
- pybind11
- Cython < 3
- C++11 compiler
- CMake >= 3.3
TileDB-Py Runtime Dependencies:
- Numpy
Execute the following commands:
git clone https://github.com/TileDB-Inc/TileDB-Py.git
cd TileDB-Py
pip install -r requirements_dev.txt
pip install --use-pep517 --config-setting="--build-option=--tiledb=<path/to/tiledb/install>"
If you wish to use a custom version of the TileDB library and it is installed in a non-standard location, pass the path to setup.py with the --tiledb=
flag. If you want to pass extra compiler/linker flags during the C++ extension compilation step use --cxxflags=
or --lflags=
.
$ python setup.py build_ext --inplace --tiledb=/home/tiledb/dist
If TileDB is installed in a non-standard location, you also need to make the dynamic linker aware of libtiledb's location. Otherwise when importing the tiledb module you will get an error that the built extension module cannot find libtiledb's symbols:
$ env LD_LIBRARY_PATH="/home/tiledb/dist/lib:$LD_LIBRARY_PATH" python -m unittest -v
For macOS the linker environment variable is DYLD_LIBRARY_PATH
.
If you are building the extension on Windows, first install a Python distribution such as Miniconda. You can then either build TileDB from source, or download the pre-built binaries.
Once you've installed Miniconda and TileDB, open the Miniconda command prompt and execute:
cd TileDB-Py
conda install conda-build
conda install virtualenv
virtualenv venv
venv\Scripts\activate
pip install -r requirements_dev.txt
python setup.py build_ext --inplace --tiledb=C:\path\to\TileDB\
set PATH=%PATH%;C:\path\to\TileDB\bin
python -m unittest -v
Note that if you built TileDB from source, then replace C:\path\to\TileDB with C:\path\to\TileDB\dist
.
(see also https://github.com/TileDB-Inc/TileDB-Py/wiki/Debugging-tips)
The development environment may be set up with conda as follows:
# make sure you are in the base env first
(base) user@hostname:~$ conda activate base
# create a new env called new-tiledb-env (or name of your choice) with Python 3.10 (or version of your choice)
(base) user@hostname:~$ conda create -n new-tiledb-env python=3.10
# activate your new env
(base) user@hostname:~$ conda activate new-tiledb-env
# move into the the base directory of TileDB-Py
(new-tiledb-env) user@hostname:~$ cd TileDB-Py/
# install the necessary dependencies for development
(new-tiledb-env) user@hostname:~/TileDB-Py$ pip install -r misc/requirements_ci.txt
# install TileDB-Py
(new-tiledb-env) user@hostname:~/TileDB-Py$ python setup.py develop
You can run the unittests from the source folder without having the package installed. First build the package in place from the source directory:
$ python setup.py build_ext --inplace
Tests are run using Pytest:
$ python -m pytest
Doctests can be run using the doctest module:
$ python -m doctest -o NORMALIZE_WHITESPACE -f tiledb/libtiledb.pyx
You can also install a symlink named site-packages/tiledb.egg-link to the development folder of TileDB-Py with:
$ pip install --editable .
This enables local changes to the current development repo to be reflected globally.
TileDB core (libtiledb) is distributed as a separate conda package, tiledb, which may be used for local builds of TileDB-Py:
activate the desired conda environment
run conda install tiledb
run python setup.py build_ext --inplace --tiledb=$CONDA_PREFIX