Issue
Trying to plot something using geopandas and was also trying to do similar mapping using bokeh, but ran into the same error spent too many hours googling and can't seem to fix it.
I'm running on Mac OS X 10.10.5 running ipython notebook (python 2.7.10) in a virtualenv. I've installed ActiveTLC 8.6.4 on the system. I'm stumped
import geopandas as gp`
from matplotlib import pyplot
df = gp.read_file('TM_WORLD_BORDERS_SIMPL-0.3.shp')
df.plot()
---------------------------------------------------------------------------
TclError Traceback (most recent call last)
<ipython-input-16-4f76bcc16520> in <module>()
----> 1 df.plot()
/Users/thisuser/.virtualenvs/geopandas/lib/python2.7/site-packages/geopandas/geodataframe.pyc in plot(self, *args, **kwargs)
379
380 def plot(self, *args, **kwargs):
--> 381 return plot_dataframe(self, *args, **kwargs)
382
383 def _dataframe_set_geometry(self, col, drop=False, inplace=False, crs=None):
/Users/thisuser/.virtualenvs/geopandas/lib/python2.7/site-packages/geopandas/plotting.pyc in plot_dataframe(s, column, colormap, alpha, categorical, legend, axes, scheme, k)
178
179 if column is None:
--> 180 return plot_series(s.geometry, colormap=colormap, alpha=alpha, axes=axes)
181 else:
182 if s[column].dtype is np.dtype('O'):
/Users/thisuser/.virtualenvs/geopandas/lib/python2.7/site-packages/geopandas/plotting.pyc in plot_series(s, colormap, alpha, axes)
103 import matplotlib.pyplot as plt
104 if axes == None:
--> 105 fig = plt.gcf()
106 fig.add_subplot(111, aspect='equal')
107 ax = plt.gca()
/Users/thisuser/.virtualenvs/geopandas/lib/python2.7/site-packages/matplotlib/pyplot.pyc in gcf()
576 return figManager.canvas.figure
577 else:
--> 578 return figure()
579
580
/Users/thisuser/.virtualenvs/geopandas/lib/python2.7/site-packages/matplotlib/pyplot.pyc in figure(num, figsize, dpi, facecolor, edgecolor, frameon, FigureClass, **kwargs)
525 frameon=frameon,
526 FigureClass=FigureClass,
--> 527 **kwargs)
528
529 if figLabel:
/Users/thisuser/.virtualenvs/geopandas/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.pyc in new_figure_manager(num, *args, **kwargs)
82 FigureClass = kwargs.pop('FigureClass', Figure)
83 figure = FigureClass(*args, **kwargs)
---> 84 return new_figure_manager_given_figure(num, figure)
85
86
/Users/thisuser/.virtualenvs/geopandas/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.pyc in new_figure_manager_given_figure(num, figure)
90 """
91 _focus = windowing.FocusManager()
---> 92 window = Tk.Tk()
93 window.withdraw()
94
/Users/thisuser/anaconda/lib/python2.7/lib-tk/Tkinter.pyc in __init__(self, screenName, baseName, className, useTk, sync, use)
1812 baseName = baseName + ext
1813 interactive = 0
-> 1814 self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
1815 if useTk:
1816 self._loadtk()
TclError: Can't find a usable init.tcl in the following directories:
/opt/anaconda1anaconda2anaconda3/lib/tcl8.5 /Users/thisuser/.virtualenvs/geopandas/lib/tcl8.5 /Users/thisuser/.virtualenvs/lib/tcl8.5 /Users/thisuser/.virtualenvs/geopandas/library /Users/thisuser/.virtualenvs/library /Users/thisuser/.virtualenvs/tcl8.5.18/library /Users/thisuser/tcl8.5.18/library
This probably means that Tcl wasn't installed properly.
Solution
To close this, it was a path issue. I uninstalled anaconda and it seemed to clear things up. Thanks to tcaswell for the tip.
Answered By - Nate
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.