I am trying to connect MongoDB from Atlas But I encountered "dnspython must be installed error".
My mongo uri (mockup): mongodb+srv://abc:123@something.something.com/admin?retryWrites=True
My pymongo version: 3.6.1
I have installed dnspython
and done import dns
Still, I am getting the error "dnspython module must be installed to use mongodb+srv:// URI"
Can anybody help?
I would like to answer my own questions here. As I mentioned in the comment, the kernel of the jupyter notebook has to be restarted in order for the pymongo to take effect of the loaded dnspython
.
May be the protocol, your URI should start with:
mongo+srv instead of mongo+src
If it still not working please put a pip list with the versions of PyMongo and dnspython (and version of python that you are using)
In requirements.txt, replace pymongo
with pymongo[tls,srv]
, as mentioned here.