KxSystems / pyq

PyQ — Python for kdb+
http://code.kx.com/q/interfaces
Apache License 2.0
190 stars 49 forks source link

3.7 Compatibility #80

Closed nugend closed 6 years ago

nugend commented 6 years ago

Is there anything besides the removal of install_misc blocking this?

abalkin commented 6 years ago

No. I've already fixed setup.py internally by simply copying install_misc from Python 3.6. In the next release, 3.7 will be officially supported.

nugend commented 5 years ago

@abalkin Can you please provide a point release to the current version to resolve this? It's been 3 months and there's been no apparent movement towards the release of 4.2.0

sitsang commented 5 years ago

Please just replace the line in setup.py

from from distutils.cmd import install_misc to from distutils.command.install_data import install_data as install_misc

and it will compile and build under python 3.7

ppatel26 commented 5 years ago

After replacing, it gives another error

(py3_q)  ~  pip install ~/pyq-master
Processing ./pyq-master
Building wheels for collected packages: pyq
 Running setup.py bdist_wheel for pyq ... error
 Complete output from command /Users/parvpatel/miniconda3/envs/py3_q/bin/python -u -c "import setuptools,` `tokenize;__file__='/private/var/folders/xd/rlvz74x150l_j9y42kzv3sfc0000gn/T/pip-req-build-t_6skbt_/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 /private/var/folders/xd/rlvz74x150l_j9y42kzv3sfc0000gn/T/pip-wheel-fcgwgncr --python-tag cp37:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-3.7
  creating build/lib.macosx-10.7-x86_64-3.7/pyq
  copying src/pyq/magic.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
  copying src/pyq/conftest.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
  copying src/pyq/cmd.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
  copying src/pyq/version.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
  copying src/pyq/_n.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
  copying src/pyq/_pt_run.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
  copying src/pyq/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
  copying src/pyq/ptk.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
  creating build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_version.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_q.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_no_numpy.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_ci.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_p.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_k.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_magic.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_pypath.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_python_q.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_n.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_threads.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_memoryview.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_pyq_executable.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_com.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_numpy.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_pathlib.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  copying src/pyq/tests/test_sd.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
  running build_ext
  building 'pyq._k' extension
  creating build/temp.macosx-10.7-x86_64-3.7
  creating build/temp.macosx-10.7-x86_64-3.7/src
  creating build/temp.macosx-10.7-x86_64-3.7/src/pyq
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/parvpatel/miniconda3/envs/py3_q/include -arch x86_64 -I/Users/parvpatel/miniconda3/envs/py3_q/include -arch x86_64 -DKXVER=3 -DKXVER2=5 -I/Users/parvpatel/miniconda3/envs/py3_q/include/python3.7m -c src/pyq/_k.c -o build/temp.macosx-10.7-x86_64-3.7/src/pyq/_k.o -Wpointer-arith -Werror -fno-strict-aliasing
  src/pyq/_k.c:110:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
      char *str = PyUnicode_AsUTF8AndSize(obj, psize);
            ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/pyq/_k.c:1337:17: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
                  PY_SET_SN(dest[i], obj)
                  ^~~~~~~~~~~~~~~~~~~~~~~
  src/pyq/_k.c:103:19: note: expanded from macro 'PY_SET_SN'
              char *str = PyUnicode_AsUTF8AndSize(obj, &size); \
                    ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/pyq/_k.c:1343:13: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
              PY_SET_SN(xs, obj)
              ^~~~~~~~~~~~~~~~~~
  src/pyq/_k.c:103:19: note: expanded from macro 'PY_SET_SN'
              char *str = PyUnicode_AsUTF8AndSize(obj, &size); \
                    ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/pyq/_k.c:2515:13: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
              PY_SET_SN(xS[i], o)
              ^~~~~~~~~~~~~~~~~~~
  src/pyq/_k.c:103:19: note: expanded from macro 'PY_SET_SN'
              char *str = PyUnicode_AsUTF8AndSize(obj, &size); \
                    ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  src/pyq/_k.c:4031:9: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
          PY_SET_SN(s, obj);
          ^~~~~~~~~~~~~~~~~
  src/pyq/_k.c:103:19: note: expanded from macro 'PY_SET_SN'
              char *str = PyUnicode_AsUTF8AndSize(obj, &size); \
                    ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5 errors generated.
  error: command 'gcc' failed with exit status 1`

  `----------------------------------------`
 ` Failed building wheel for pyq
  Running setup.py clean for pyq
