KxSystems / pyq

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

Installation with Python 3.5 - NameError: name 'pypath' is not defined #11

Closed danielkrizian closed 7 years ago

danielkrizian commented 7 years ago

Hi,

NameError: name 'pypath' is not defined is thrown when installing pyq with Python 3.5. On the same machine, it installs fine with Python 2.7. kdb+ version is 3.4, 64-bit licensed.

Thanks

(venv) adil@adil-OptiPlex-3020:~/workspace/technical-alerts$ pip install -i https://pyq.enlnt.com --no-binary pyq pyq
Collecting pyq
  Downloading https://github.com/enlnt/pyq/archive/pyq-4.0.1.tar.gz (585kB)
    100% |████████████████████████████████| 593kB 1.4MB/s 
Skipping bdist_wheel for pyq, due to binaries being disabled for it.
Installing collected packages: pyq
  Running setup.py install for pyq ... error
    Complete output from command /home/adil/workspace/technical-alerts/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-chld175c/pyq/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-wj5cg4zw-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/adil/workspace/technical-alerts/venv/include/site/python3.5/pyq:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/pyq
    copying src/pyq/__init__.py -> build/lib.linux-x86_64-3.5/pyq
    copying src/pyq/cmd.py -> build/lib.linux-x86_64-3.5/pyq
    copying src/pyq/magic.py -> build/lib.linux-x86_64-3.5/pyq
    copying src/pyq/version.py -> build/lib.linux-x86_64-3.5/pyq
    copying src/pyq/ptk.py -> build/lib.linux-x86_64-3.5/pyq
    copying src/pyq/conftest.py -> build/lib.linux-x86_64-3.5/pyq
    copying src/pyq/_pt_run.py -> build/lib.linux-x86_64-3.5/pyq
    copying src/pyq/_n.py -> build/lib.linux-x86_64-3.5/pyq
    creating build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/__init__.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_com.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_no_numpy.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_sd.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_q.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_magic.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_numpy.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_version.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_pyq_executable.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_threads.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_pypath.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_ci.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_python_q.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_p.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_k.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_memoryview.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_pathlib.py -> build/lib.linux-x86_64-3.5/pyq/tests
    copying src/pyq/tests/test_n.py -> build/lib.linux-x86_64-3.5/pyq/tests
    running build_ext
    building 'pyq._k' extension
    creating build/temp.linux-x86_64-3.5-kx-3
    creating build/temp.linux-x86_64-3.5-kx-3/src
    creating build/temp.linux-x86_64-3.5-kx-3/src/pyq
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DKXVER=3 -DQVER=3 -DPY3K=35 -I/usr/include/python3.5m -I/home/adil/workspace/technical-alerts/venv/include/python3.5m -c src/pyq/_k.c -o build/temp.linux-x86_64-3.5-kx-3/src/pyq/_k.o -Wpointer-arith -Werror -fno-strict-aliasing
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5-kx-3/src/pyq/_k.o -o build/lib.linux-x86_64-3.5/pyq/_k.cpython-35m-x86_64-linux-gnu.so
    running build_scripts
    creating build/scripts-3.5
    copying src/scripts/pyq-runtests -> build/scripts-3.5
    copying and adjusting src/scripts/pyq-coverage -> build/scripts-3.5
    copying src/scripts/ipyq -> build/scripts-3.5
    copying src/scripts/pq -> build/scripts-3.5
    copying src/scripts/qp -> build/scripts-3.5
    changing mode of build/scripts-3.5/pyq-coverage from 664 to 775
    changing mode of build/scripts-3.5/ipyq from 664 to 775
    changing mode of build/scripts-3.5/pq from 664 to 775
    changing mode of build/scripts-3.5/qp from 664 to 775
    running build_qk
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-chld175c/pyq/setup.py", line 796, in <module>
        **metadata)
      File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/adil/workspace/technical-alerts/venv/lib/python3.5/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.5/distutils/command/install.py", line 583, in run
        self.run_command('build')
      File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.5/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.5/distutils/dist.py", line 973, in run_command
        cmd_obj.ensure_finalized()
      File "/usr/lib/python3.5/distutils/cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "/tmp/pip-build-chld175c/pyq/setup.py", line 358, in finalize_options
        lib_string = 'lib:"%s\\000"\n' % pypath
    NameError: name 'pypath' is not defined
    ----------------------------------------
Command "/home/adil/workspace/technical-alerts/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-chld175c/pyq/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-wj5cg4zw-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/adil/workspace/technical-alerts/venv/include/site/python3.5/pyq" failed with error code 1 in /tmp/pip-build-chld175c/pyq/
abalkin commented 7 years ago

This usually happens when you install pyq using a statically linked python. Check the output of

   ldd `which python`

BTW, what is Python 2.8? As far as I know this has never been released.

adilbaig commented 7 years ago

Hey, 2.8 was a typo. It's 3.5. This is what I get from the virtualenv. It's a stock Python3 (apt install python3) installation in Ubuntu 16.04 (x64)

(venv) adil@adil-OptiPlex-3020:~/workspace/technical-alerts$ ldd `which python`
    linux-vdso.so.1 =>  (0x00007fffa7bda000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f18c745a000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f18c7091000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f18c6e8c000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f18c6c89000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f18c6a60000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f18c6845000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f18c653c000)
    /lib64/ld-linux-x86-64.so.2 (0x000055def4f97000)
sashkab commented 7 years ago

NB: Internal issue 909.

sashkab commented 7 years ago

Ubuntu provides statically linked Python. They also provide shared libraries which can be installed using apt install libpython3.5-stdlib libpython3.5-dev.

We identified a bug causing installation troubles on Ubuntu and a fix will be available in the upcoming patch release.

sashkab commented 7 years ago

Issue was fixed in PyQ 4.0.2.

We also added a guide on installing PyQ on Ubuntu 16.04.