cancel
Showing results for 
Search instead for 
Did you mean: 

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

Amod
New Contributor II

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/
Full installation instructions can be found at 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 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.

 

10 REPLIES 10

powerpeanuts
New Contributor III

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.

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 
 
As of 1.6.0 PyKX is based on 2023.04.17 version of q
 
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

 
 

rocuinneagain
Valued Contributor
Valued Contributor

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/

 

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

 

Amod
New Contributor II

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

Amod_1-1691583559908.png

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.

Amod_2-1691583660871.png

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

 

 

 

 

rocuinneagain
Valued Contributor
Valued Contributor

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/

Amod
New Contributor II

@rocuinneagain 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. 

Amod_0-1691614641689.png

 

rocuinneagain
Valued Contributor
Valued Contributor

Does the import work in unlicensed mode?

set QARGS="--unlicensed"

 

Amod
New Contributor II

Yes. Following is the screenshot for the same. 

Amod_0-1691752301413.png

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

Amod_1-1691752373050.png

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

 

 

rocuinneagain
Valued Contributor
Valued Contributor

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

Amod
New Contributor II

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.