Pritunl The “dnspython” module must be installed to use mongodb+srv:// URIs error

I deployed pritunl with terraform on Oracle Linux 8 . I wanted to use MongoDB Atlas cluster with mongodb+srv cluster SRV url but I got the following errors in /var/log/pritunl.log

undefined][2020-06-24 16:12:57,387][INFO] Generating setup server ssl cert
[undefined][2020-06-24 16:50:17,921][ERROR] Exception on /setup/mongodb [PUT]
Traceback (most recent call last):
File "/usr/lib/pritunl/lib/python2.7/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/pritunl/lib/python2.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/pritunl/lib/python2.7/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/pritunl/lib/python2.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/pritunl/lib/python2.7/site-packages/flask/app.py", line 1935, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/lib/pritunl/lib/python2.7/site-packages/pritunl/setup/server.py", line 151, in setup_mongodb_put
connectTimeoutMS=MONGO_CONNECT_TIMEOUT)
File "/usr/lib/pritunl/lib/python2.7/site-packages/pymongo/mongo_client.py", line 621, in __init__
connect_timeout=timeout)
File "/usr/lib/pritunl/lib/python2.7/site-packages/pymongo/uri_parser.py", line 390, in parse_uri
raise ConfigurationError('The "dnspython" module must be '
ConfigurationError: The "dnspython" module must be installed to use mongodb+srv:// URIs

I installed dnspython with the following command but it still gives the same error.

#  python -m pip install 'mongo[srv]' dnspython

When I check the pritunl process, I recognized that it uses it’s own python version instead of OS provided python package.

root       29389  2.3  8.7 2229636 149452 ?      Ssl  16:52   0:23 /usr/lib/pritunl/bin/python2 /usr/lib/pritunl/bin/pritunl start

Finally the following command solved the issue.

# /usr/lib/pritunl/bin/python -m pip install 'mongo[srv]' dnspython

You need to stop start pritunl to take it effect.

Devops Engineer