question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[MongoDB] ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused

See original GitHub issue

Simple test:

import json
import io
import pymongo
from pymongo import MongoClient

#client = MongoClient('mongodb://localhost:27017/')
#client = MongoClient('mongodb://localhost:27017/', connect=False)
client = MongoClient('localhost', 27017)

print(client)
dbnames = client.list_database_names()
print(dbnames)

Error: ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused

Error Reproduction: https://www.kaggle.com/logachevpa/trip-routes-visualisation-on-map-by-time https://www.kaggle.com/apjansing/preliminary-taxi-data-processing-using-mongodb

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

20reactions
l0riccommented, Sep 23, 2020

lol

5reactions
Philmodcommented, Apr 23, 2020

This notebook you referenced have the same error because there is no local MongoDB server running.

Maybe they ran that code on their own computer where they have a MongoDB server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pymongo keeps refusing the connection at 27017
1. It should be sudo service mongodb start not sudo service mongod start · 1. path should be /var/lib/mongodb . · 2. C:\Program...
Read more >
Timeout error after database directory change - MongoDB
ServerSelectionTimeoutError : localhost:27017: [Errno 111] Connection refused, Timeout: 30s, Topology Description: <TopologyDescription id: ...
Read more >
could not connect to localhost:27017: [Errno 111] Connection ...
Django Version: 1.4.14. Exception Type: ConnectionFailure. Exception Value: could not connect to localhost:27017: [Errno 111] Connection refused.
Read more >
Connection refused error : r/mongodb - Reddit
ServerSelectionTimeoutError : localhost:27017: [Errno 111] Connection refused, Timeout: 30s, Topology Description: <TopologyDescription id: ...
Read more >
Python not connecting to mongodb in docker container
I have tried allowing by docker container IP by ufw firewall since its a connection refused issue but it doesnt work. I have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found