Comments (7)
@ryanbaumann as an FYI, this issue is still haunting Conda Forge over a year later. For anybody looking for the quick fix in the terminal, here it is:
pip uninstall mapboxgl
pip install mapboxgl
from mapboxgl-jupyter.
I have the same issue on my side using Anaconda 2019.07.
I already used your package without any issue.
To solve this issue I had to add the templates folder of your repo in this repo on my mac : ~/anaconda3/lib/python3.7/site-packages/mapboxgl/
now the map is showing inside the iframe, but no data/markers are showing up.
My code :
from mapboxgl.utils import *
from mapboxgl.viz import *
# Generate color stops from colorBrewer
measure_color = 'Appearances'
color_breaks = [round(appearances_per_city[measure_color].quantile(q=x*0.1), 2) for x in range(2, 10)]
color_stops = create_color_stops(color_breaks, colors='Blues')
# Generate radius breaks from data domain and circle-radius range
measure_radius = 'Appearances'
radius_breaks = [round(appearances_per_city[measure_radius].quantile(q=x*0.1) , 2) for x in range(2,10)]
radius_stops = create_radius_stops(radius_breaks, 0.5, 9)
# Create the viz
viz = GraduatedCircleViz('appearances.geojson',
access_token=token,
height='320px',
color_property='Appearances',
color_stops=color_stops,
radius_property='Appearances',
stroke_color='black',
stroke_width=0.5,
radius_stops=radius_stops,
center = (20, 50),
zoom=3,
below_layer='waterway-label')
viz.show()
Here is the error message I get without the template folder :
---------------------------------------------------------------------------
TemplateNotFound Traceback (most recent call last)
<ipython-input-50-f44a65577407> in <module>
27
28
---> 29 viz.show()
~/anaconda3/lib/python3.7/site-packages/mapboxgl/viz.py in show(self, **kwargs)
255 def show(self, **kwargs):
256 # Load the HTML iframe
--> 257 html = self.create_html(**kwargs)
258 map_html = self.as_iframe(html)
259
~/anaconda3/lib/python3.7/site-packages/mapboxgl/viz.py in create_html(self, filename)
355 return None
356 else:
--> 357 return templates.format(self.template, **options)
358
359
~/anaconda3/lib/python3.7/site-packages/mapboxgl/templates.py in format(viz, **kwargs)
9
10 def format(viz, **kwargs):
---> 11 template = env.get_template('{}.html'.format(viz))
12 return template.render(viz=viz, **kwargs)
~/anaconda3/lib/python3.7/site-packages/jinja2/environment.py in get_template(self, name, parent, globals)
828 if parent is not None:
829 name = self.join_path(name, parent)
--> 830 return self._load_template(name, self.make_globals(globals))
831
832 @internalcode
~/anaconda3/lib/python3.7/site-packages/jinja2/environment.py in _load_template(self, name, globals)
802 template.is_up_to_date):
803 return template
--> 804 template = self.loader.load(self, name, globals)
805 if self.cache is not None:
806 self.cache[cache_key] = template
~/anaconda3/lib/python3.7/site-packages/jinja2/loaders.py in load(self, environment, name, globals)
111 # first we try to get the source for this template together
112 # with the filename and the uptodate function.
--> 113 source, filename, uptodate = self.get_source(environment, name)
114
115 # try to load the code from the bytecode cache if there is a
~/anaconda3/lib/python3.7/site-packages/jinja2/loaders.py in get_source(self, environment, template)
233 p = '/'.join((self.package_path,) + tuple(pieces))
234 if not self.provider.has_resource(p):
--> 235 raise TemplateNotFound(template)
236
237 filename = uptodate = None
TemplateNotFound: graduated_circle.html
from mapboxgl-jupyter.
@akacarlyann correct, I did not publish the Anaconda distribution currently in Conda Forge. That's why the issue in this repo (#65) is still open.
from mapboxgl-jupyter.
@Sieboldianus just out of curiosity: are you able to execute any of the notebooks in your conda installation?
from mapboxgl-jupyter.
Yes, I've just tested with cloning the entire Github Repo and walking through the example notebooks folder. I get errors for all of these, e.g.:
linestring-viz.ipynb
~/miniconda3/envs/jupyter_env/lib/python3.7/site-packages/jinja2/loaders.py in load(self, environment, name, globals)
111 # first we try to get the source for this template together
112 # with the filename and the uptodate function.
--> 113 source, filename, uptodate = self.get_source(environment, name)
114
115 # try to load the code from the bytecode cache if there is a
~/miniconda3/envs/jupyter_env/lib/python3.7/site-packages/jinja2/loaders.py in get_source(self, environment, template)
233 p = '/'.join((self.package_path,) + tuple(pieces))
234 if not self.provider.has_resource(p):
--> 235 raise TemplateNotFound(template)
236
237 filename = uptodate = None
TemplateNotFound: linestring.html
image-vis-type-example.ipynb
~/miniconda3/envs/jupyter_env/lib/python3.7/site-packages/jinja2/loaders.py in load(self, environment, name, globals)
111 # first we try to get the source for this template together
112 # with the filename and the uptodate function.
--> 113 source, filename, uptodate = self.get_source(environment, name)
114
115 # try to load the code from the bytecode cache if there is a
~/miniconda3/envs/jupyter_env/lib/python3.7/site-packages/jinja2/loaders.py in get_source(self, environment, template)
233 p = '/'.join((self.package_path,) + tuple(pieces))
234 if not self.provider.has_resource(p):
--> 235 raise TemplateNotFound(template)
236
237 filename = uptodate = None
TemplateNotFound: image.html
Do I have to do anything to set the template resource folder?
from mapboxgl-jupyter.
Ah I see. I'm not sure if the conda distribution task was finished in #65, since that issue is still open. @ryanbaumann do you have more info?
from mapboxgl-jupyter.
There are two archives in PYPI, one the source distribution, and the other a wheel file. The wheel contains the templates folder, but the source distribution doesn't.
The conda package is built using the PYPI source distribution, so the Conda Forge installation results in a module without the templates folder.
I downloaded the wheel file, unzipped it, then copied the templates
folder over to my conda env directory ~/Development/python/miniconda3/envs/csl-load-count-ml/lib/python3.8/site-packages/mapboxgl
. Now my notebook is running OK.
from mapboxgl-jupyter.
Related Issues (20)
- Mapbox Jupyter doesn't render ChoroplethViz HOT 7
- New feature to edit colour legends title
- Coverage/Coveralls hangs indefinitely HOT 1
- Examples don't work as shown, due to Jupyter "Blocking request with no referer" HOT 5
- Support MapboxGL 'step' expression for color and height function types HOT 5
- Is there a way to hide the "token = os.getenv('MAPBOX_ACCESS_TOKEN')" HOT 5
- Will Mapbox add support for JupyterLab? HOT 6
- Please add interactive callback events to this widget.
- Adding search for map HOT 1
- Heat Map in time HOT 3
- Subplot support HOT 4
- How to hide the legends for GraduatedCircleViz? HOT 1
- Example displays base map but not points HOT 2
- any chance multiple viz can be combined in a single view? HOT 1
- viz.create_html() rounds lat/lng to 4 decimal places which drops accuracy to 11m
- How to hide null/Nan values on a CircleViz ? HOT 3
- Uncaught Error: An API access token is required to use Mapbox GL.
- Mapboxgl cannot be imported on Windows 10 after conda install
- mapbox doesn't render points on jupyter notebook running on Databricks. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mapboxgl-jupyter.