Open NorahBrown opened 8 months ago
@NorahBrown, sorry you're having trouble. It would be surprising to me if such a basic operation in shapely were broken for all Windows users. I've added your test to our build in #131 so let's see if we can reproduce the issue here, too.
I'm not terribly expert at windows debugging but nothing obvious stands out to me in what you listed that might explain the issue you're having, unfortunately.
@conda-forge/shapely, anyone else have suggestions for what could be causing this?
@NorahBrown, the answer seems to be, no, we're not reproducing the problem in #131 so it seems somehow to be something more specific to how you have things installed. Hopefully, one of the other maintainers will have a suggestion for how to debug further.
Shrug, I wonder why your environment has shapely 2.0.1, instead of the current 2.0.2 release?
Do you have another installation of geos by any chance? That could cause a DLL hell and segfaults.
FWIW, for a correct installation of shapely 2.0.1, running shapely.speedups.disable()
can never have any effect, because that function is a no-op: https://github.com/shapely/shapely/blob/2.0.1/shapely/speedups.py
If calling speedups
has an effect, my guess is that you actually are somehow importing shapely 1.8 (or older). For those versions, disabling speedups can indeed fix installation issues if at runtime it is loading a different GEOS version than the one shapely was built against (because there is both cython code built against GEOS and ctypes code loading GEOS only at runtime).
So in your environment where you observe the issue, can you do:
import shapely
shapely.__version__
shapely.__path__
import shapely.geos
shapely.geos.lgeos.geos_version # or shapely.geos.geos_version for more recent versions
@jorisvandenbossche Thank you for the insight and guidance. You are correct. Even though I installed shapely 2.0
in my conda environment, shapely 1.8
was the version being loaded.
It appears that %USERPROFILE%\AppData\Roaming
site-packages are prepended to the conda environment search path before the conda environments site-packages. In my case the %USERPROFILE%\AppData\Roaming\Python\Python310\site-packages
has shapely 1.8 installed.
I understand that the issue is out of scope for shapely-feedstock. I humbly suggest that having the roaming site-packages added after the conda environment's site-packages would be more aligned with expectations for an isolated conda environment. For now I have temporarily renamed the roaming site-packages directory but a more permanent solution would be ideal.
>>> import sys
>>> sys.path
[...,'C:\\Users\\nbrown\\Miniconda3\\envs\\ddb-api', 'C:\\Users\\nbrown\\AppData\\Roaming\\Python\\Python310\\site-packages', 'C:\\Users\\nbrown\\Miniconda3\\envs\\ddb-api\\lib\\site-packages']
>>> import shapely
>>> shapely.__version__
'1.8.4'
>>> import shapely.geos
>>> shapely.geos.lgeos.geos_version
(3, 8, 0)
import sys
sys.path
[...,'C:\\Users\\nbrown\\Miniconda3\\envs\\ddb-api', 'C:\\Users\\nbrown\\Miniconda3\\envs\\ddb-api\\lib\\site-packages']
>>> import shapely
>>> shapely.__version__
'2.0.2'
>>> import shapely.geos
>>> shapely.geos.geos_version_string
'3.12.0-CAPI-1.18.0'
Solution to issue cannot be found in the documentation.
Issue
The following code causes python to crash
Using Shapely 2.0.1 with python 3.10 on windows 10.
Using speedups.disable resolves issue
Installed packages
Environment info