keiserlab / e3fp

3D molecular fingerprints
GNU Lesser General Public License v3.0
121 stars 33 forks source link

python 3.7 #37

Closed martinobertoni closed 4 years ago

martinobertoni commented 5 years ago

installing in a python 3.7 environment is problematic.

Via pip, building wheel fails:

Building wheels for collected packages: e3fp
  Building wheel for e3fp (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/miniconda3/envs/py37/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fj7rvp3z/e3fp/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fj7rvp3z/e3fp/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-ixpeokg7 --python-tag cp37
       cwd: /tmp/pip-install-fj7rvp3z/e3fp/
  Complete output (172 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.7
  creating build/lib.linux-x86_64-3.7/e3fp
  copying e3fp/__init__.py -> build/lib.linux-x86_64-3.7/e3fp
  copying e3fp/pipeline.py -> build/lib.linux-x86_64-3.7/e3fp
  creating build/lib.linux-x86_64-3.7/e3fp/config
  copying e3fp/config/__init__.py -> build/lib.linux-x86_64-3.7/e3fp/config
  copying e3fp/config/params.py -> build/lib.linux-x86_64-3.7/e3fp/config
  creating build/lib.linux-x86_64-3.7/e3fp/conformer
  copying e3fp/conformer/__init__.py -> build/lib.linux-x86_64-3.7/e3fp/conformer
  copying e3fp/conformer/util.py -> build/lib.linux-x86_64-3.7/e3fp/conformer
  copying e3fp/conformer/generate.py -> build/lib.linux-x86_64-3.7/e3fp/conformer
  copying e3fp/conformer/generator.py -> build/lib.linux-x86_64-3.7/e3fp/conformer
  copying e3fp/conformer/protonation.py -> build/lib.linux-x86_64-3.7/e3fp/conformer
  creating build/lib.linux-x86_64-3.7/e3fp/fingerprint
  copying e3fp/fingerprint/db.py -> build/lib.linux-x86_64-3.7/e3fp/fingerprint
  copying e3fp/fingerprint/array_ops.py -> build/lib.linux-x86_64-3.7/e3fp/fingerprint
  copying e3fp/fingerprint/fprint.py -> build/lib.linux-x86_64-3.7/e3fp/fingerprint
  copying e3fp/fingerprint/__init__.py -> build/lib.linux-x86_64-3.7/e3fp/fingerprint
  copying e3fp/fingerprint/structs.py -> build/lib.linux-x86_64-3.7/e3fp/fingerprint
  copying e3fp/fingerprint/fprinter.py -> build/lib.linux-x86_64-3.7/e3fp/fingerprint
  copying e3fp/fingerprint/generate.py -> build/lib.linux-x86_64-3.7/e3fp/fingerprint
  creating build/lib.linux-x86_64-3.7/e3fp/test
  copying e3fp/test/test_fprint_db.py -> build/lib.linux-x86_64-3.7/e3fp/test
  copying e3fp/test/__init__.py -> build/lib.linux-x86_64-3.7/e3fp/test
  copying e3fp/test/test_metrics.py -> build/lib.linux-x86_64-3.7/e3fp/test
  copying e3fp/test/test_conformer.py -> build/lib.linux-x86_64-3.7/e3fp/test
  copying e3fp/test/test_config.py -> build/lib.linux-x86_64-3.7/e3fp/test
  copying e3fp/test/test_dependencies.py -> build/lib.linux-x86_64-3.7/e3fp/test
  copying e3fp/test/test_struct.py -> build/lib.linux-x86_64-3.7/e3fp/test
  copying e3fp/test/test_fingerprinting.py -> build/lib.linux-x86_64-3.7/e3fp/test
  copying e3fp/test/test_pipeline.py -> build/lib.linux-x86_64-3.7/e3fp/test
  copying e3fp/test/test_fingerprint.py -> build/lib.linux-x86_64-3.7/e3fp/test
  running egg_info
  writing e3fp.egg-info/PKG-INFO
  writing dependency_links to e3fp.egg-info/dependency_links.txt
  writing requirements to e3fp.egg-info/requires.txt
  writing top-level names to e3fp.egg-info/top_level.txt
  reading manifest file 'e3fp.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '__pycache__' found under directory '*'
  warning: no previously-included files matching '*.py[co]' found under directory '*'
  writing manifest file 'e3fp.egg-info/SOURCES.txt'
  copying e3fp/config/defaults.cfg -> build/lib.linux-x86_64-3.7/e3fp/config
  creating build/lib.linux-x86_64-3.7/e3fp/fingerprint/metrics
  copying e3fp/fingerprint/metrics/__init__.py -> build/lib.linux-x86_64-3.7/e3fp/fingerprint/metrics
  copying e3fp/fingerprint/metrics/_fast.c -> build/lib.linux-x86_64-3.7/e3fp/fingerprint/metrics
  copying e3fp/fingerprint/metrics/_fast.pyx -> build/lib.linux-x86_64-3.7/e3fp/fingerprint/metrics
  copying e3fp/fingerprint/metrics/_fast.so -> build/lib.linux-x86_64-3.7/e3fp/fingerprint/metrics
  copying e3fp/fingerprint/metrics/array_metrics.py -> build/lib.linux-x86_64-3.7/e3fp/fingerprint/metrics
  copying e3fp/fingerprint/metrics/fprint_metrics.py -> build/lib.linux-x86_64-3.7/e3fp/fingerprint/metrics
  creating build/lib.linux-x86_64-3.7/e3fp/test/data
  copying e3fp/test/data/caffeine_planar.sdf.bz2 -> build/lib.linux-x86_64-3.7/e3fp/test/data
  copying e3fp/test/data/ritalin_nonplanar.sdf.bz2 -> build/lib.linux-x86_64-3.7/e3fp/test/data
  copying e3fp/test/data/stereo1.sdf.bz2 -> build/lib.linux-x86_64-3.7/e3fp/test/data
  copying e3fp/test/data/stereo2.sdf.bz2 -> build/lib.linux-x86_64-3.7/e3fp/test/data
  creating build/lib.linux-x86_64-3.7/e3fp/test/data/rand_sdf_files
  copying e3fp/test/data/rand_sdf_files/CHEMBL116226.sdf.bz2 -> build/lib.linux-x86_64-3.7/e3fp/test/data/rand_sdf_files
  copying e3fp/test/data/rand_sdf_files/CHEMBL197946.sdf.bz2 -> build/lib.linux-x86_64-3.7/e3fp/test/data/rand_sdf_files
  copying e3fp/test/data/rand_sdf_files/CHEMBL2114064.sdf.bz2 -> build/lib.linux-x86_64-3.7/e3fp/test/data/rand_sdf_files
  copying e3fp/test/data/rand_sdf_files/CHEMBL282186.sdf.bz2 -> build/lib.linux-x86_64-3.7/e3fp/test/data/rand_sdf_files
  copying e3fp/test/data/rand_sdf_files/CHEMBL501745.sdf.bz2 -> build/lib.linux-x86_64-3.7/e3fp/test/data/rand_sdf_files
  running build_ext
  building 'e3fp.fingerprint.metrics._fast' extension
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/e3fp
  creating build/temp.linux-x86_64-3.7/e3fp/fingerprint
  creating build/temp.linux-x86_64-3.7/e3fp/fingerprint/metrics
  gcc -pthread -B /opt/miniconda3/envs/py37/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/miniconda3/envs/py37/include/python3.7m -I/opt/miniconda3/envs/py37/lib/python3.7/site-packages/numpy/core/include -c e3fp/fingerprint/metrics/_fast.c -o build/temp.linux-x86_64-3.7/e3fp/fingerprint/metrics/_fast.o
  In file included from /opt/miniconda3/envs/py37/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832,
                   from /opt/miniconda3/envs/py37/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                   from /opt/miniconda3/envs/py37/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                   from e3fp/fingerprint/metrics/_fast.c:435:
  /opt/miniconda3/envs/py37/lib/python3.7/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]
   #warning "Using deprecated NumPy API, disable it with " \
    ^~~~~~~
  e3fp/fingerprint/metrics/_fast.c: In function ‘__Pyx__ExceptionSave’:
  e3fp/fingerprint/metrics/_fast.c:20240:21: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       *type = tstate->exc_type;
                       ^~~~~~~~
                       curexc_type
  e3fp/fingerprint/metrics/_fast.c:20241:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       *value = tstate->exc_value;
                        ^~~~~~~~~
                        curexc_value
  e3fp/fingerprint/metrics/_fast.c:20242:19: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       *tb = tstate->exc_traceback;
                     ^~~~~~~~~~~~~
                     curexc_traceback
  e3fp/fingerprint/metrics/_fast.c: In function ‘__Pyx__ExceptionReset’:
  e3fp/fingerprint/metrics/_fast.c:20249:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       tmp_type = tstate->exc_type;
                          ^~~~~~~~
                          curexc_type
  e3fp/fingerprint/metrics/_fast.c:20250:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       tmp_value = tstate->exc_value;
                           ^~~~~~~~~
                           curexc_value
  e3fp/fingerprint/metrics/_fast.c:20251:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       tmp_tb = tstate->exc_traceback;
                        ^~~~~~~~~~~~~
                        curexc_traceback
  e3fp/fingerprint/metrics/_fast.c:20252:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       tstate->exc_type = type;
               ^~~~~~~~
               curexc_type
  e3fp/fingerprint/metrics/_fast.c:20253:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       tstate->exc_value = value;
               ^~~~~~~~~
               curexc_value
  e3fp/fingerprint/metrics/_fast.c:20254:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       tstate->exc_traceback = tb;
               ^~~~~~~~~~~~~
               curexc_traceback
  e3fp/fingerprint/metrics/_fast.c: In function ‘__Pyx__GetException’:
  e3fp/fingerprint/metrics/_fast.c:20309:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       tmp_type = tstate->exc_type;
                          ^~~~~~~~
                          curexc_type
  e3fp/fingerprint/metrics/_fast.c:20310:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       tmp_value = tstate->exc_value;
                           ^~~~~~~~~
                           curexc_value
  e3fp/fingerprint/metrics/_fast.c:20311:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       tmp_tb = tstate->exc_traceback;
                        ^~~~~~~~~~~~~
                        curexc_traceback
  e3fp/fingerprint/metrics/_fast.c:20312:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       tstate->exc_type = local_type;
               ^~~~~~~~
               curexc_type
  e3fp/fingerprint/metrics/_fast.c:20313:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       tstate->exc_value = local_value;
               ^~~~~~~~~
               curexc_value
  e3fp/fingerprint/metrics/_fast.c:20314:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       tstate->exc_traceback = local_tb;
               ^~~~~~~~~~~~~
               curexc_traceback
  e3fp/fingerprint/metrics/_fast.c: In function ‘__Pyx__ExceptionSwap’:
  e3fp/fingerprint/metrics/_fast.c:20531:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       tmp_type = tstate->exc_type;
                          ^~~~~~~~
                          curexc_type
  e3fp/fingerprint/metrics/_fast.c:20532:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       tmp_value = tstate->exc_value;
                           ^~~~~~~~~
                           curexc_value
  e3fp/fingerprint/metrics/_fast.c:20533:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       tmp_tb = tstate->exc_traceback;
                        ^~~~~~~~~~~~~
                        curexc_traceback
  e3fp/fingerprint/metrics/_fast.c:20534:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
       tstate->exc_type = *type;
               ^~~~~~~~
               curexc_type
  e3fp/fingerprint/metrics/_fast.c:20535:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
       tstate->exc_value = *value;
               ^~~~~~~~~
               curexc_value
  e3fp/fingerprint/metrics/_fast.c:20536:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
       tstate->exc_traceback = *tb;
               ^~~~~~~~~~~~~
               curexc_traceback
  e3fp/fingerprint/metrics/_fast.c: In function ‘__Pyx_PyCFunction_FastCall’:
  e3fp/fingerprint/metrics/_fast.c:20760:13: error: too many arguments to function ‘(PyObject * (*)(PyObject *, PyObject * const*, Py_ssize_t))meth’
       return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
              ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for e3fp

using

conda install -y -c keiserlab  -c rdkit -c sdaxen e3fp

fails for conflict with other incompatible packages in my environment that cannot be altered. Building from the repository fails as installing via pip, but it can be recovered. Look like python 3.7 is incompatible with the cython generated files (version 0.25.2)

git clone https://github.com/keiserlab/e3fp.git
cd e3fp/
pip install cython  # current version is 0.29.13
cython e3fp/fingerprint/metrics/_fast.pyx  # this seems required
python setup.py build_ext --inplace
python setup.py install

Hope this helps

sethaxen commented 4 years ago

Sorry for the late reply, and thanks for identifying this. Removing the generated files and building with Cython should fix the issue.

To avoid getting out of sync in the future, we should probably just make Cython a dependency and stop bundling the generated files. Or even better, we might be able to make numba an optional dependency and conditionally jit if numba is installed.