For-a-few-DPPs-more / spatstat-interface

Simple Python interface with the spatstat R package using rpy2
MIT License
10 stars 0 forks source link

spatstat-interface crashes on macos when installed without poetry #7

Open sporring opened 2 months ago

sporring commented 2 months ago

Hi, I would like to experiment with this interface, but python crashes, when I run from spatstat_interface.interface import SpatstatInterface Here is how I installed the package:

First I updated brew to the latest packages. Then I made a conda environment:

conda activate spatstat

I pip-installed the spatstat-interface package:

pip install spatstat-interface

I installed R:

brew install R

I started R in the terminal and installed spatstat:

install.packages("spatstat”, repos='https://mirrors.dotsrc.org/cran/')

Attempting to import the package in python crashes:

% python
Python 3.12.4 | packaged by Anaconda, Inc. | (main, Jun 18 2024, 10:07:17) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from spatstat_interface.interface import SpatstatInterface
zsh: segmentation fault  python
sporring commented 2 months ago

It seems there are several version problems possibly between R and rpy2. In an case, it does not segment fault when I do the following.

First I create a new environment and install r with conda:

conda create -n spatstat python=3.12
conda activate spatstat
conda install -c conda-forge r
pip install spatstat-interface

The spatstat-interface does not run with the required interval of pandas, but if we ignore and install the latest, which in my case is 2.2.2:

pip uninstall pandas
pip install pandas

then in python

>>> from spatstat_interface.interface import SpatstatInterface
>>> 

everything seems fine. However, when I attempt to import packages

spatstat = SpatstatInterface()
spatstat.import_package("model", "explore", "geom", update=True)

then the subpackages do not build

...
ERROR: lazy loading failed for package ‘spatstat.sparse’
* removing ‘/Users/jrh630/anaconda3/envs/spatstat/lib/R/library/spatstat.sparse’
ERROR: dependencies ‘spatstat.data’, ‘spatstat.univar’, ‘deldir’, ‘polyclip’ are not available for package ‘spatstat.geom’
* removing ‘/Users/jrh630/anaconda3/envs/spatstat/lib/R/library/spatstat.geom’
ERROR: dependencies ‘spatstat.data’, ‘spatstat.univar’, ‘spatstat.geom’ are not available for package ‘spatstat.random’
* removing ‘/Users/jrh630/anaconda3/envs/spatstat/lib/R/library/spatstat.random’
ERROR: dependencies ‘spatstat.data’, ‘spatstat.univar’, ‘spatstat.geom’, ‘spatstat.random’, ‘spatstat.sparse’ are not available for package ‘spatstat.explore’
* removing ‘/Users/jrh630/anaconda3/envs/spatstat/lib/R/library/spatstat.explore’
ERROR: dependencies ‘spatstat.data’, ‘spatstat.univar’, ‘spatstat.geom’, ‘spatstat.random’, ‘spatstat.explore’, ‘spatstat.sparse’ are not available for package ‘spatstat.model’
* removing ‘/Users/jrh630/anaconda3/envs/spatstat/lib/R/library/spatstat.model’