Giter VIP home page Giter VIP logo

Comments (7)

raerickson avatar raerickson commented on August 24, 2024 5

@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.

pybanaszak avatar pybanaszak commented on August 24, 2024 1

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.

ryanbaumann avatar ryanbaumann commented on August 24, 2024 1

@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.

akacarlyann avatar akacarlyann commented on August 24, 2024

@Sieboldianus just out of curiosity: are you able to execute any of the notebooks in your conda installation?

from mapboxgl-jupyter.

Sieboldianus avatar Sieboldianus commented on August 24, 2024

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.

akacarlyann avatar akacarlyann commented on August 24, 2024

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.

kinow avatar kinow commented on August 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.