python-visualization / folium

Python Data. Leaflet.js Maps.
https://python-visualization.github.io/folium/
MIT License
6.91k stars 2.22k forks source link

'module' object has no attribute 'Map' #363

Closed brkygur closed 8 years ago

brkygur commented 8 years ago

Hello all, I have installed folium through pip install and I've been trying to produce a choropleth map with it. I'm using python (x,y) with spyder IDE and had no problems with opening maps. Today it's been giving this error code.

AttributeError: 'module' object has no attribute 'Map'

This is the code I have been using.

import folium
map_osm = folium.Map(location=[45.5236, -122.6750])
map_osm.create_map(path='osm.html')

Here is the rest of the error code in case it is also needed.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile
    execfile(filename, namespace)
  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 71, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)
  File "C:/Users/Berkay/Desktop/untitled1.py", line 1, in <module>
    import folium
  File "folium.py", line 14, in <module>
    bna = folium.Map(location=[39, 35],
AttributeError: 'module' object has no attribute 'Map'

Thank you beforehand, Berkay Gür

ocefpaf commented 8 years ago

Can you give a little more info on how you installed? Which version? Are you using any development branch?

brkygur commented 8 years ago

I simply opened the command prompt and typed pip install folium. I reinstalled it today. It is 0.1.6. No I don't think I am using any development branch.

ocefpaf commented 8 years ago

Can you do this,

python -c "import folium; print(dir(folium.Map))"

from the command line and paste the result here.

brkygur commented 8 years ago

I have just pasted it on the command prompt (admin). Here are the results

['class', 'delattr', 'dict', 'doc', 'format', 'getattribute', 'hash', 'init', 'module', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', '_auto_bounds', '_build_map', '_popup_render', '_reprhtml', 'add_layers_to_map', 'add_tile_layer', 'add_wms_layer', 'circle_marker', 'click_for_marker', 'create_map', 'fit_bounds', 'geo_json', 'image_overlay', 'lat_lng_popover', 'line', 'multiline', 'polygon_marker', 'simple_marker']

ocefpaf commented 8 years ago

OK. Folium is installed properly and it is working.

I see that you are using spyder, right? That might be clobbering the folium module. Since I don't use it I cannot help you there.... Sorry.

Please open an issue at the spyder project and let us know what they have to say about this.