Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vectorized on Python 3.8 #810

Closed
mikedh opened this issue Dec 21, 2019 · 6 comments
Closed

vectorized on Python 3.8 #810

mikedh opened this issue Dec 21, 2019 · 6 comments

Comments

@mikedh
Copy link

mikedh commented Dec 21, 2019

It looks like from shapely import vectorized fails on Python 3.8 when Shapely is installed via pip:

    from shapely import vectorized
>   from ._vectorized import (contains, touches)
E   ModuleNotFoundError: No module named 'shapely.vectorized._vectorized'

https://travis-ci.org/mikedh/trimesh/jobs/627984786#L1423-L1426
I saw some "in the wild" reports of this too, though not sure what Python they were on:
mikedh/trimesh#667

@sgillies
Copy link
Contributor

@mikedh are you trying to pip install shapely into a conda environment? I see a hint of that at https://travis-ci.org/mikedh/trimesh/jobs/627984786#L1048. While this may work for pure-python packages, it cannot work for packages that include extension modules as shapely does. You simply cannot pip install the shapely wheels on PyPI into a conda environment, you must get shapely from a conda channel like conda-forge.

@mikedh
Copy link
Author

mikedh commented Dec 26, 2019

Yeah, pip install in conda python is slightly odd, but I think issue is elsewhere and it is reproducible on mainline Python. Here's a minimal reproducing Dockerfile:

FROM python:3.8-slim-buster
RUN apt-get update; apt-get install -y libgeos-dev
RUN pip install numpy shapely
RUN python -c "from shapely import vectorized"

Fails with:

Step 4/4 : RUN python -c "from shapely import vectorized"
 ---> Running in 9f5d06d595d1
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/shapely/vectorized/__init__.py", line 3, in <module>
    from ._vectorized import (contains, touches)
ModuleNotFoundError: No module named 'shapely.vectorized._vectorized'
The command '/bin/sh -c python -c "from shapely import vectorized"' returned a non-zero code: 1

@mikedh
Copy link
Author

mikedh commented Dec 26, 2019

Did a little debugging and tried a few things, none of which worked. For reference here is a slightly more useful Dockerfile:

FROM python:3.8-slim-buster
RUN apt-get update; apt-get install -y  --no-install-recommends git libgeos-dev
RUN pip install numpy cython
# COPY Shapely Shapely
RUN git	clone https://github.com/Toblerity/Shapely.git
RUN cd Shapely; python setup.py install
RUN python -c "from shapely import vectorized"

And the full output of the shapely build steps:

Step 4/6 : RUN git clone https://github.com/Toblerity/Shapely.git
 ---> Running in 89f7b2d15e03
Cloning into 'Shapely'...
 ---> e587d161685e
Removing intermediate container 89f7b2d15e03
Step 5/6 : RUN cd Shapely; python setup.py install
 ---> Running in 4e118ceb8e71
