Installing python librarries for use within rlm_python
I have radius 3.0.13 installed and working with rlm_python. I am able to send a RLM_MODULE_OK from within the authorize function. In my sites-enabled I have python { module = example python_path = ${modconfdir}/${.:name} mod_authorize = ${.module} func_authorize = authorize } I have installed sqlalchemy, a Python library and it is correctly installed; as I can see from $ python -c "import sqlalchemy; print sqlalchemy.__version__" 1.1.3 However when I try using it inside of my file being called from rlm_python, I am getting Python version: 2.7.12 (default, Jul 1 2016, 15:12:24) [GCC 5.4.0 20160609] System exec is python_function_load - Module 'example' not found <type 'exceptions.ImportError'> (No module named sqlalchemy) python_function_load - Failed to import python function 'example.authorize' /usr/local/etc/raddb/mods-enabled/python[1]: Instantiation failed for module "python" Is the python binary being used by rlm_python different from the system binary? My radiusd version is radiusd: FreeRADIUS Version 3.0.13 (git #7758e73),
On 31 Oct 2016, at 12:36, Shabda Raaj <shabda.raaj@bankofloyal.com> wrote:
<type 'exceptions.ImportError'> (No module named sqlalchemy)
Your python environment is broken. Most likely, your python home is in a non-standard location and your shell has been explicitly configured to use it. Regards, Adam Bishop gpg: E75B 1F92 6407 DFDF 9F1C BF10 C993 2504 6609 D460 jisc.ac.uk Jisc is a registered charity (number 1149740) and a company limited by guarantee which is registered in England under Company No. 5747339, VAT No. GB 197 0632 86. Jisc’s registered office is: One Castlepark, Tower Hill, Bristol, BS2 0JA. T 0203 697 5800. Jisc Services Limited is a wholly owned Jisc subsidiary and a company limited by guarantee which is registered in England under company number 2881024, VAT number GB 197 0632 86. The registered office is: One Castle Park, Tower Hill, Bristol BS2 0JA. T 0203 697 5800.
Have the same issue. Use SLES12SP1 with source installed 3.0.12. At beginning I configured in "/usr/local/etc/raddb/mods-enabled/python" the python_path with "python_path =${modconfdir}/python:/usr/lib64/python2.7/". Then I need MySQLdb for that I have to expand python_path to "python_path =${modconfdir}/python:/usr/lib64/python2.7/:/usr/lib64/python2.7/site-packages/". MySQLdb need math so I have to add "lib-dynload" so my current python_path is now "python_path =${modconfdir}/python:/usr/lib64/python2.7/:/usr/lib64/python2.7/site-packages/:/usr/lib64/python2.7/lib-dynload/" This is just only happening in freeradius. Did not find other solution right now, maybe it helps you. BR Paul
I have radius 3.0.13 installed and working with rlm_python. I am able to send a RLM_MODULE_OK from within the authorize function.
In my sites-enabled I have
python { module = example python_path = ${modconfdir}/${.:name} mod_authorize = ${.module} func_authorize = authorize }
I have installed sqlalchemy, a Python library and it is correctly installed; as I can see from
$ python -c "import sqlalchemy; print sqlalchemy.__version__" 1.1.3
However when I try using it inside of my file being called from rlm_python, I am getting
Python version: 2.7.12 (default, Jul 1 2016, 15:12:24) [GCC 5.4.0 20160609]
System exec is
python_function_load - Module 'example' not found
<type 'exceptions.ImportError'> (No module named sqlalchemy)
python_function_load - Failed to import python function 'example.authorize'
/usr/local/etc/raddb/mods-enabled/python[1]: Instantiation failed for module "python"
Is the python binary being used by rlm_python different from the system binary?
My radiusd version is
radiusd: FreeRADIUS Version 3.0.13 (git #7758e73), - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
participants (3)
-
Adam Bishop -
Poltorak, Paul (CT DD DS EVO O BFD TM&ISEC 1) -
Shabda Raaj