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.

AttributeError- 'MarkerCluster'

See original GitHub issue

Please add a code sample or a nbviewer link, copy-pastable if possible

# Your code here
map2 = folium.Map(location=[53.232350, -1.422151], tiles='CartoDB dark_matter', zoom_start=11)

marker_cluster = folium.MarkerCluster().add_to(map2)

for point in range(0, len(locationlist)):
    folium.Marker(locationlist[point], popup=df_counters['Name'][point]).add_to(marker_cluster)
map2

Problem description

When I try to run the above code, I get the following error. [this should explain why the current behavior is a problem and what is the expected output.]

Expected Output

Output of folium.__version__

AttributeError Traceback (most recent call last) <ipython-input-131-d98ae273548c> in <module>() 6 map2 = folium.Map(location=[53.232350, -1.422151], tiles=‘CartoDB dark_matter’, zoom_start=11) 7 ----> 8 marker_cluster = folium.MarkerCluster().add_to(map2) 9 10 for point in range(0, len(locationlist)):

AttributeError: module ‘folium’ has no attribute ‘MarkerCluster’

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

5reactions
Conengmocommented, Aug 12, 2018

To clarify, MarkerCluster is a plugin and is not available in the main folium module. So you cannot use it as folium.MarkerCluster. Instead you have to import the plugins and get it from there. Two options:

import folium.plugins
folium.plugins.MarkerCluster()

or

from folium.plugins import MarkerCluster
MarkerCluster()

I’m closing the issue. Feel free to add comments with additional questions of info. We can reopen the issue if needed.

2reactions
barbaramchdcommented, Jun 3, 2019

Can you share a code snippet?

Thank you for your help, but I just solved the problem!

Also, I need to say that your Github’s files have been very helpful! I am just a beginner with Python, and I have found a lot of useful info in your account and your comments. Thank you so much!

Read more comments on GitHub >

github_iconTop Results From Across the Web

error message 'module' object has no attribute 'MarkerCluster'
I'm trying to create a very simple leaflet/folium map using python. It works without marker clusters (all the relevant locations show up on...
Read more >
AttributeError: 'Map' object has no attribute 'Marker'
I have the following code: import folium from folium.plugins import MarkerCluster ...
Read more >
plugins — Folium 0.12.1 documentation - GitHub Pages
Add marker clusters to a map using in-browser rendering. Using FastMarkerCluster it is possible to render 000's of points far quicker than the...
Read more >
Can't use Folium modules : r/IPython - Reddit
I've imported folium, but whenever I run folium.MarkerCluster(), I get an AttributeError: module 'folium' has no attribute 'MarkerCluster'.
Read more >
AttributeError: 'Map' object has no attribute 'Marker'
I have the following code: import folium from folium.plugins import MarkerCluster map1 = folium.Map(location=SF_COORDINATES, zoom_start=12) marker_cluster ...
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