/usr/local/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /Shapely/shapely/speedups/_speedups.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
running install
running bdist_egg
running egg_info
creating Shapely.egg-info
writing Shapely.egg-info/PKG-INFO
writing dependency_links to Shapely.egg-info/dependency_links.txt
writing requirements to Shapely.egg-info/requires.txt
writing top-level names to Shapely.egg-info/top_level.txt
writing manifest file 'Shapely.egg-info/SOURCES.txt'
reading manifest file 'Shapely.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'manual'
no previously-included directories found matching 'debian'
no previously-included directories found matching 'docs'
no previously-included directories found matching 'DLLs_AMD64'
no previously-included directories found matching 'DLLs_x86'
warning: no previously-included files found matching '*.txt'
warning: no files found matching '*.dll' under directory 'shapely/DLLs'
warning: no files found matching '*.rst' under directory 'shapely/DLLs'
warning: no files found matching '*.txt' under directory 'shapely/DLLs'
writing manifest file 'Shapely.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/shapely
copying shapely/iterops.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/validation.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/wkb.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/_buildcfg.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/geos.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/topology.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/affinity.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/wkt.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/predicates.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/prepared.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/strtree.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/coords.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/errors.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/linref.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/__init__.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/ctypes_declarations.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/impl.py -> build/lib.linux-x86_64-3.8/shapely
copying shapely/ops.py -> build/lib.linux-x86_64-3.8/shapely
creating build/lib.linux-x86_64-3.8/shapely/geometry
copying shapely/geometry/multilinestring.py -> build/lib.linux-x86_64-3.8/shapely/geometry
copying shapely/geometry/multipoint.py -> build/lib.linux-x86_64-3.8/shapely/geometry
copying shapely/geometry/linestring.py -> build/lib.linux-x86_64-3.8/shapely/geometry
copying shapely/geometry/collection.py -> build/lib.linux-x86_64-3.8/shapely/geometry
copying shapely/geometry/polygon.py -> build/lib.linux-x86_64-3.8/shapely/geometry
copying shapely/geometry/point.py -> build/lib.linux-x86_64-3.8/shapely/geometry
copying shapely/geometry/multipolygon.py -> build/lib.linux-x86_64-3.8/shapely/geometry
copying shapely/geometry/geo.py -> build/lib.linux-x86_64-3.8/shapely/geometry
copying shapely/geometry/proxy.py -> build/lib.linux-x86_64-3.8/shapely/geometry
copying shapely/geometry/__init__.py -> build/lib.linux-x86_64-3.8/shapely/geometry
copying shapely/geometry/base.py -> build/lib.linux-x86_64-3.8/shapely/geometry
creating build/lib.linux-x86_64-3.8/shapely/algorithms
copying shapely/algorithms/cga.py -> build/lib.linux-x86_64-3.8/shapely/algorithms
copying shapely/algorithms/__init__.py -> build/lib.linux-x86_64-3.8/shapely/algorithms
copying shapely/algorithms/polylabel.py -> build/lib.linux-x86_64-3.8/shapely/algorithms
creating build/lib.linux-x86_64-3.8/shapely/examples
copying shapely/examples/dissolve.py -> build/lib.linux-x86_64-3.8/shapely/examples
copying shapely/examples/geoms.py -> build/lib.linux-x86_64-3.8/shapely/examples
copying shapely/examples/intersect.py -> build/lib.linux-x86_64-3.8/shapely/examples
copying shapely/examples/__init__.py -> build/lib.linux-x86_64-3.8/shapely/examples
creating build/lib.linux-x86_64-3.8/shapely/speedups
copying shapely/speedups/__init__.py -> build/lib.linux-x86_64-3.8/shapely/speedups
creating build/lib.linux-x86_64-3.8/shapely/vectorized
copying shapely/vectorized/__init__.py -> build/lib.linux-x86_64-3.8/shapely/vectorized
copying shapely/_geos.pxi -> build/lib.linux-x86_64-3.8/shapely
copying shapely/speedups/_speedups.c -> build/lib.linux-x86_64-3.8/shapely/speedups
copying shapely/speedups/_speedups.pyx -> build/lib.linux-x86_64-3.8/shapely/speedups
copying shapely/vectorized/_vectorized.pyx -> build/lib.linux-x86_64-3.8/shapely/vectorized
running build_ext
cythoning shapely/vectorized/_vectorized.pyx to shapely/vectorized/_vectorized.c
building 'shapely.speedups._speedups' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/shapely
creating build/temp.linux-x86_64-3.8/shapely/speedups
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include -I/usr/local/lib/python3.8/site-packages/numpy/core/include -I/usr/local/include/python3.8 -c shapely/speedups/_speedups.c -o build/temp.linux-x86_64-3.8/shapely/speedups/_speedups.o
/usr/local/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /Shapely/shapely/vectorized/_vectorized.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
setup.py:387: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  log.warn(ex)
WARNING:setup.py:command 'gcc' failed with exit status 1
setup.py:388: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  log.warn(BUILD_EXT_WARNING)
WARNING:setup.py:The C extension could not be compiled, speedups are not enabled.
setup.py:389: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  log.warn("Failure information, if any, is above.")
WARNING:setup.py:Failure information, if any, is above.
setup.py:390: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  log.warn("I'm retrying the build without the C extension now.")
WARNING:setup.py:I'm retrying the build without the C extension now.
running install
running bdist_egg
running egg_info
writing Shapely.egg-info/PKG-INFO
writing dependency_links to Shapely.egg-info/dependency_links.txt
writing requirements to Shapely.egg-info/requires.txt
writing top-level names to Shapely.egg-info/top_level.txt
reading manifest file 'Shapely.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'manual'
no previously-included directories found matching 'debian'
no previously-included directories found matching 'DLLs_AMD64'
no previously-included directories found matching 'DLLs_x86'
warning: no files found matching '*.dll' under directory 'shapely/DLLs'
warning: no files found matching '*.rst' under directory 'shapely/DLLs'
warning: no files found matching '*.txt' under directory 'shapely/DLLs'
writing manifest file 'Shapely.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/lib
creating build/lib/shapely
copying shapely/iterops.py -> build/lib/shapely
copying shapely/validation.py -> build/lib/shapely
copying shapely/wkb.py -> build/lib/shapely
copying shapely/_buildcfg.py -> build/lib/shapely
copying shapely/geos.py -> build/lib/shapely
copying shapely/topology.py -> build/lib/shapely
copying shapely/affinity.py -> build/lib/shapely
copying shapely/wkt.py -> build/lib/shapely
copying shapely/predicates.py -> build/lib/shapely
copying shapely/prepared.py -> build/lib/shapely
copying shapely/strtree.py -> build/lib/shapely
copying shapely/coords.py -> build/lib/shapely
copying shapely/errors.py -> build/lib/shapely
copying shapely/linref.py -> build/lib/shapely
copying shapely/__init__.py -> build/lib/shapely
copying shapely/ctypes_declarations.py -> build/lib/shapely
copying shapely/impl.py -> build/lib/shapely
copying shapely/ops.py -> build/lib/shapely
creating build/lib/shapely/geometry
copying shapely/geometry/multilinestring.py -> build/lib/shapely/geometry
copying shapely/geometry/multipoint.py -> build/lib/shapely/geometry
copying shapely/geometry/linestring.py -> build/lib/shapely/geometry
copying shapely/geometry/collection.py -> build/lib/shapely/geometry
copying shapely/geometry/polygon.py -> build/lib/shapely/geometry
copying shapely/geometry/point.py -> build/lib/shapely/geometry
copying shapely/geometry/multipolygon.py -> build/lib/shapely/geometry
copying shapely/geometry/geo.py -> build/lib/shapely/geometry
copying shapely/geometry/proxy.py -> build/lib/shapely/geometry
copying shapely/geometry/__init__.py -> build/lib/shapely/geometry
copying shapely/geometry/base.py -> build/lib/shapely/geometry
creating build/lib/shapely/algorithms
copying shapely/algorithms/cga.py -> build/lib/shapely/algorithms
copying shapely/algorithms/__init__.py -> build/lib/shapely/algorithms
copying shapely/algorithms/polylabel.py -> build/lib/shapely/algorithms
creating build/lib/shapely/examples
copying shapely/examples/dissolve.py -> build/lib/shapely/examples
copying shapely/examples/geoms.py -> build/lib/shapely/examples
copying shapely/examples/intersect.py -> build/lib/shapely/examples
copying shapely/examples/__init__.py -> build/lib/shapely/examples
creating build/lib/shapely/speedups
copying shapely/speedups/__init__.py -> build/lib/shapely/speedups
creating build/lib/shapely/vectorized
copying shapely/vectorized/__init__.py -> build/lib/shapely/vectorized
copying shapely/_geos.pxi -> build/lib/shapely
copying shapely/speedups/_speedups.c -> build/lib/shapely/speedups
copying shapely/speedups/_speedups.pyx -> build/lib/shapely/speedups
copying shapely/vectorized/_vectorized.pyx -> build/lib/shapely/vectorized
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/iterops.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/validation.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/wkb.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/_buildcfg.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/geos.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/topology.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/affinity.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/wkt.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/predicates.py -> build/bdist.linux-x86_64/egg/shapely
creating build/bdist.linux-x86_64/egg/shapely/algorithms
copying build/lib/shapely/algorithms/cga.py -> build/bdist.linux-x86_64/egg/shapely/algorithms
copying build/lib/shapely/algorithms/__init__.py -> build/bdist.linux-x86_64/egg/shapely/algorithms
copying build/lib/shapely/algorithms/polylabel.py -> build/bdist.linux-x86_64/egg/shapely/algorithms
creating build/bdist.linux-x86_64/egg/shapely/speedups
copying build/lib/shapely/speedups/_speedups.pyx -> build/bdist.linux-x86_64/egg/shapely/speedups
copying build/lib/shapely/speedups/_speedups.c -> build/bdist.linux-x86_64/egg/shapely/speedups
copying build/lib/shapely/speedups/__init__.py -> build/bdist.linux-x86_64/egg/shapely/speedups
copying build/lib/shapely/prepared.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/strtree.py -> build/bdist.linux-x86_64/egg/shapely
creating build/bdist.linux-x86_64/egg/shapely/examples
copying build/lib/shapely/examples/dissolve.py -> build/bdist.linux-x86_64/egg/shapely/examples
copying build/lib/shapely/examples/geoms.py -> build/bdist.linux-x86_64/egg/shapely/examples
copying build/lib/shapely/examples/intersect.py -> build/bdist.linux-x86_64/egg/shapely/examples
copying build/lib/shapely/examples/__init__.py -> build/bdist.linux-x86_64/egg/shapely/examples
copying build/lib/shapely/coords.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/errors.py -> build/bdist.linux-x86_64/egg/shapely
creating build/bdist.linux-x86_64/egg/shapely/geometry
copying build/lib/shapely/geometry/multilinestring.py -> build/bdist.linux-x86_64/egg/shapely/geometry
copying build/lib/shapely/geometry/multipoint.py -> build/bdist.linux-x86_64/egg/shapely/geometry
copying build/lib/shapely/geometry/linestring.py -> build/bdist.linux-x86_64/egg/shapely/geometry
copying build/lib/shapely/geometry/collection.py -> build/bdist.linux-x86_64/egg/shapely/geometry
copying build/lib/shapely/geometry/polygon.py -> build/bdist.linux-x86_64/egg/shapely/geometry
copying build/lib/shapely/geometry/point.py -> build/bdist.linux-x86_64/egg/shapely/geometry
copying build/lib/shapely/geometry/multipolygon.py -> build/bdist.linux-x86_64/egg/shapely/geometry
copying build/lib/shapely/geometry/geo.py -> build/bdist.linux-x86_64/egg/shapely/geometry
copying build/lib/shapely/geometry/proxy.py -> build/bdist.linux-x86_64/egg/shapely/geometry
copying build/lib/shapely/geometry/__init__.py -> build/bdist.linux-x86_64/egg/shapely/geometry
copying build/lib/shapely/geometry/base.py -> build/bdist.linux-x86_64/egg/shapely/geometry
copying build/lib/shapely/linref.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/__init__.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/ctypes_declarations.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/_geos.pxi -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/impl.py -> build/bdist.linux-x86_64/egg/shapely
copying build/lib/shapely/ops.py -> build/bdist.linux-x86_64/egg/shapely
creating build/bdist.linux-x86_64/egg/shapely/vectorized
copying build/lib/shapely/vectorized/_vectorized.pyx -> build/bdist.linux-x86_64/egg/shapely/vectorized
copying build/lib/shapely/vectorized/__init__.py -> build/bdist.linux-x86_64/egg/shapely/vectorized
byte-compiling build/bdist.linux-x86_64/egg/shapely/iterops.py to iterops.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/validation.py to validation.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/wkb.py to wkb.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/_buildcfg.py to _buildcfg.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/geos.py to geos.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/topology.py to topology.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/affinity.py to affinity.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/wkt.py to wkt.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/predicates.py to predicates.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/algorithms/cga.py to cga.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/algorithms/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/algorithms/polylabel.py to polylabel.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/speedups/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/prepared.py to prepared.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/strtree.py to strtree.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/examples/dissolve.py to dissolve.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/examples/geoms.py to geoms.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/examples/intersect.py to intersect.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/examples/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/coords.py to coords.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/errors.py to errors.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/geometry/multilinestring.py to multilinestring.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/geometry/multipoint.py to multipoint.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/geometry/linestring.py to linestring.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/geometry/collection.py to collection.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/geometry/polygon.py to polygon.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/geometry/point.py to point.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/geometry/multipolygon.py to multipolygon.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/geometry/geo.py to geo.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/geometry/proxy.py to proxy.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/geometry/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/geometry/base.py to base.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/linref.py to linref.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/__init__.py to __init__.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/ctypes_declarations.py to ctypes_declarations.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/impl.py to impl.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/ops.py to ops.cpython-38.pyc
byte-compiling build/bdist.linux-x86_64/egg/shapely/vectorized/__init__.py to __init__.cpython-38.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying Shapely.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying Shapely.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying Shapely.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying Shapely.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying Shapely.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
shapely.__pycache__._buildcfg.cpython-38: module references __file__
shapely.__pycache__.geos.cpython-38: module references __file__
creating dist
creating 'dist/Shapely-1.7a2-py3.8.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing Shapely-1.7a2-py3.8.egg
creating /usr/local/lib/python3.8/site-packages/Shapely-1.7a2-py3.8.egg
Extracting Shapely-1.7a2-py3.8.egg to /usr/local/lib/python3.8/site-packages
Adding Shapely 1.7a2 to easy-install.pth file

