Closed grahamanderson closed 6 years ago
@grahamanderson The output of conda list is a bit different than the one you posted in https://github.com/geopandas/geopandas/issues/562#issuecomment-350042573. Did you make this fresh environment in another way?
This line seems a bit suspicous:
libgdal 2.2.2 7 conda-forge/label/broken
cc @ocefpaf is the above normal? (I am a bit lost with what the situation is nowadays with gdal vs libgdal)
That is odd. One should not get packages from the broken
label without an explicit request :confused:
@jorisvandenbossche and @ocefpaf–– I've been trying a number of different installs...including the broken libgdal. I have been using conda..I could switch to miniconda and try again? Any help is appreciated. With the below install I get the below '...' is for repeating lines
import pandas as pd
import geopandas as gpd
import fiona
div20m = gpd.read_file('./data/geo/cb_2016_us_division_20m')
div20m.head()
Output:
Shell is not a LinearRing
...
IllegalArgumentException: geometries must not contain null elements
Shell is not a LinearRing
Shell is not a LinearRing
...
IllegalArgumentException: geometries must not contain null elements
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~/anaconda3/envs/geotest/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
700 type_pprinters=self.type_printers,
701 deferred_pprinters=self.deferred_printers)
--> 702 printer.pretty(obj)
703 printer.flush()
704 return stream.getvalue()
~/anaconda3/envs/geotest/lib/python3.6/site-packages/IPython/lib/pretty.py in pretty(self, obj)
393 if callable(meth):
394 return meth(obj, self, cycle)
--> 395 return _default_pprint(obj, self, cycle)
396 finally:
397 self.end_group()
~/anaconda3/envs/geotest/lib/python3.6/site-packages/IPython/lib/pretty.py in _default_pprint(obj, p, cycle)
508 if _safe_getattr(klass, '__repr__', None) is not object.__repr__:
509 # A user-provided repr. Find newlines and replace them with p.break_()
--> 510 _repr_pprint(obj, p, cycle)
511 return
512 p.begin_group(1, '<')
~/anaconda3/envs/geotest/lib/python3.6/site-packages/IPython/lib/pretty.py in _repr_pprint(obj, p, cycle)
699 """A pprint that just redirects to the normal repr function."""
700 # Find newlines and replace them with p.break_()
--> 701 output = repr(obj)
702 for idx,output_line in enumerate(output.splitlines()):
703 if idx:
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/core/base.py in __repr__(self)
78 Yields Bytestring in Py2, Unicode String in py3.
79 """
---> 80 return str(self)
81
82
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/core/base.py in __str__(self)
57
58 if compat.PY3:
---> 59 return self.__unicode__()
60 return self.__bytes__()
61
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/core/frame.py in __unicode__(self)
634 width = None
635 self.to_string(buf=buf, max_rows=max_rows, max_cols=max_cols,
--> 636 line_width=width, show_dimensions=show_dimensions)
637
638 return buf.getvalue()
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/core/frame.py in to_string(self, buf, columns, col_space, header, index, na_rep, formatters, float_format, sparsify, index_names, justify, line_width, max_rows, max_cols, show_dimensions)
1673 max_cols=max_cols,
1674 show_dimensions=show_dimensions)
-> 1675 formatter.to_string()
1676
1677 if buf is None:
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in to_string(self)
596 else:
597
--> 598 strcols = self._to_str_columns()
599 if self.line_width is None: # no need to wrap around just print
600 # the whole frame
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in _to_str_columns(self)
531 header_colwidth = max(self.col_space or 0,
532 *(self.adj.len(x) for x in cheader))
--> 533 fmt_values = self._format_col(i)
534 fmt_values = _make_fixed_width(fmt_values, self.justify,
535 minimum=header_colwidth,
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in _format_col(self, i)
707 return format_array(values_to_format, formatter,
708 float_format=self.float_format, na_rep=self.na_rep,
--> 709 space=self.col_space, decimal=self.decimal)
710
711 def to_html(self, classes=None, notebook=False, border=None):
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in format_array(values, formatter, float_format, na_rep, digits, space, justify, decimal)
1812 space=space, justify=justify, decimal=decimal)
1813
-> 1814 return fmt_obj.get_result()
1815
1816
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in get_result(self)
1832
1833 def get_result(self):
-> 1834 fmt_values = self._format_strings()
1835 return _make_fixed_width(fmt_values, self.justify)
1836
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in _format_strings(self)
1878 fmt_values.append(float_format(v))
1879 else:
-> 1880 fmt_values.append(u' {v}'.format(v=_format(v)))
1881
1882 return fmt_values
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in _format(x)
1860 else:
1861 # object dtype
-> 1862 return u'{x}'.format(x=formatter(x))
1863
1864 vals = self.values
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in <lambda>(x)
1847 formatter = (
1848 self.formatter if self.formatter is not None else
-> 1849 (lambda x: pprint_thing(x, escape_chars=('\t', '\r', '\n'))))
1850
1851 def _format(x):
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/printing.py in pprint_thing(thing, _nest_lvl, escape_chars, default_escapes, quote_strings, max_seq_items)
228 result = fmt.format(thing=as_escaped_unicode(thing))
229 else:
--> 230 result = as_escaped_unicode(thing)
231
232 return compat.text_type(result) # always unicode
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/printing.py in as_escaped_unicode(thing, escape_chars)
191
192 try:
--> 193 result = compat.text_type(thing) # we should try this first
194 except UnicodeDecodeError:
195 # either utf-8 or we replace errors
~/anaconda3/envs/geotest/lib/python3.6/site-packages/shapely/geometry/base.py in __str__(self)
236
237 def __str__(self):
--> 238 return self.wkt
239
240 # To support pickling
~/anaconda3/envs/geotest/lib/python3.6/site-packages/shapely/geometry/base.py in wkt(self, **kw)
365 def wkt(self, **kw):
366 """WKT representation of the geometry"""
--> 367 return WKTWriter(lgeos, **kw).write(self)
368
369 @property
~/anaconda3/envs/geotest/lib/python3.6/site-packages/shapely/geos.py in write(self, geom)
360 """Returns WKT string for geometry"""
361 if geom is None or geom._geom is None:
--> 362 raise ValueError("Null geometry supports no operations")
363 result = self._lgeos.GEOSWKTWriter_write(self._writer, geom._geom)
364 text = string_at(result)
ValueError: Null geometry supports no operations
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~/anaconda3/envs/geotest/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
343 method = get_real_method(obj, self.print_method)
344 if method is not None:
--> 345 return method()
346 return None
347 else:
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/core/frame.py in _repr_html_(self)
667
668 return self.to_html(max_rows=max_rows, max_cols=max_cols,
--> 669 show_dimensions=show_dimensions, notebook=True)
670 else:
671 return None
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/core/frame.py in to_html(self, buf, columns, col_space, header, index, na_rep, formatters, float_format, sparsify, index_names, justify, bold_rows, classes, escape, max_rows, max_cols, show_dimensions, notebook, decimal, border)
1732 decimal=decimal)
1733 # TODO: a generic formatter wld b in DataFrameFormatter
-> 1734 formatter.to_html(classes=classes, notebook=notebook, border=border)
1735
1736 if buf is None:
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in to_html(self, classes, notebook, border)
732 border=border)
733 if hasattr(self.buf, 'write'):
--> 734 html_renderer.write_result(self.buf)
735 elif isinstance(self.buf, compat.string_types):
736 with open(self.buf, 'w') as f:
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in write_result(self, buf)
1206 indent += self.indent_delta
1207 indent = self._write_header(indent)
-> 1208 indent = self._write_body(indent)
1209
1210 self.write('</table>', indent)
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in _write_body(self, indent)
1362 fmt_values = {}
1363 for i in range(min(len(self.columns), self.max_cols)):
-> 1364 fmt_values[i] = self.fmt._format_col(i)
1365
1366 # write values
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in _format_col(self, i)
707 return format_array(values_to_format, formatter,
708 float_format=self.float_format, na_rep=self.na_rep,
--> 709 space=self.col_space, decimal=self.decimal)
710
711 def to_html(self, classes=None, notebook=False, border=None):
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in format_array(values, formatter, float_format, na_rep, digits, space, justify, decimal)
1812 space=space, justify=justify, decimal=decimal)
1813
-> 1814 return fmt_obj.get_result()
1815
1816
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in get_result(self)
1832
1833 def get_result(self):
-> 1834 fmt_values = self._format_strings()
1835 return _make_fixed_width(fmt_values, self.justify)
1836
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in _format_strings(self)
1878 fmt_values.append(float_format(v))
1879 else:
-> 1880 fmt_values.append(u' {v}'.format(v=_format(v)))
1881
1882 return fmt_values
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in _format(x)
1860 else:
1861 # object dtype
-> 1862 return u'{x}'.format(x=formatter(x))
1863
1864 vals = self.values
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/format.py in <lambda>(x)
1847 formatter = (
1848 self.formatter if self.formatter is not None else
-> 1849 (lambda x: pprint_thing(x, escape_chars=('\t', '\r', '\n'))))
1850
1851 def _format(x):
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/printing.py in pprint_thing(thing, _nest_lvl, escape_chars, default_escapes, quote_strings, max_seq_items)
228 result = fmt.format(thing=as_escaped_unicode(thing))
229 else:
--> 230 result = as_escaped_unicode(thing)
231
232 return compat.text_type(result) # always unicode
~/anaconda3/envs/geotest/lib/python3.6/site-packages/pandas/io/formats/printing.py in as_escaped_unicode(thing, escape_chars)
191
192 try:
--> 193 result = compat.text_type(thing) # we should try this first
194 except UnicodeDecodeError:
195 # either utf-8 or we replace errors
~/anaconda3/envs/geotest/lib/python3.6/site-packages/shapely/geometry/base.py in __str__(self)
236
237 def __str__(self):
--> 238 return self.wkt
239
240 # To support pickling
~/anaconda3/envs/geotest/lib/python3.6/site-packages/shapely/geometry/base.py in wkt(self, **kw)
365 def wkt(self, **kw):
366 """WKT representation of the geometry"""
--> 367 return WKTWriter(lgeos, **kw).write(self)
368
369 @property
~/anaconda3/envs/geotest/lib/python3.6/site-packages/shapely/geos.py in write(self, geom)
360 """Returns WKT string for geometry"""
361 if geom is None or geom._geom is None:
--> 362 raise ValueError("Null geometry supports no operations")
363 result = self._lgeos.GEOSWKTWriter_write(self._writer, geom._geom)
364 text = string_at(result)
ValueError: Null geometry supports no operations
Here is my current (not working) conda list
appnope 0.1.0 py36_0 conda-forge
backports 1.0 py36_1 conda-forge
backports.functools_lru_cache 1.4 py36_1 conda-forge
bleach 2.0.0 py36_0 conda-forge
boost 1.65.1 py36_0 conda-forge
boost-cpp 1.65.1 1 conda-forge
bzip2 1.0.6 1 conda-forge
ca-certificates 2017.11.5 0 conda-forge
cairo 1.14.6 5 conda-forge
certifi 2017.11.5 py36_0 conda-forge
click 6.7 py36_0 conda-forge
click-plugins 1.0.3 py36_0 conda-forge
cligj 0.4.0 py36_0 conda-forge
curl 7.55.1 0 conda-forge
cycler 0.10.0 py36_0 conda-forge
decorator 4.1.2 py36_0 conda-forge
descartes 1.1.0 py36_0 conda-forge
entrypoints 0.2.3 py36_1 conda-forge
expat 2.1.0 3 conda-forge
fiona 1.7.10 py36_2 conda-forge
fontconfig 2.12.1 6 conda-forge
freetype 2.7 2 conda-forge
freexl 1.0.4 0 conda-forge
gdal 2.1.4 py36_2 conda-forge
geopandas 0.3.0 py36_0 conda-forge
geos 3.6.2 1 conda-forge
geotiff 1.4.2 0 conda-forge
gettext 0.19.8.1 0 conda-forge
giflib 5.1.4 0 conda-forge
glib 2.51.4 0 conda-forge
hdf4 4.2.13 0 conda-forge
hdf5 1.10.1 1 conda-forge
html5lib 0.999999999 py36_0 conda-forge
icu 58.2 0 conda-forge
intel-openmp 2018.0.0 h8158457_8
ipykernel 4.7.0 py36_0 conda-forge
ipython 6.2.1 py36_0 conda-forge
ipython_genutils 0.2.0 py36_0 conda-forge
jedi 0.10.2 py36_0 conda-forge
jinja2 2.10 py36_0 conda-forge
jpeg 9b 2 conda-forge
json-c 0.12.1 0 conda-forge
jsonschema 2.6.0 py36_0 conda-forge
jupyter_client 5.1.0 py36_0 conda-forge
jupyter_contrib_core 0.3.3 py36_0 conda-forge
jupyter_core 4.4.0 py_0 conda-forge
jupyter_nbextensions_configurator 0.2.8 py36_0 conda-forge
kealib 1.4.7 4 conda-forge
krb5 1.14.2 0 conda-forge
libcxx 4.0.1 h579ed51_0
libcxxabi 4.0.1 hebd6815_0
libdap4 3.18.3 2 conda-forge
libffi 3.2.1 3 conda-forge
libgdal 2.1.4 8 conda-forge
libgfortran 3.0.1 h93005f0_2
libiconv 1.15 0 conda-forge
libkml 1.3.0 4 conda-forge
libnetcdf 4.4.1.1 10 conda-forge
libpng 1.6.28 2 conda-forge
libpq 9.6.3 0 conda-forge
libsodium 1.0.15 1 conda-forge
libspatialindex 1.8.5 1 conda-forge
libspatialite 4.3.0a 18 conda-forge
libssh2 1.8.0 2 conda-forge
libtiff 4.0.7 1 conda-forge
libxml2 2.9.5 2 conda-forge
markupsafe 1.0 py36_0 conda-forge
matplotlib 2.1.0 py36_1 conda-forge
mistune 0.8.3 py_0 conda-forge
mkl 2018.0.1 hfbd8650_4
munch 2.2.0 py36_0 conda-forge
nbconvert 5.3.1 py_1 conda-forge
nbformat 4.4.0 py36_0 conda-forge
ncurses 5.9 10 conda-forge
notebook 5.2.2 py36_1 conda-forge
numpy 1.13.3 py36h2cdce51_0
openjpeg 2.1.2 2 conda-forge
openssl 1.0.2m 0 conda-forge
pandas 0.21.0 py36_0 conda-forge
pandoc 2.0.4 0 conda-forge
pandocfilters 1.4.1 py36_0 conda-forge
pcre 8.39 0 conda-forge
pexpect 4.3.0 py36_0 conda-forge
pickleshare 0.7.4 py36_0 conda-forge
pip 9.0.1 py36_0 conda-forge
pixman 0.34.0 1 conda-forge
poppler 0.61.1 1 conda-forge
poppler-data 0.4.8 0 conda-forge
proj4 4.9.3 5 conda-forge
prompt_toolkit 1.0.15 py36_0 conda-forge
psycopg2 2.7.3.2 py36_0 conda-forge
ptyprocess 0.5.2 py36_0 conda-forge
pygments 2.2.0 py36_0 conda-forge
pyparsing 2.2.0 py36_0 conda-forge
pyproj 1.9.5.1 py36_0 conda-forge
pysal 1.14.3 py36_0 conda-forge
python 3.6.3 1 conda-forge
python-dateutil 2.6.1 py36_0 conda-forge
pytz 2017.3 py_2 conda-forge
pyyaml 3.12 py36_1 conda-forge
pyzmq 16.0.2 py36_2 conda-forge
readline 6.2 0 conda-forge
rtree 0.8.3 py36_0 conda-forge
scipy 1.0.0 py36h1de22e9_0
setuptools 38.2.4 py36_0 conda-forge
shapely 1.6.2 py36_1 conda-forge
simplegeneric 0.8.1 py36_0 conda-forge
six 1.11.0 py36_1 conda-forge
sqlalchemy 1.1.13 py36_0 conda-forge
sqlite 3.13.0 1 conda-forge
terminado 0.8.1 py36_0 conda-forge
testpath 0.3.1 py36_0 conda-forge
tk 8.5.19 2 conda-forge
tornado 4.5.2 py36_0 conda-forge
traitlets 4.3.2 py36_0 conda-forge
wcwidth 0.1.7 py36_0 conda-forge
webencodings 0.5 py36_0 conda-forge
wheel 0.30.0 py_1 conda-forge
xerces-c 3.2.0 0 conda-forge
xz 5.2.3 0 conda-forge
yaml 0.1.7 0 conda-forge
yapf 0.18.0 py_0 conda-forge
zeromq 4.2.1 1 conda-forge
zlib 1.2.11 0 conda-forge
But you did try it in a clean test environment? (in that case it does not matter if your base installation comes from anaconda or miniconda)
@grahamanderson only a clean env would be OK for us to debug this. First of all remove any other channel from you .condarc
that is not defaults
or conda-forge
(even sub-channels, or labels, from like the broken one). Make sure conda-forge
is on top of defaults
. Then try:
conda create --yes --name TEST python=3.6 geopandas
source activate TEST
<read your file>
This works for me on Linux as expected. Closing this b/c, based on your conda list
, this is not an issue with the package but with our channel configuration.
In the comment here https://github.com/geopandas/geopandas/issues/562#issuecomment-350042573, @grahamanderson you seem to indicate that you tested in a clean environment. If so, please indicate here. But indeed as @ocefpaf you have to be careful about the channels.
My .condarc in my Home Directory is
channels:
- conda-forge
- defaults
ssl_verify: true
@ocefpaf I created a new Environment TEST as you specified. I also ran the code directly in python rather than in Jupyter. The below code still gives the error below. Any help is appreciated. FYI, my install was working b/f I upgraded to High Sierra Mac and (currently Geopandas/Fiona works fine on my Ubuntu instance on Google Cloud. Perhaps, other Mac users are going through the same thing? Thankfully, I decided to upgrade my OS post deadline.
# In the terminal Python prompt
import pandas as pd
import geopandas as gpd
import fiona
div20m = gpd.read_file('./data/geo/cb_2016_us_division_20m')
div20m.head()
# Error
Shell is not a LinearRing
Shell is not a LinearRing
Shell is not a LinearRing
Shell is not a LinearRing
Shell is not a LinearRing
IllegalArgumentException: geometries must not contain null elements
My conda list with the the TEST environment is:
(TEST) robert$ conda list
# packages in environment at /Users/robert/anaconda3/envs/TEST:
#
backports 1.0 py36_1 conda-forge
backports.functools_lru_cache 1.4 py36_1 conda-forge
ca-certificates 2017.11.5 0 conda-forge
certifi 2017.11.5 py36_0 conda-forge
click 6.7 py36_0 conda-forge
click-plugins 1.0.3 py36_0 conda-forge
cligj 0.4.0 py36_0 conda-forge
curl 7.55.1 0 conda-forge
cycler 0.10.0 py36_0 conda-forge
descartes 1.1.0 py36_0 conda-forge
expat 2.1.0 3 conda-forge
fiona 1.7.10 py36_2 conda-forge
freetype 2.7 2 conda-forge
freexl 1.0.4 0 conda-forge
gdal 2.1.3 py36_7 conda-forge
geopandas 0.3.0 py36_0 conda-forge
geos 3.6.2 1 conda-forge
giflib 5.1.4 0 conda-forge
hdf4 4.2.13 0 conda-forge
hdf5 1.10.1 1 conda-forge
icu 58.2 0 conda-forge
intel-openmp 2018.0.0 h8158457_8
jpeg 9b 2 conda-forge
json-c 0.12.1 0 conda-forge
kealib 1.4.7 4 conda-forge
krb5 1.14.2 0 conda-forge
libcxx 4.0.1 h579ed51_0
libcxxabi 4.0.1 hebd6815_0
libdap4 3.18.3 2 conda-forge
libgfortran 3.0.1 h93005f0_2
libiconv 1.15 0 conda-forge
libnetcdf 4.4.1.1 10 conda-forge
libpng 1.6.28 2 conda-forge
libpq 9.6.3 0 conda-forge
libspatialindex 1.8.5 1 conda-forge
libspatialite 4.3.0a 18 conda-forge
libssh2 1.8.0 2 conda-forge
libtiff 4.0.9 0 conda-forge
libxml2 2.9.5 2 conda-forge
matplotlib 2.1.0 py36_1 conda-forge
mkl 2018.0.1 hfbd8650_4
munch 2.2.0 py36_0 conda-forge
ncurses 5.9 10 conda-forge
numpy 1.13.3 py36h2cdce51_0
openjpeg 2.1.2 2 conda-forge
openssl 1.0.2m 0 conda-forge
pandas 0.21.0 py36_0 conda-forge
pcre 8.39 0 conda-forge
pip 9.0.1 py36_0 conda-forge
proj4 4.9.3 5 conda-forge
psycopg2 2.7.3.2 py36_0 conda-forge
pyparsing 2.2.0 py36_0 conda-forge
pyproj 1.9.5.1 py36_0 conda-forge
pysal 1.14.3 py36_0 conda-forge
python 3.6.3 1 conda-forge
python-dateutil 2.6.1 py36_0 conda-forge
pytz 2017.3 py_2 conda-forge
readline 6.2 0 conda-forge
rtree 0.8.3 py36_0 conda-forge
scipy 1.0.0 py36h1de22e9_0
setuptools 38.2.4 py36_0 conda-forge
shapely 1.6.2 py36_1 conda-forge
six 1.11.0 py36_1 conda-forge
sqlalchemy 1.1.13 py36_0 conda-forge
sqlite 3.13.0 1 conda-forge
tk 8.5.19 2 conda-forge
tornado 4.5.2 py36_0 conda-forge
wheel 0.30.0 py_1 conda-forge
xerces-c 3.2.0 0 conda-forge
xz 5.2.3 0 conda-forge
zlib 1.2.11 0 conda-forge
In the comment here geopandas/geopandas#562 (comment)
Indeed that does look like a clean env and looks like mine. However, everything works as expected for me. Can you share you data so we can check it?
We have had previous reports with a similar error message: https://github.com/geopandas/geopandas/issues/556 and https://github.com/geopandas/geopandas/issues/562, both also on mac (but don't know which version). They solved it by installing through pip .. which seems to indicate it is a conda-forge build issue with fiona / gdal or one of its dependencies
so, to install and empty environment with PIP, should I ? conda create --yes --name PIP_TEST python=3.6 pip install geopandas source activate PIP_TEST
On my end, I'm not even sure how you would run geopandas without Fiona. The two seem intertwined. Perhaos, there is an alternate to fiona-gdal for opening these geo files?
I don't have a Mac to test it but I'll add an extra test with @grahamanderson data on Travis-CI. Let's re-open this then.
Using the same data as above, this is the whole set of commands I've been running to the same error.
OSX El Capitan 10.11.6 Python 3.6.3
conda create --yes --name GEOTEST python=3.6
source activate GEOTEST
conda install --yes -c conda-forge --override-channels geopandas libgdal osmnx
conda remove --yes geopandas osmnx
pip install geopandas osmnx
python -c "import geopandas as gpd; div20m = gpd.read_file('./Documents/geo/cb_2016_us_division_20m.shp'); div20m.head()"
conda list
# packages in environment at /Users/civisemployee/anaconda3/envs/GEOTEST:
#
altair 1.2.1 py_0 conda-forge
appnope 0.1.0 py36_0 conda-forge
asn1crypto 0.22.0 py36_0 conda-forge
backports 1.0 py36_1 conda-forge
backports.functools_lru_cache 1.4 py36_1 conda-forge
bleach 2.0.0 py36_0 conda-forge
boost 1.65.1 py36_0 conda-forge
boost-cpp 1.65.1 1 conda-forge
branca 0.2.0 py_1 conda-forge
bzip2 1.0.6 1 conda-forge
ca-certificates 2017.08.26 ha1e5d58_0
cairo 1.14.6 5 conda-forge
certifi 2017.11.5 py36ha569be9_0
cffi 1.11.2 py36_0 conda-forge
chardet 3.0.4 py36_0 conda-forge
click 6.7 py36_0 conda-forge
click-plugins 1.0.3 py36_0 conda-forge
cligj 0.4.0 py36_0 conda-forge
cryptography 2.1.4 py36_0 conda-forge
curl 7.55.1 0 conda-forge
cycler 0.10.0 py36_0 conda-forge
decorator 4.1.2 py36_0 conda-forge
descartes 1.1.0 py36_0 conda-forge
entrypoints 0.2.3 py36_1 conda-forge
expat 2.1.0 3 conda-forge
fiona 1.7.10 py36h42caba7_0
folium 0.5.0 py_0 conda-forge
fontconfig 2.12.1 6 conda-forge
freetype 2.7 2 conda-forge
freexl 1.0.4 0 conda-forge
gdal 2.2.3 py36_0 conda-forge
geopandas 0.3.0 <pip>
geopy 1.11.0 py36_0 conda-forge
geos 3.6.2 1 conda-forge
geotiff 1.4.2 0 conda-forge
gettext 0.19.8.1 0 conda-forge
giflib 5.1.4 0 conda-forge
glib 2.51.4 0 conda-forge
hdf4 4.2.13 0 conda-forge
hdf5 1.10.1 1 conda-forge
html5lib 1.0.1 py_0 conda-forge
icu 58.2 0 conda-forge
idna 2.6 py36_1 conda-forge
intel-openmp 2018.0.0 h8158457_8
ipykernel 4.7.0 py36_0 conda-forge
ipython 6.2.1 py36_0 conda-forge
ipython_genutils 0.2.0 py36_0 conda-forge
jedi 0.10.2 py36_0 conda-forge
jinja2 2.10 py36_0 conda-forge
jpeg 9b 2 conda-forge
json-c 0.12.1 0 conda-forge
jsonschema 2.6.0 py36_0 conda-forge
jupyter_client 5.1.0 py36_0 conda-forge
jupyter_core 4.4.0 py_0 conda-forge
kealib 1.4.7 4 conda-forge
krb5 1.14.2 0 conda-forge
libcxx 4.0.1 h579ed51_0
libcxxabi 4.0.1 hebd6815_0
libdap4 3.18.3 2 conda-forge
libedit 3.1 hb4e282d_0
libffi 3.2.1 h475c297_4
libgdal 2.2.3 1 conda-forge
libgfortran 3.0.1 h93005f0_2
libiconv 1.15 0 conda-forge
libkml 1.3.0 4 conda-forge
libnetcdf 4.4.1.1 10 conda-forge
libpng 1.6.28 2 conda-forge
libpq 9.6.3 0 conda-forge
libsodium 1.0.15 1 conda-forge
libspatialindex 1.8.5 1 conda-forge
libspatialite 4.3.0a 18 conda-forge
libssh2 1.8.0 2 conda-forge
libtiff 4.0.7 1 conda-forge
libxml2 2.9.5 2 conda-forge
markupsafe 1.0 py36_0 conda-forge
matplotlib 2.1.1 py36_0 conda-forge
mistune 0.8.3 py_0 conda-forge
mkl 2018.0.1 hfbd8650_4
munch 2.2.0 py36_0 conda-forge
nbconvert 5.3.1 py_1 conda-forge
nbformat 4.4.0 py36_0 conda-forge
ncurses 6.0 hd04f020_2
networkx 2.0 py36_1 conda-forge
notebook 5.2.2 py36_1 conda-forge
numpy 1.13.3 py36h2cdce51_0
openjpeg 2.3.0 1 conda-forge
openssl 1.0.2n hdbc3d79_0
osmnx 0.6 <pip>
pandas 0.21.0 py36_0 conda-forge
pandoc 2.0.4 0 conda-forge
pandocfilters 1.4.1 py36_0 conda-forge
pcre 8.39 0 conda-forge
pexpect 4.3.0 py36_0 conda-forge
pickleshare 0.7.4 py36_0 conda-forge
pip 9.0.1 py36h1555ced_4
pixman 0.34.0 1 conda-forge
poppler 0.61.1 2 conda-forge
poppler-data 0.4.8 0 conda-forge
proj4 4.9.3 5 conda-forge
prompt_toolkit 1.0.15 py36_0 conda-forge
psycopg2 2.7.3.2 py36_0 conda-forge
ptyprocess 0.5.2 py36_0 conda-forge
pycparser 2.18 py36_0 conda-forge
pygments 2.2.0 py36_0 conda-forge
pyopenssl 17.4.0 py36_0 conda-forge
pyparsing 2.2.0 py36_0 conda-forge
pyproj 1.9.5.1 py36_0 conda-forge
pysal 1.14.3 py36_0 conda-forge
pysocks 1.6.7 py36_0 conda-forge
python 3.6.3 1 conda-forge
python-dateutil 2.6.1 py36_0 conda-forge
pytz 2017.3 py_2 conda-forge
pyzmq 16.0.2 py36_2 conda-forge
readline 6.2 2
requests 2.18.4 py36_1 conda-forge
rtree 0.8.3 py36_0 conda-forge
scipy 1.0.0 py36h1de22e9_0
setuptools 36.5.0 py36h2134326_0
shapely 1.6.3 py36_0 conda-forge
simplegeneric 0.8.1 py36_0 conda-forge
six 1.11.0 py36_1 conda-forge
sqlalchemy 1.1.13 py36_0 conda-forge
sqlite 3.13.0 1 conda-forge
terminado 0.8.1 py36_0 conda-forge
testpath 0.3.1 py36_0 conda-forge
tk 8.5.19 2 conda-forge
tornado 4.5.2 py36_0 conda-forge
traitlets 4.3.2 py36_0 conda-forge
urllib3 1.22 py36_0 conda-forge
vega 0.4.4 py36_1 conda-forge
vincent 0.4.4 py36_0 conda-forge
wcwidth 0.1.7 py36_0 conda-forge
webencodings 0.5 py36_0 conda-forge
wheel 0.30.0 py36h5eb2c71_1
xerces-c 3.2.0 0 conda-forge
xz 5.2.3 h0278029_2
zeromq 4.2.1 1 conda-forge
zlib 1.2.11 hf3cbc9b_2
@ffaristocrat you fiona is coming from defaults
. Mixing packages like that is a no-no.
When I do the install of geopandas from conda-forge as above, it's installing the defaults version of fiona even though I'm doing override channels.
In any case, I went back, added fiona to the install with geopandas and libgdal and got the same error.
So it seems the --override-channels
is not really doing what you want. Can you try with setting conda-forge as the first channel in condarc? (you can always change it back afterwards)
In any case, I went back, added fiona to the install with geopandas and libgdal and got the same error.
to be clear, you mean you also installed it with pip?
Used conda to do the install. I did
conda config --add channels conda-forge
killed the env and restarted the whole thing and it still installed the wrong fiona, same with libgdal, numpy, scipy & libgfortran. You have to install them specifically to get it to the right flavor from conda-forge.
Current workflow
source deactivate
conda env remove --yes --name GEOTEST
conda create --yes --name GEOTEST python=3.6
source activate GEOTEST
conda install --yes -c conda-forge --override-channels geopandas libgdal fiona numpy scipy libgfortran
python -c "import geopandas as gpd; div20m = gpd.read_file('cb_2016_us_division_20m.shp');"
conda remove --yes geopandas
pip install geopandas
python -c "import geopandas as gpd; div20m = gpd.read_file('cb_2016_us_division_20m.shp');"
conda list
Same error still. Trying to walk through with the debugger to see where it's failing exactly.
Edit: I'm doing the test before and after I uninstall/pip install geopandas to see if that's making a difference.
It seems like the problem is with shapely. If I remove geopandas, fiona and shapely via conda and then pip install them instead, the one line test works.
source deactivate
conda env remove --yes --name GEOTEST
conda create --yes --name GEOTEST python=3.6
source activate GEOTEST
conda install --yes -c conda-forge --override-channels geopandas libgdal fiona numpy scipy libgfortran libgfortran
conda remove --yes geopandas fiona shapely
pip install fiona shapely geopandas
python -c "import geopandas as gpd; div20m = gpd.read_file('cb_2016_us_division_20m.shp');"
conda list
I'm going to see if everything else works.
After I pip install osmnx and run the little bit of code that sent me down this rabbit hole in the first place, that also works on OSX now.
Yep, what @ffaristocrat said works for me too. Had to remove shapely, fiona and geopandas via conda and then install back with pip. Same original problem. Hope this helps the next person who runs into this!
Note that we are seeing some incompatibilities in the latest OS X system and shapely. I cannot reproduce that using the OS X VM available in Travis-CI and I do not own a mac to research this further.
Using pip works b/c they are static linked, this suggests that latest OS X may have a system wide geos
installed, not sure. If so, the patch we have to find conda
geos is not working :unamused:
TL;DR I have no idea what the issue really is and I do not have the tools to fix it.
@ocefpaf are there things that people with a mac (where the issue manifests) can do to help? Eg is there a way they can check which geos installation shapely finds?
I also don't have a mac, so can't help out.
Eg is there a way they can check which geos installation shapely finds?
One could try to dig into shapely's code and see what is the look up path for geos
. In theory the latest version should always check for conda first, but I never confirmed that.
I know you have shapely._buildcfg.get_geos_config()
, but not sure that gives what you want in this case (we use that in geopandas to find the geos to build against (to use the same that shapely is build against)).
get_geos_config('--prefix')
should help. Ideally we everything under the sun there would be better. The options are: --prefix
, --version
, --libs
, --clibs
, --cclibs
, --static-clibs
, --static-cclibs
, --cflags
, --ldflags
, --includes
, and --jtsport
.
@ffaristocrat's solution worked for me :) Thank you.
@ffaristocrat Thanks! This partially worked for me!
I had a similar issue with these errors: Shell is not a linear ring and ModuleNotFoundError: No module named 'osmnx'.
I used your suggested process of uninstalling and pip installing shapely, geopandas, and fiona. I then tried to run the script again and then the no module error came up. I then pip installed osmnx and avoided the conda installation. This made my installation and the suggested code on github page work. Thanks again!
pip install osmnx
I finally found someone with a Mac willing to help me debug this and our conclusion is that geos
from homebrew can interfere with shapely when installed, affecting all packages that use shapely
. We did have a patch to avoid this but somehow homebrew's geos
is still getting in the way.
Either way this is not a bug with the conda package or geopandas so I'm closing this.
If you experience this issue and must use conda try to remove any previous installation of geos
you may have.
Hi I'm getting a 'Shell is not a LinearRing' error when using fiona and geopandas. I made a fresh vm with conda for the test below. Any help is appreciated
Gives multiple 'Shell is not a LinearRing' errors.
This below gives the same ''Shell is not a LinearRing' error:
__ Mac OS High Sierra (10.13.1) Python 3.62 My Conda List