KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums PyKX PyKXException – Valid KDB+/Q License

  • PyKXException – Valid KDB+/Q License

    Posted by k2q on January 2, 2025 at 3:47 pm

    Hello,

    Currently using trial kdb version, it’s working well.

    KDB+ 4.1 2024.10.16 Copyright (C) 1993-2024 Kx Systems
    l64/ 4(24)core 7461MB rr local 127.0.1.1 EXPIRE 2025.12.14 @gmail.com KDB PLUS TRIAL #xxxx365 
    

    Tried installing PyKX and it’s dependencies.

    Linux local 6.8.0-50-generic #51~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 21 12:03:03 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
    

    Python 3.10.12 (main, Nov 6 2024, 20:22:13) [GCC 11.4.0] on linuxType "help", "copyright", "credits" or "license" for more information.

    When I have tried for first time, that is, importing pykx, it worked.

    import pykx as kx
    
    kx.license.install('/home/rr/q/l64/kc.lic')
    PyKX license successfully installed!
    

    However after installing kdb+ license, started throwing the below error. How to fix this issue? appreciate your help! Thanks

    kx.q.til(5)
    
    Traceback (most recent call last):File "/home/rr/.local/lib/python3.10/site-packages/pykx/init.py", line 152, in /.getattrctx = self.getattribute('ctx')AttributeError: 'EmbeddedQ' object has no attribute 'ctx'
    
    import pykx as kx
    
    Traceback (most recent call last):File "<stdin>", line 1, in <module>File "/home/rr/.local/lib/python3.10/site-packages/pykx/init.py", line 32, in <module>from . import coreFile "pykx/core.pyx", line 394, in init pykx.corepykx.exceptions.PyKXException: Early garbage collection requires a valid q license.
    

    rocuinneagain replied 1 week, 6 days ago 2 Members · 3 Replies
  • 3 Replies
  • rocuinneagain

    Member
    January 6, 2025 at 3:17 pm

    What version of PyKX are you using?

    In a q session can you use the new license?

    Does it have the needed flags for PyKX?

    q)`insights.lib.embedq`insights.lib.pykx in `$" " vs .z.l 4 // Should return 11b


    When you run import pykx as kx  did you paste the full output? PyKX does try to include what is specifically wrong with a license.

    • k2q

      Member
      January 10, 2025 at 8:13 am

      Thanks for your response, please see below.

      q shell output

      KDB+ 4.1 2024.10.16 Copyright (C) 1993-2024 Kx Systems
      l64/ 4(24)core 7461MB rr rkr 127.0.1.1 EXPIRE 2026.01.04 @gmail.com KDB INSIGHTS #xxxx593
      q)`insights.lib.embedq`insights.lib.pykx in `$" " vs .z.l 4 // Should return 11b
      11b
      q)\\

      pykx import error snapshot

      Python 3.10.12 (main, Nov  6 2024, 20:22:13) [GCC 11.4.0] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import pykx as kx
      Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/rr/.local/lib/python3.10/site-packages/pykx/__init__.py", line 32, in <module>
      from . import core
      File "pykx/core.pyx", line 394, in init pykx.core
      pykx.exceptions.PyKXException: Early garbage collection requires a valid q license.
      >>> quit()

      pip installation output

      $ pip3.10 install pykx
      Defaulting to user installation because normal site-packages is not writeable
      Requirement already satisfied: pykx in /home/rr/.local/lib/python3.10/site-packages (3.0.1)
      Requirement already satisfied: dill>=0.2.0 in /home/rr/.local/lib/python3.10/site-packages (from pykx) (0.3.9)
      Requirement already satisfied: pandas<=2.2.3,>=1.2 in /home/rr/.local/lib/python3.10/site-packages (from pykx) (2.2.3)
      Requirement already satisfied: toml~=0.10.2 in /home/rr/.local/lib/python3.10/site-packages (from pykx) (0.10.2)
      Requirement already satisfied: numpy<2.0,~=1.22 in /home/rr/.local/lib/python3.10/site-packages (from pykx) (1.26.4)
      Requirement already satisfied: pytz>=2022.1 in /usr/lib/python3/dist-packages (from pykx) (2022.1)
      Requirement already satisfied: requests>=2.25.0 in /home/rr/.local/lib/python3.10/site-packages (from pykx) (2.32.3)
      Requirement already satisfied: tzdata>=2022.7 in /home/rr/.local/lib/python3.10/site-packages (from pandas<=2.2.3,>=1.2->pykx) (2024.2)
      Requirement already satisfied: python-dateutil>=2.8.2 in /home/rr/.local/lib/python3.10/site-packages (from pandas<=2.2.3,>=1.2->pykx) (2.9.0.post0)
      Requirement already satisfied: charset-normalizer<4,>=2 in /home/rr/.local/lib/python3.10/site-packages (from requests>=2.25.0->pykx) (3.4.1)
      Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/lib/python3/dist-packages (from requests>=2.25.0->pykx) (1.26.5)
      Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests>=2.25.0->pykx) (2020.6.20)
      Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests>=2.25.0->pykx) (3.3)
      Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.8.2->pandas<=2.2.3,>=1.2->pykx) (1.16.0)
      • rocuinneagain

        Member
        January 10, 2025 at 10:23 am

        Do you have warnings supressed?

        The output of the failed import should be like:

        PYKX_GC=True python test.py
        <frozen importlib._bootstrap>:241: PyKXWarning: Failed to initialize PyKX successfully with the following error: Captured output from initialization attempt:
        '2025.01.10T12:11:03.276 licence error: k4.lic
        License location used:
        Traceback (most recent call last):
        File "/home/rocuinneagain/q/test.py", line 1, in <module>
        import pykx as kx
        File "/home/rocuinneagain/.pyenv/versions/3.11.5/lib/python3.11/site-packages/pykx/__init__.py", line 32, in <module>
        from . import core
        File "pykx/core.pyx", line 394, in init pykx.core
        pykx.exceptions.PyKXException: Early garbage collection requires a valid q license.

        Your output is missing the first line.

        Do you have the QLIC environment variable set?

        You put your license in /home/rr/q/l64/

        A more standard location would be one level higher at /home/rr/q/

        Can you start python with PYKX_UNLICENSED=True python

        Then run:

        >>> import pykx as kx
        >>> kx.util.debug_environment()

        And share the output here? It will give more information on your environment.

Log in to reply.