Installed /usr/local/lib/python3.8/site-packages/Shapely-1.7a2-py3.8.egg
Processing dependencies for Shapely==1.7a2
Finished processing dependencies for Shapely==1.7a2
setup.py:401: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
  log.warn(BUILD_EXT_WARNING)
WARNING:setup.py:The C extension could not be compiled, speedups are not enabled.
 ---> c52aa622fe68
Removing intermediate container 4e118ceb8e71
Step 6/6 : RUN python -c "from shapely import vectorized"
 ---> Running in 13c2ec9718aa
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/Shapely-1.7a2-py3.8.egg/shapely/vectorized/__init__.py", line 3, in <module>
    from ._vectorized import (contains, touches)
ModuleNotFoundError: No module named 'shapely.vectorized._vectorized'
The command '/bin/sh -c python -c "from shapely import vectorized"' returned a non-zero code: 1

@sgillies
Copy link
Contributor

@mikedh thank you for being patient and persistent. I've found the problem.

The Shapely 1.6.4.post2 source distribution (sdist) is defective and does not include a _vectorized.c file.

$ tar tzvf ~/Downloads/Shapely-1.6.4.post2.tar.gz | grep "\.c$"
-rw-r--r--  0 sean   staff  558528 Jul 18  2018 Shapely-1.6.4.post2/shapely/speedups/_speedups.c

The shapely 1.7a2 sdist does.

$ tar tzvf ~/Downloads/Shapely-1.7a2.tar.gz | grep "\.c$"
-rw-r--r--  0 seang  staff  578825 Jun 21  2019 Shapely-1.7a2/shapely/speedups/_speedups.c
-rw-r--r--  0 seang  staff  897094 Aug 30  2016 Shapely-1.7a2/shapely/vectorized/_vectorized.c

Would you be willing to try the 1.7a2 pre-release? It's in good shape, in my opinion. It has far fewer known bugs than 1.6.4.post2, and seems to be serving geopandas users quite well. If not, you might try python 3.7, we have binary wheels on PyPI for py37 and shapely 1.6.4.post2.

@mikedh
Copy link
Author

mikedh commented Dec 27, 2019

Thanks for tracking this down! Yup looks like 1.7a2 does the trick.

Kinda weird that it was reproducible even when building from a clone of the repo, maybe it was missing the geos headers or something? Feel free to close, or we can wait for the release to close.

For other people who want the pre-release you can install it with:
pip install shapely==1.7a2

@damienallen
Copy link

Trimesh user here, this thread saved my day.

Props to the contributors for the 1.7.0 release including the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants