Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Folium import error
#1
Hello I am trying to use folium library but it is not working for me. I have tried with python 2.7/3.6/3.9. Below is my code.

import folium

# Create map object
m = folium.Map(location=[42.3601, -71.0589], zoom_start=12)

# Create markers
folium.Marker([24.943304651124997, 67.10031915579981],
              popup='<strong>Kashif Home</strong>',
              tooltip=tooltip).add_to(m)

# Generate map
m.save('mapnew.html')
Here is my error message- I have installed requests
Error:
(pythonProject1) C:\Users\kashif.raza\PycharmProjects\pythonProject1>python map.py Traceback (most recent call last): File "map.py", line 1, in <module> import folium File "C:\Users\kashif.raza\.conda\envs\pythonProject1\lib\site-packages\folium\__init__.py", line 8, in <module> import branca File "C:\Users\kashif.raza\.conda\envs\pythonProject1\lib\site-packages\branca\__init__.py", line 1, in <module> import branca.colormap as colormap File "C:\Users\kashif.raza\.conda\envs\pythonProject1\lib\site-packages\branca\colormap.py", line 15, in <module> from branca.element import ENV, Figure, JavascriptLink, MacroElement File "C:\Users\kashif.raza\.conda\envs\pythonProject1\lib\site-packages\branca\element.py", line 13, in <module> from urllib.request import urlopen ImportError: No module named request
Reply
#2
it's not asking for requests. it complains about urllib.request
which version of python do you use? it looks like you are using python2
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
You mention you've tried this with python3, but that particular error message is what I'd expect with python2 and that module tries to load..

$ python3 -c "import urllib.request;print('ok')"
ok
$ python2 -c "import urllib.request;print('ok')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named request
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error on import: SyntaxError: source code string cannot contain null bytes kirkwilliams2049 8 21,491 May-21-2025, 07:49 AM
Last Post: Kiongi
  Load a Folium map into a pdf-file Thats_Leet 0 861 Jan-01-2025, 08:13 PM
Last Post: Thats_Leet
  import module error tantony 5 5,210 Dec-15-2022, 01:55 PM
Last Post: Lauraburmrs
  Folium: Conflict with Font Awesome Kit jgomes_eu 0 1,836 Apr-23-2022, 03:18 PM
Last Post: jgomes_eu
  Cryptic Error with import statement Led_Zeppelin 2 3,833 Jan-11-2022, 01:13 PM
Last Post: Led_Zeppelin
  Install any library via pip get an error cannot import name 'SCHEME_KEYS' from 'pip. Anldra12 2 13,224 Jan-04-2022, 01:05 PM
Last Post: Anldra12
  import module with syntax error Skaperen 7 9,187 Jun-22-2021, 10:38 AM
Last Post: Skaperen
  Import Error Christian 3 4,409 Apr-17-2021, 11:27 PM
Last Post: bowlofred
  Import error Beingcode 0 3,104 Nov-20-2020, 02:57 AM
Last Post: Beingcode
Smile Import error with local file colt 1 2,669 Nov-08-2020, 07:56 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020