Open RandomForestRanger opened 6 years ago
Thanks for raising this.
I don't know much about Colab. How did you install gmaps
? By running !pip install gmaps
in a notebook?
Thanks for picking this up. Yes, I ran
!pip install gmaps
!pip install ipywidgets
!pip install widgetsnbextension
..and it looks as if Colab doesn't support widgets, and perhaps that's were things fall down. If there's a workaround, or any advice, I'd be most thankful.
gmaps
leans on widgets very heavily. It definitely won't work if you can't get widgets working. I'd also say widgets are a core part of Jupyter, so if you're right that Colab doesn't support them, that's a bit disappointing.
I'm not sure I have much advice beyond either:
Understood and agreed on all points. Thanks Pascal.
I'd actually keep this issue open until we have gmaps working on Colab (even if it isn't a gmaps specific issue).
Got stuck since gmaps example didn't work in Colab. Figured that was a google implementation problem. Got Jupyter Lab working in Anaconda. Same thing... get output of: Figure(layout=FigureLayout(height='420px'))
Went over to Jupyter's Binder site and had the same issue (output doesn't render in notebook). Is there a way to save output to a HTML file?
gmaps definitely works with JupyterLab. Make sure you follow the entire set of instructions.
And yes, you can save the output as html.
The same problem still exists as of Aug 26, 2019. Colab vs gmaps should really work together - aren't they all from the Google shop? ;)
Colab vs gmaps should really work together - aren't they all from the Google shop
I am not in any way affiliated with Google.
gmaps does kind of "work" on Colab if you are alright making an export.html
file per @pbugnion's post above: https://github.com/pbugnion/gmaps/issues/281#issuecomment-441550836
After making the file, you just need to run:
import IPython
IPython.display.HTML(filename='export.html')
gmaps does kind of "work" on Colab if you are alright making an
export.html
file per @pbugnion's post above: #281 (comment)After making the file, you just need to run:
import IPython IPython.display.HTML(filename='export.html')
This works! However the output is not displayed when publishing the notebook to Github. Anyone know a workaround?
Hi guys, I have the same problem as the person who created the link. Can someone explain me how can I see the map by using export.html?
Thanks guys
gmaps does kind of "work" on Colab if you are alright making an
export.html
file per @pbugnion's post above: #281 (comment)After making the file, you just need to run:
import IPython IPython.display.HTML(filename='export.html')
I tried the following block of code
!pip install gmaps
!pip install ipywidgets
!pip install widgetsnbextension
import gmaps
import ipywidgets as widgets
from ipywidgets.embed import embed_minimal_html
import IPython
API_KEY = 'AI...'
gmaps.configure(api_key=API_KEY)
new_york_coordinates = (40.75, -74.00)
fig = gmaps.figure(center=new_york_coordinates, zoom_level=12)
embed_minimal_html('export.html', views=[fig])
IPython.display.HTML(filename="export.html")
This came up:
Something went wrong authenticating with Google Maps. This may be because you did not pass in an API key, or the key you passed in was incorrect.
Check the browser console, look for errors that start with Google Maps API error and compare the message against the Google Maps documentation.
If you see InvalidKeyMapError, the key you passed in is invalid. If you see MissingKeyMapError, you have not passed your API key to jupyter-gmaps. Pass an API key by writing gmaps.configure(api_key="AI...").
Am I missing something?
Something went wrong authenticating with Google Maps. This may be because you did not pass in an API key, or the key you passed in was incorrect.
Check the browser console, look for errors that start with Google Maps API error and compare the message against the Google Maps documentation.
If you see InvalidKeyMapError, the key you passed in is invalid. If you see MissingKeyMapError, you have not passed your API key to jupyter-gmaps. Pass an API key by writing gmaps.configure(api_key="AI...").
Am I missing something?
First, pass the API key. I don't know how IPython works, but, if you use a browser to display the export.html file, then as it said, check your browser console (Ctrl+Shift+J on Chromium), you should see the NotActivateAPI error. The problem here is you are trying to display your map as html web, so you should Enable the Google Maps JavaScript API to let Google knows about it.
I ran these to install (from the terminal): pip install ipywidgets pip install widgetsnbextension
Then ran the code mentioned 2 posts above in Colab: import ipywidgets as widgets from ipywidgets.embed import embed_minimal_html import IPython embed_minimal_html('export.html', views=[fig]) IPython.display.HTML(filename="export.html")
And I got the figure to show in Colab.
Very inexperienced - so this might be a rookie error. Using Colab running python 3. When I run
my only output is
Figure(layout=FigureLayout(height='420px'))
And if I tweak above code by inserting, right at the top,
!jupyter nbextension enable --py --sys-prefix widgetsnbextension
it simply tells me that
ImportError: No module named widgetsnbextension
At a loss, any help, please?