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
  import module with syntax error Skaperen 7 617 Jun-22-2021, 10:38 AM
Last Post: Skaperen
  Import Error Christian 3 892 Apr-17-2021, 11:27 PM
Last Post: bowlofred
  Import error Beingcode 0 914 Nov-20-2020, 02:57 AM
Last Post: Beingcode
Smile Import error with local file colt 1 624 Nov-08-2020, 07:56 AM
Last Post: Gribouillis
  switch from version 3.5.3 to 3.8.6 get import error python001 9 1,168 Oct-31-2020, 03:02 PM
Last Post: python001
  import yaml error for python3 maiya 4 5,529 Jul-15-2020, 06:07 PM
Last Post: Gribouillis
  Which app do I import to fix this error? ErnestTBass 6 1,794 Apr-26-2020, 08:43 PM
Last Post: snippsat
  Error while humansize module import. johnkgson 3 1,497 Apr-26-2020, 08:37 AM
Last Post: johnkgson
  Importing module from a package results in import error goghvv 2 875 Mar-27-2020, 07:13 PM
Last Post: goghvv
  Python 2.7 Import error. Directory and filename conflict petcoo00 2 926 Feb-02-2020, 08:46 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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