Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pymongo - "dnspython" module must be installed to use mongodb+srv:// URIs

I am trying to connect MongoDB from Atlas.

My mongo uri is: mongodb+srv://abc:[email protected]/admin?retryWrites=True

My pymongo version is 3.6.1

I have installed dnspython and done import dns

But i still get this error:

dnspython module must be installed to use mongodb+srv:// URI

like image 784
addicted Avatar asked Oct 22 '18 13:10

addicted


2 Answers

In order to use mongo+srv protocol, you need to install pymongo-srv Launch this command to do it with python 3:

pip3 install pymongo[srv] 

or this one for other versions:

pip install pymongo[srv] 

And as suggested by @lukrebs, add quotes for ZSH:

pip3 install 'pymongo[srv]' 
like image 173
veben Avatar answered Sep 19 '22 21:09

veben


I solved this problem with:

$ python -m pip install pymongo[srv]

like image 27
Jonathan Cardoso Avatar answered Sep 19 '22 21:09

Jonathan Cardoso