IBCNServices / GENDIS

Contains an implementation (sklearn API) of the algorithm proposed in "GENDIS: GEnetic DIscovery of Shapelets" and code to reproduce all experiments.
Other
102 stars 26 forks source link

Installation problems with up-to-date libraries #19

Open aendrs opened 2 years ago

aendrs commented 2 years ago

Is this package still supported? It seems that the requirements in the installation procedure are outdated and interfere with an up-to-date environment, making the installation difficult and inconvenient in a regular situation.

GillesVandewiele commented 2 years ago

Hi,

The requirements.txt was generated with version numbers that were the latest at that time. I think most of these dependencies are backward compatible and you could just install the latest version and the code should still work. If not, you can post any issues here and we can look into it

aendrs commented 2 years ago

Hi Gilles, thanks for your answer. I have been doing some experiments with diverse anaconda environments in order to find the best way to install it. It seems that installing it in a fresh environment following the suggested way (cloning the reporitory and doing pip install -r requirements.txt) causes some packages to be forcefully frozen in the required versions, something which prevents the installation of new packages, updated versions, or other software such as Spyder (it always finds requirement problems )

Something interesting that happened when I tried to install it in other ways is that the function gendis.GeneticExtractor no longer accepts the argument location, and the results of a basic task are worse than when it is installed in the suggested way (and setting location=True of course). So I think that's not the best installation alternative.

Is there a way to install it in the original way but not have the package versions as hard requirements? Or what do you suggest? Thanks again, cheers.

GillesVandewiele commented 2 years ago

Hi @aendrs

It could indeed be that the version deployed to PyPi (which is the one you'd obtain when running pip install gendis) does not yet contain the location keyword. What I'd suggest is the following:

  1. Install latest versions of our dependencies (numpy, scikit-learn, deap, pandas are the most significant).
  2. Clone the repo
  3. Run python setup.py develop --no-deps

This should add the gendis repo to your dist-packages such that you can import it from anywhere in your environment. The import statements in the gendis code itself will then make use of the latest versions of these dependencies.

aendrs commented 2 years ago

Hi Gilles, thanks for the suggestion. I will try to create a new environment and set it up as you suggest, it seems to be what I need to avoid internal conflicts.

GillesVandewiele commented 2 years ago

Feel free to do a pip freeze of your environment once you set it up correctly, such that I can update requirements.txt accordingly (I do not use virtual environments so rather hard to make a good update).

aendrs commented 2 years ago

Hi Gilles, after some months doing other projects and using a previously installed Gendis version in an isolated environment I decided to properly install it in a new environment. I did what you suggest, cloning the environment and installing it with : python setup.py develop --no-deps, however I ended up with the same problem of not having the option location in GeneticExtractor

genetic_extractor = GeneticExtractor(verbose=True, population_size=50, iterations=100, plot=None,location=True)
Traceback (most recent call last):

  Input In [12] in <cell line: 1>
    genetic_extractor = GeneticExtractor(verbose=True, population_size=50, iterations=100, plot=None,location=True)

TypeError: __init__() got an unexpected keyword argument 'location'

What do you suggest? by the way, this is the output of the installation command:


amendez@onuava:~/Documents/clonedrepos/GENDIS$ python setup.py develop --no-deps
running develop
/usr/local/anaconda3/envs/gendis2/lib/python3.8/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/usr/local/anaconda3/envs/gendis2/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running egg_info
creating GENDIS.egg-info
writing GENDIS.egg-info/PKG-INFO
writing dependency_links to GENDIS.egg-info/dependency_links.txt
writing requirements to GENDIS.egg-info/requires.txt
writing top-level names to GENDIS.egg-info/top_level.txt
writing manifest file 'GENDIS.egg-info/SOURCES.txt'
reading manifest file 'GENDIS.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'GENDIS.egg-info/SOURCES.txt'
running build_ext
building 'gendis.pairwise_dist' extension
creating build
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/gendis
gcc -pthread -B /usr/local/anaconda3/envs/gendis2/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/anaconda3/envs/gendis2/lib/python3.8/site-packages/numpy/core/include -I/usr/local/anaconda3/envs/gendis2/include/python3.8 -I/usr/local/anaconda3/envs/gendis2/include/python3.8 -c gendis/pairwise_dist.c -o build/temp.linux-x86_64-3.8/gendis/pairwise_dist.o
In file included from /usr/local/anaconda3/envs/gendis2/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1969,
                 from /usr/local/anaconda3/envs/gendis2/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                 from /usr/local/anaconda3/envs/gendis2/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from gendis/pairwise_dist.c:611:
/usr/local/anaconda3/envs/gendis2/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
   17 | #warning "Using deprecated NumPy API, disable it with " \
      |  ^~~~~~~
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/gendis
gcc -pthread -shared -B /usr/local/anaconda3/envs/gendis2/compiler_compat -L/usr/local/anaconda3/envs/gendis2/lib -Wl,-rpath=/usr/local/anaconda3/envs/gendis2/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.8/gendis/pairwise_dist.o -o build/lib.linux-x86_64-3.8/gendis/pairwise_dist.cpython-38-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-3.8/gendis/pairwise_dist.cpython-38-x86_64-linux-gnu.so -> gendis
Creating /usr/local/anaconda3/envs/gendis2/lib/python3.8/site-packages/GENDIS.egg-link (link to .)
Adding GENDIS 1.0.13 to easy-install.pth file

Installed /home/amendez/Documents/clonedrepos/GENDIS
GillesVandewiele commented 2 years ago

Strange indeed 🤔. If you are in a virtual environment, you can probably run python setup.py install --no-deps instead. Also perhaps run pip uninstall gendis as it might be conflicting with a globally installed package. If nothing else works, you could try manually adding the path to gendis to your system path (sys.path.append("PATH_TO_GENDIS"))