Shapely: vectorizado en Python 3.8

Creado en 21 dic. 2019  ·  6Comentarios  ·  Fuente: Toblerity/Shapely

Parece que from shapely import vectorized falla en Python 3.8 cuando Shapely se instala a través de 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
También vi algunos informes "en la naturaleza" de esto, aunque no estoy seguro de en qué Python estaban:
https://github.com/mikedh/trimesh/issues/667

Comentario más útil

¡Gracias por rastrear esto! Sí, parece que 1.7a2 hace el truco .

Un poco extraño que fuera reproducible incluso cuando se construía a partir de un clon del repositorio, ¿tal vez faltaban los encabezados geos o algo así? Siéntase libre de cerrar, o podemos esperar a que se cierre el lanzamiento.

Para otras personas que quieran el prelanzamiento, pueden instalarlo con:
pip install shapely==1.7a2

Todos 6 comentarios

@mikedh, ¿estás intentando instalar pip de forma adecuada en un entorno conda? Veo una pista de eso en https://travis-ci.org/mikedh/trimesh/jobs/627984786#L1048. Si bien esto puede funcionar para paquetes de python puro, no puede funcionar para paquetes que incluyen módulos de extensión como lo hace Shapely. Simplemente no puede instalar por pip las ruedas bien formadas en PyPI en un entorno de conda, debe ponerse bien de un canal de conda como conda-forge.

Sí, pip install en conda python es un poco extraño, pero creo que el problema está en otra parte y es reproducible en la línea principal de Python. Aquí hay un Dockerfile de reproducción mínimo:

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"

Falla con:

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

Hice un poco de depuración y probé algunas cosas, ninguna de las cuales funcionó. Como referencia, aquí hay un Dockerfile un poco más útil:

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"

Y el resultado completo de los pasos de construcción bien formados:

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

@mikedh gracias por ser paciente y persistente. Encontré el problema.

La distribución fuente Shapely 1.6.4.post2 (sdist) es defectuosa y no incluye un archivo _vectorized.c.

$ 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

La bien formada 1.7a2 sdist lo hace.

$ 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

¿Estarías dispuesto a probar la versión preliminar de 1.7a2? Está en buena forma, en mi opinión. Tiene muchos menos errores conocidos que 1.6.4.post2, y parece estar sirviendo bastante bien a los usuarios de geopandas. Si no es así, puede probar Python 3.7, tenemos ruedas binarias en PyPI para py37 y bien proporcionado 1.6.4.post2.

¡Gracias por rastrear esto! Sí, parece que 1.7a2 hace el truco .

Un poco extraño que fuera reproducible incluso cuando se construía a partir de un clon del repositorio, ¿tal vez faltaban los encabezados geos o algo así? Siéntase libre de cerrar, o podemos esperar a que se cierre el lanzamiento.

Para otras personas que quieran el prelanzamiento, pueden instalarlo con:
pip install shapely==1.7a2

Usuario de Trimesh aquí, este hilo me salvó el día.

¡Apoyos para los colaboradores de la versión 1.7.0, incluida la corrección!

¿Fue útil esta página
0 / 5 - 0 calificaciones