AttributeError: module 'folium' has no attribute 'plugins'
JustAnotherVeryNormalDeveloper opened this issue · comments
Describe the bug
Importing only folium isn't enough to make folium.plugins classes work.
To Reproduce
import folium
import folium.plugins # if we comment this line, the code crash at line 4: AttributeError: module 'folium' has no attribute 'plugins'
folium.plugins.treelayercontrol.TreeLayerControl
Expected behavior
this 2 lines should compile like this.
import folium
folium.plugins.treelayercontrol.TreeLayerControl
Environment (please complete the following information):
chrome
html
folium: 0.16.1.dev54+g570f293
branca: 0.7.1
Additional context
Maybe it needs another issue, when I do pip install folium it get me the 0.16.0 and I don't have the file:
- https://github.com/python-visualization/folium/blob/main/folium/plugins/treelayercontrol.py
When I download directly the github it works fine. (this is why my version is 0.16.1.dev54+g570f293 and not 0.16.0)
Possible solutions
https://github.com/python-visualization/folium/blob/main/folium/__init__.py
add the line: import plugins
? (sounds too easy, it feels like a trap XD)
folium is maintained by volunteers. Can you help making a fix for this issue?
- why not, as a folium enthusiast, I would be proud to :)
This is by design. You need to import folium.plugins
as stated in our docs. That makes import base folium faster and uncluttered from the multiple plugins in the submodule.