From 530f8f9e91002faad01bb32ba82e106353c14a15 Mon Sep 17 00:00:00 2001 From: Keisuke OGAKI Date: Sun, 15 Oct 2023 23:45:53 +0900 Subject: [PATCH] Fix some dependencies for easy installation (#47) * :art: lessen dependencies * :fire: remove py3.5 tests * texmex-python as extra package * cannot installed with python3.10 --------- Co-authored-by: Keisuke Ogaki --- .github/workflows/test.yml | 2 +- README.md | 2 ++ pqkmeans/evaluation.py | 5 ++++- requirements.txt | 5 ++--- setup.py | 3 +++ 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index edd2b0c..6146d03 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: max-parallel: 3 matrix: platform: [ubuntu-latest] - python-version: [3.5, 3.7, 3.8, 3.9] + python-version: ["3.7", "3.8", "3.9"] steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index fbc51a4..b922c3d 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ python setup.py install ``` +# evaluation needs extra texmex package +pip install pqkmeans[texmex] # with artificial data python bin/run_experiment.py --dataset artificial --algorithm bkmeans pqkmeans --k 100 # with texmex dataset (http://corpus-texmex.irisa.fr/) diff --git a/pqkmeans/evaluation.py b/pqkmeans/evaluation.py index e91d7a7..1c573e9 100644 --- a/pqkmeans/evaluation.py +++ b/pqkmeans/evaluation.py @@ -3,7 +3,6 @@ import os import six.moves.urllib import tarfile -import texmex_python def get_gmm_random_dataset(k, dimension=100, test_size=5000, train_size=500): @@ -39,6 +38,10 @@ def get_sift1m_dataset(cache_directory="."): def get_texmex_dataset(url, filename, member_names, cache_directory="."): + try: + import texmex_python + except ImportError: + raise ImportError("Missing optional dependency 'texmex_python'. You must install it to use this dataset.") path = os.path.join(cache_directory, filename) if not os.path.exists(path): print("downloading {}".format(url)) diff --git a/requirements.txt b/requirements.txt index 29656d8..53751e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ -numpy +numpy<1.21 scikit-learn -pipe +pipe<2.0 scipy six -texmex_python==1.0.0 diff --git a/setup.py b/setup.py index 953ed25..97b7ca4 100644 --- a/setup.py +++ b/setup.py @@ -92,4 +92,7 @@ def build_extension(self, ext): cmdclass=dict(build_ext=CMakeBuild), test_suite='test', zip_safe=False, + extras_require={ + "texmex": ["texmex-python>=1.0.0"], + }, )