ete icon indicating copy to clipboard operation
ete copied to clipboard

ncbiquery fuzzy support not compiled when installed via pip install

Open unode opened this issue 8 years ago • 7 comments

When installing ete3 with pip, the sqlite extension required for fuzzy matching (Levenshtein module) is not compiled causing code to fail.

If this is by design (sqlite-dev not a dependency), perhaps a more graceful error message could be added. It would be useful to instruct the user on what needs to be done if the code fails to find the required library. Alternatively, the code could try to compile it on first run if not already available.

unode avatar Feb 01 '16 12:02 unode

thanks @unode, we kept this feature uncompiled on purpose, to make the whole package more portable...and because almost nobody requested the feature. But now that the anaconda ete3 package is ready, we could think of distributing with this module enabled...

jhcepas avatar Feb 01 '16 15:02 jhcepas

If anyone bumps into this error and is lost about what to do, the solution is to navigate to the folder .../ete3/ncbi_taxonomy/SQLite-Levenshtein/ and run make.

If no error appears (i.e. if all necessary dependencies are installed) it should create the necessary library and the code should no longer complain.

unode avatar May 11 '16 16:05 unode

Got this error with ete 3.1.2

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>

  File "/home/pguerin/miniconda3/envs/pylib_cbdr/lib/python3.9/site-packages/ete3/ncbi_taxonomy/ncbiquery.py", line 165, in get_fuzzy_name_translation
    _db.execute("select load_extension('%s')" % os.path.join(module_path,
sqlite3.OperationalError: /home/pguerin/miniconda3/envs/pylib_cbdr/lib/python3.9/site-packages/ete3/ncbi_taxonomy/SQLite-Levenshtein/levenshtein.sqlext.so: cannot open shared object file: No such file or directory

I applied the recommandation of @unode

ncbi.get_fuzzy_name_translation(name="Albula forsteri")
Trying fuzzy search for Albula forsteri

This is working fine now. Yet I would like a nice error message telling me to compile the missing feature.

Grelot avatar Mar 10 '21 12:03 Grelot

@unode I'm running into the same error, I tried running the make command but I get a fatal error. is there any way to install the sqlite extension so it compiles fine?

This is the summary of my issue https://www.reddit.com/r/learnpython/comments/uoefez/help_with_project_ncbi_database/

Gino091092 avatar May 13 '22 04:05 Gino091092

(base) jespinozlt2-osx:~ jespinoz$ cd /Users/jespinoz/anaconda3/envs/soothsayer_py3.9_env2/lib/python3.9/site-packages/ete3/ncbi_taxonomy/SQLite-Levenshtein/
(base) jespinozlt2-osx:SQLite-Levenshtein jespinoz$ ls
EXAMPLE  Makefile  README  src	tests
(base) jespinozlt2-osx:SQLite-Levenshtein jespinoz$ make
gcc -Wall -shared -fPIC -Isqlite3 -o levenshtein.sqlext src/levenshtein.c
src/levenshtein.c:4:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^~~~~~~~~~
1 error generated.
make: *** [levenshtein.sqlext] Error 1

jolespin avatar Nov 01 '23 19:11 jolespin