AttributeError: module 'shapely' has no attribute 'affinity'

Viewed 1453

After installing shapely in windows (downloaing .whl file from https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely) getting the following error:

from shapely.geometry import Point
Traceback (most recent call last):

  File "<ipython-input-48-df8e65c5217a>", line 1, in <module>
    from shapely.geometry import Point

  File "C:\Anaconda3\lib\site-packages\shapely\geometry\__init__.py", line 23, in <module>
    import shapely.speedups

  File "C:\Anaconda3\lib\site-packages\shapely\speedups\__init__.py", line 99, in <module>
    enable()

  File "C:\Anaconda3\lib\site-packages\shapely\speedups\__init__.py", line 69, in enable
    _orig['affine_transform'] = shapely.affinity.affine_transform

AttributeError: module 'shapely' has no attribute 'affinity'
1 Answers

Install the dependencies of Shapely first using the same site. For me the following procedure worked. I use python 3.6 on windows 64 bit.

Install the wheels in this order:

1: GDAL-2.4.1-cp36-cp36m-win_amd64.whl

2: Fiona-1.8.6-cp36-cp36m-win_amd64.whl

3: Shapely-1.6.4.post2-cp36-cp36m-win_amd64.whl

This should result in a correctly installed Shapely module.

Related