-1

this is my code for map.py:

import folium

map = folium.Map(location=[42.3601, -71.0589], zoom_start=12)
map.save('map.html')

this is the error:

File "map.py", line 2, in <module>
    import folium   File "/Users/tomerrajuan/Library/Python/2.7/lib/python/site-packages/folium/__init__.py",
line 8, in <module>
    import branca   File "/Users/tomerrajuan/Library/Python/2.7/lib/python/site-packages/branca/__init__.py",
line 1, in <module>
    import branca.colormap as colormap   File "/Users/tomerrajuan/Library/Python/2.7/lib/python/site-packages/branca/colormap.py",
line 15, in <module>
    from branca.element import ENV, Figure, JavascriptLink, MacroElement   File
"/Users/tomerrajuan/Library/Python/2.7/lib/python/site-packages/branca/element.py",
line 13, in <module>
    from urllib.request import urlopen ImportError: No module named request
sentence
  • 8,213
  • 4
  • 31
  • 40
Tomer_Ra
  • 123
  • 1
  • 11

1 Answers1

0

You will have to install the requests package manually.

This can be done by running this command in your terminal/cmd :

pip install requests
Sash
  • 30
  • 5
  • Thank you for the comment, i did install it already as well, before writing the issue. so same errors.. – Tomer_Ra Jun 09 '20 at 10:56
  • As I can see from the error message you are running your program with python 2. Are you sure `requests` has been installed for Python 2 and not Python 3? you can check this by running python2 on the terminal and then typing in `import requests` in the shell. – Sash Jun 10 '20 at 00:45
  • thanks again for the help! when i run import requests in python2 it is just going to a new line without doing anything. i went again into site-packages at python2.7 (mac version) and the requests directory is there as well as the folium one – Tomer_Ra Jun 10 '20 at 08:32
  • I want to suggest that maybe something is wrong in my PATH. as, i think python3.6 is written there before the others and perhaps takes them over, HOWEVER, i dont really know how to edit and orgenize the PATH without harming other things that are actually working – Tomer_Ra Jun 10 '20 at 08:35
  • this is the .bash_profile: PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/go/bin:$PATH" export PATH=/usr/local/bin/python3.8:${PATH} export PATH=“/Library/Frameworks/Python.framework/Versions/3.8/bin/export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/b‌​in – Tomer_Ra Jun 10 '20 at 08:41