LicenseException: A valid q license must be in a known location (e.g. `$QLIC`) to run q code via 'pykx.q'.

I am trying to run q commands through a jupyter notebook. However, I am running into the exception, whenever I am using pykx.q. 

LicenseException: A valid q license must be in a known location (e.g. `$QLIC`) to run q code via 'pykx.q'.

 Even while importing, I am encountering the issue

<frozen importlib._bootstrap>:241: PyKXWarning: Failed to initialize PyKX fully licensed functionality. To access all functionality of PyKX please download an evaluation license from[https://kx.com/kdb-insights-personal-edition-license-download/]("https://kx.com/kdb-insights-personal-edition-license-download/")Full installation instructions can be found at[https://code.kx.com/pykx/getting-started/installing.html]("https://code.kx.com/pykx/getting-started/installing.html")Falling back to unlicensed mode, which has limited functionality. Refer to[https://code.kx.com/pykx/user-guide/advanced/modes.html]("https://code.kx.com/pykx/user-guide/advanced/modes.html")for more information on licensed vs unlicensed modalities. Captured output from initialization attempt: '2023.08.08T18:49:30.065 licence error: embedq

 

I am able to use q through CLI normally. The license file is there. But somehow the exception pops up whenever I am trying to run q commands through pykx.q. I have made sure that QHOME and QLIC are pointing to the folder containing kc.lic file. 

Any help or guidance to fix this issue will be great.

 

I have similar issue as well, already set QLIC pointing to license folder, but get license error: upd, not sure if same root cause as yours.

You license will need the flags insights.lib.embedq and insights.lib.pykxto run pykx.q

You can check your license flags in q using:

 

 

 

q).z.l 4 "insights.lib.embedq insights.lib.pykx insights.lib.sql insights.lib.qlog ins..

 

 

 

 

If you have an older trial license you simply need to request a new one at:

https://kx.com/kdb-personal-edition-download/

[https://kx.com/kdb-insights-personal-edition-license-download/](“https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fkx.com%2Fkdb-insights-personal-edition-license-download%2F&data=05|01|rocuinneagain%40kx.com|6f9711c69dae4cf1149108db98e86f6d|8b006032f7cd404e8f6f4719f041417b|0|0|638271896306917562|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=%2Ba%2FLEYbCQZkAEtP0LacT5Ol8EDUWCZr0eqG5plhEwds%3D&reserved=0” "“Original”)

 

Then replace the old with new on your machine. New licenses come with all the flags enabled.

 

If it is a commercial license then your designated contact can reach out to licadmin@kx.com to have a new license issued:

https://code.kx.com/q/learn/licensing/#commercial

 

As well as a licence expiry date each kdb+ licence also has a maintenance update date.

  • licence expiry: You cannot use kdb+ after this date gives exp error
  • maintenance update expiry: You cannot use versions of kdb+ newer than this date. Gives upd error

https://code.kx.com/q/basics/errors/#:~:text=format%20not%20recognized-,upd,-Function%20upd%20is

 

.e.g if you have a maintenance expiry date of 2021.12.31 but a licence expiry of 2022.06.01 this means you can use kdb+ up to 2022.06.01 as long as the version of kdb+ was released before 2021.12.31

The dates of your licence are included in the email you got from licadmin@kx.com

 

As of 1.6.0 PyKX is based on 2023.04.17 version of q

https://code.kx.com/pykx/1.6/changelog.html#pykx-160

 

To get a new license with a more open maintenance expiry date your designated contact can reach out to licadmin@kx.com to have a new license issued:

https://code.kx.com/q/learn/licensing/#commercial

 

 

 I checked for the flags but I got an empty string for the command. 

I also ran python -c “import pykx;pykx.util.debug_environment()”, based on one of previous answer. There also I got an empty string where flags are expected.

However, I think the license is not an older version as I got it just a few days back. 

 

 

 

 

I’ve corrected my link.

You specifically need the insights free trial license to get the flags:

[https://kx.com/kdb-insights-personal-edition-license-download/](“https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fkx.com%2Fkdb-insights-personal-edition-license-download%2F&data=05|01|rocuinneagain%40kx.com|6f9711c69dae4cf1149108db98e86f6d|8b006032f7cd404e8f6f4719f041417b|0|0|638271896306917562|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=%2Ba%2FLEYbCQZkAEtP0LacT5Ol8EDUWCZr0eqG5plhEwds%3D&reserved=0” "“Original”)

 I updated the license from here. Now I can see the flags by running .z.l 4 in q.

However, I am running into a new problem when executing python -c “import pykx;pykx.util.debug_environment()” as shown in the screenshot below. Same error message pops up if I am importing it in python. 

 

Does the import work in unlicensed mode?

set QARGS=“–unlicensed”

 

Yes. Following is the screenshot for the same. 

Everything seems fine, but again it fails with no license exception when I run a simple q command.

I don’t know how relevant it is but I’m using a Windows machine with windows 11 OS.

 

 

It’s expected that you cannot run pykx.q('1+1') when in unlicensed mode.

 

Can you try again for licensed mode after making a copy of:
C:\Users\Amod Shanker\anaconda3\envs\python396\python.EXE

The copy should be python3.EXE:
C:\Users\Amod Shanker\anaconda3\envs\python396\python3.EXE

 

  • just to confirm:
  1. How did you install PyKX?

  2. What version have you installed? pykx. __version__  or view it in conda list

I tried with python3.exe, but the behaviour remains same. I can import in unlicensed mode but it fails with licensed mode throwing .nyi error.

 

I installed pykx using pip. I have tried it with different versions of python, i.e. 3.9.6 and 3.8 in different conda environments. They both are behaving similarly.  

They pykx version is 1.6.1 in my system.