Upgrade to PyMongo 3.0 Resulting in ServerSelectionTimeoutError
It seems to be the same issue as in this question, and this bug. However I tried setting connect=False in the MongoClient() creation as suggested there to no avail. Currently the only solution that seems to work across the board is to downgrade to 2.8 (pip install pymongo==2.8
)
The fix for me was surprising; I entered this at the Bash prompt:
sudo /usr/sbin/setsebool -P httpd_can_network_connect 1sudo service httpd restart
Credit to this answer. It turned out to be an Apache permissions issue.
Note: I'm running PyMongo 3.0, Python 2.6, and Mongo 2.4 on CentOS 6.6. I got a marginally different error, but it was in the same line of PyMongo. This was the end of my stack trace:
File "/usr/lib64/python2.6/site-packages/pymongo/topology.py", line 93, in select_servers self._error_message(selector))ServerSelectionTimeoutError: localhost:27017: [Errno 13] Permission denied