Shapely: Python3.8でベクトル化

作成日 2019年12月21日  ·  6コメント  ·  ソース: Toblerity/Shapely

Shapelyがpip経由でインストールされている場合、Python 3.8ではfrom shapely import vectorizedが失敗するようです。

    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
私はこれについてもいくつかの「実際の」レポートを見ましたが、それらがどのPythonを使用していたかはわかりません。
https://github.com/mikedh/trimesh/issues/667

最も参考になるコメント

これを追跡してくれてありがとう! うん、1.7a2がトリックをするように見えます。

リポジトリのクローンからビルドしても再現可能だったのは奇妙なことですが、geosヘッダーなどが欠落していたのではないでしょうか。 お気軽に終了するか、リリースが終了するのを待つことができます。

プレリリースが必要な他の人のために、あなたはそれをインストールすることができます:
pip install shapely==1.7a2

全てのコメント6件

@mikedhは、コンダ環境に適切にインストールしようとしていますか? そのヒントはhttps://travis-ci.org/mikedh/trimesh/jobs/627984786#L1048にあります。 これは純粋なPythonパッケージでは機能する可能性がありますが、shapelyのように拡張モジュールを含むパッケージでは機能しません。 PyPIの形の良いホイールをconda環境にピップインストールすることはできません。conda-forgeのようなcondaチャネルから形を整える必要があります。

ええ、conda pythonのpip installは少し奇妙ですが、問題は他の場所にあり、メインラインのPythonで再現できると思います。 これが最小限の複製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"

失敗する:

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

少しデバッグを行い、いくつかのことを試しましたが、どれも機能しませんでした。 参考までに、もう少し便利な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"

そして、形の良いビルドステップの完全な出力:

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は辛抱強く頑張ってくれてありがとう。 私は問題を見つけました。

Shapely 1.6.4.post2ソースディストリビューション(sdist)に欠陥があり、_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

格好の良い1.7a2sdistはそうします。

$ 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

1.7a2プレリリースを試してみませんか? 私の意見では、それは良い状態です。 1.6.4.post2よりも既知のバグがはるかに少なく、geopandasユーザーに非常によくサービスを提供しているようです。 そうでない場合は、python3.7を試してみてください。PyPIにはpy37用のバイナリホイールと形の良い1.6.4.post2があります。

これを追跡してくれてありがとう! うん、1.7a2がトリックをするように見えます。

リポジトリのクローンからビルドしても再現可能だったのは奇妙なことですが、geosヘッダーなどが欠落していたのではないでしょうか。 お気軽に終了するか、リリースが終了するのを待つことができます。

プレリリースが必要な他の人のために、あなたはそれをインストールすることができます:
pip install shapely==1.7a2

Trimeshユーザーはこちら、このスレッドは私の一日を救いました。

修正を含む1.7.0リリースの寄稿者への小道具!

このページは役に立ちましたか?
0 / 5 - 0 評価