Failed to build pyq
Installing collected packages: pyq
  Running setup.py install for pyq ... error
    Complete output from command /Users/parvpatel/miniconda3/envs/py3_q/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/xd/rlvz74x150l_j9y42kzv3sfc0000gn/T/pip-req-build-t_6skbt_/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/xd/rlvz74x150l_j9y42kzv3sfc0000gn/T/pip-record-ahh3x2wt/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.7
    creating build/lib.macosx-10.7-x86_64-3.7/pyq
    copying src/pyq/magic.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
    copying src/pyq/conftest.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
    copying src/pyq/cmd.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
    copying src/pyq/version.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
    copying src/pyq/_n.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
    copying src/pyq/_pt_run.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
    copying src/pyq/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
    copying src/pyq/ptk.py -> build/lib.macosx-10.7-x86_64-3.7/pyq
    creating build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_version.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_q.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_no_numpy.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_ci.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_p.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_k.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_magic.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_pypath.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_python_q.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_n.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_threads.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_memoryview.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_pyq_executable.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_com.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_numpy.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_pathlib.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    copying src/pyq/tests/test_sd.py -> build/lib.macosx-10.7-x86_64-3.7/pyq/tests
    running build_ext
    building 'pyq._k' extension
    creating build/temp.macosx-10.7-x86_64-3.7
    creating build/temp.macosx-10.7-x86_64-3.7/src
    creating build/temp.macosx-10.7-x86_64-3.7/src/pyq
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/parvpatel/miniconda3/envs/py3_q/include -arch x86_64 -I/Users/parvpatel/miniconda3/envs/py3_q/include -arch x86_64 -DKXVER=3 -DKXVER2=5 -I/Users/parvpatel/miniconda3/envs/py3_q/include/python3.7m -c src/pyq/_k.c -o build/temp.macosx-10.7-x86_64-3.7/src/pyq/_k.o -Wpointer-arith -Werror -fno-strict-aliasing
    src/pyq/_k.c:110:11: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
        char *str = PyUnicode_AsUTF8AndSize(obj, psize);
              ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/pyq/_k.c:1337:17: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
                    PY_SET_SN(dest[i], obj)
                    ^~~~~~~~~~~~~~~~~~~~~~~
    src/pyq/_k.c:103:19: note: expanded from macro 'PY_SET_SN'
                char *str = PyUnicode_AsUTF8AndSize(obj, &size); \
                      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/pyq/_k.c:1343:13: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
                PY_SET_SN(xs, obj)
                ^~~~~~~~~~~~~~~~~~
    src/pyq/_k.c:103:19: note: expanded from macro 'PY_SET_SN'
                char *str = PyUnicode_AsUTF8AndSize(obj, &size); \
                      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/pyq/_k.c:2515:13: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
                PY_SET_SN(xS[i], o)
                ^~~~~~~~~~~~~~~~~~~
    src/pyq/_k.c:103:19: note: expanded from macro 'PY_SET_SN'
                char *str = PyUnicode_AsUTF8AndSize(obj, &size); \
                      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/pyq/_k.c:4031:9: error: initializing 'char *' with an expression of type 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
            PY_SET_SN(s, obj);
            ^~~~~~~~~~~~~~~~~
    src/pyq/_k.c:103:19: note: expanded from macro 'PY_SET_SN'
                char *str = PyUnicode_AsUTF8AndSize(obj, &size); \
                      ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    5 errors generated.
    error: command 'gcc' failed with exit status 1`

   ` ----------------------------------------`
`Command "/Users/parvpatel/miniconda3/envs/py3_q/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/xd/rlvz74x150l_j9y42kzv3sfc0000gn/T/pip-req-build-t_6skbt_/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/xd/rlvz74x150l_j9y42kzv3sfc0000gn/T/pip-record-ahh3x2wt/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/xd/rlvz74x150l_j9y42kzv3sfc0000gn/T/pip-req-build-t_6skbt_/
sitsang commented 5 years ago

It is not related to the python. The error you sent is due to the Werror flag and the gcc version you are using. Try and remove the CFLAGS so that it won't treat that gcc warning as error.

ppatel26 commented 5 years ago

@sitsang can you please show how do I go about removing those? Thank you

sitsang commented 5 years ago

You can remove line 52 in setup.py

ppatel26 commented 5 years ago

@sitsang Thank you. That worked.

Unfortunately. When I run pyq I now get another error.

Welcome to kdb+ 32bit edition For support please see http://groups.google.com/d/forum/personal-kdbplus Tutorials can be found at http://code.kx.com To exit, type \ To remove this startup msg, edit q.q '2019.01.28T14:21:33.731 dlopen(/Users/parvpatel/q/m32/p.so, 2): no suitable image found. Did find: /Users/parvpatel/q/m32/p.so: mach-o, but wrong architecture /Users/parvpatel/q/m32/p.so: mach-o, but wrong architecture [4] /Users/parvpatel/q/p.k:3: (p 2:(p_init;1))python_dll ^