BiomedicalMachineLearning / stLearn

A novel machine learning pipeline to analyse spatial transcriptomics data
Other
190 stars 25 forks source link

Installation issue with version conflicts #293

Open Huyuling1 opened 4 months ago

Huyuling1 commented 4 months ago

Hello,

I followed the installation instructions for the stLearn package as suggested .

conda create -n stlearn python=3.10 conda activate stlearn git clone https://github.com/BiomedicalMachineLearning/stLearn.git cd stLearn python setup.py install

However, I encountered version conflicts issues.

error: numpy 1.21.6 is installed but numpy>=1.23 is required by {'scanpy', 'scikit-image'}

Could you please advise on how to resolve these version conflicts? Looking forward to your response.

Thank you!

Huyuling1 commented 4 months ago

and when I use pip install -r requirements.txt it seems to successfully installed and the versions as listed below:

absl-py 2.1.0 anndata 0.10.5.post1 array_api_compat 1.7.1 asttokens 2.4.1 astunparse 1.6.3 bokeh 3.5.0.dev4 cachetools 5.3.3 certifi 2024.2.2 charset-normalizer 3.3.2 click 8.1.7 colorama 0.4.6 comm 0.2.2 contourpy 1.2.1 cycler 0.12.1 debugpy 1.8.1 decorator 5.1.1 exceptiongroup 1.2.0 executing 2.0.1 flatbuffers 24.3.25 fonttools 4.52.4 gast 0.4.0 google-auth 2.29.0 google-auth-oauthlib 0.4.6 google-pasta 0.2.0 grpcio 1.64.0 h5py 3.11.0 idna 3.7 igraph 0.11.5 imageio 2.34.1 importlib_metadata 7.1.0 ipykernel 6.29.3 ipython 8.24.0 jedi 0.19.1 Jinja2 3.1.4 joblib 1.4.2 jupyter_client 8.6.2 jupyter_core 5.7.2 keras 2.11.0 kiwisolver 1.4.5 lazy_loader 0.4 leidenalg 0.10.2 libclang 18.1.1 llvmlite 0.40.1 louvain 0.8.2 Markdown 3.6 MarkupSafe 2.1.5 matplotlib 3.8.4 matplotlib-inline 0.1.7 natsort 8.4.0 nest_asyncio 1.6.0 networkx 3.3 numba 0.57.1 numpy 1.21.6 oauthlib 3.2.2 opt-einsum 3.3.0 packaging 24.0 pandas 2.0.3 parso 0.8.4 patsy 0.5.6 pickleshare 0.7.5 pillow 10.3.0 pip 24.0 platformdirs 4.2.2 prompt-toolkit 3.0.42 protobuf 3.19.6 psutil 5.9.8 pure-eval 0.2.2 pyasn1 0.6.0 pyasn1_modules 0.4.0 Pygments 2.18.0 pynndescent 0.5.12 pyparsing 3.1.2 python-dateutil 2.9.0 pytz 2024.1 PyWavelets 1.4.1 pywin32 306 PyYAML 6.0.1 pyzmq 26.0.3 requests 2.32.3 requests-oauthlib 2.0.0 rsa 4.9 scanpy 1.9.8 scikit-image 0.21.0 scikit-learn 1.5.0 scipy 1.11.4 seaborn 0.13.2 session_info 1.0.0 setuptools 69.5.1 six 1.16.0 stack-data 0.6.2 statsmodels 0.13.2 stdlib-list 0.10.0 stlearn 0.4.11 tensorboard 2.11.2 tensorboard-data-server 0.6.1 tensorboard-plugin-wit 1.8.1 tensorflow 2.11.1 tensorflow-estimator 2.11.0 tensorflow-intel 2.11.1 tensorflow-io-gcs-filesystem 0.31.0 termcolor 2.4.0 texttable 1.7.0 threadpoolctl 3.5.0 tifffile 2024.5.22 tornado 6.4 tqdm 4.66.4 traitlets 5.14.3 typing_extensions 4.11.0 tzdata 2024.1 umap-learn 0.5.6 urllib3 2.2.1 wcwidth 0.2.13 Werkzeug 3.0.3 wheel 0.43.0 wrapt 1.16.0 xyzservices 2024.4.0 zipp 3.17.0

but I still encountered some errors when attempting to import stlearn:


RuntimeError Traceback (most recent call last) RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe

ImportError Traceback (most recent call last) Cell In[1], line 1 ----> 1 import stlearn

File d:\Anaconda\envs\stlearn\lib\site-packages\stlearn-0.4.11-py3.10.egg\stlearn__init.py:8 [4](file:///D:/Anaconda/envs/stlearn/lib/site-packages/stlearn-0.4.11-py3.10.egg/stlearn/init.py:4) email = "duy.pham@uq.edu.au" [5](file:///D:/Anaconda/envs/stlearn/lib/site-packages/stlearn-0.4.11-py3.10.egg/stlearn/init.py:5) version = "0.4.11" ----> [8](file:///D:/Anaconda/envs/stlearn/lib/site-packages/stlearn-0.4.11-py3.10.egg/stlearn/init.py:8) from . import add [9](file:///D:/Anaconda/envs/stlearn/lib/site-packages/stlearn-0.4.11-py3.10.egg/stlearn/init.py:9) from . import pp [10](file:///D:/Anaconda/envs/stlearn/lib/site-packages/stlearn-0.4.11-py3.10.egg/stlearn/init__.py:10) from . import em

File d:\Anaconda\envs\stlearn\lib\site-packages\stlearn-0.4.11-py3.10.egg\stlearn\add.py:1 ----> 1 from .adds.add_image import image 2 from .adds.add_positions import positions 3 from .adds.parsing import parsing

File d:\Anaconda\envs\stlearn\lib\site-packages\stlearn-0.4.11-py3.10.egg\stlearn\adds\add_image.py:2 1 from typing import Optional, Union ----> 2 from anndata import AnnData 3 from matplotlib import pyplot as plt 4 from pathlib import Path

File d:\Anaconda\envs\stlearn\lib\site-packages\anndata__init.py:23 [19](file:///D:/Anaconda/envs/stlearn/lib/site-packages/anndata/init__.py:19) if sys.version_info < (3, 11): ... 12 get_csr_submatrix) 13 from ._sputils import upcast 15 from ._compressed import _cs_matrix

ImportError: numpy.core.multiarray failed to import

easlinger commented 4 months ago

First I'd like to say that I love the package!

I am also having issues with numpy versioning, unfortunately. I can write a more detailed response later if needed, but for now, here are some challenges I've identified:

Overall, I have only been able to make this work in a completely isolated environment, which isn't optimal for my workflows as I'd love to integrate this package as a dependency in software I'm writing.

Aligning the dependencies with those of recent versions of other key packages (e.g., scanpy, spatialdata-io, anndata, napari, 'squidpy', pertpy, 'liana', etc.) would be a major help.

Specifics on the Numpy Issue

(Happy to do a pull request on this if you'd like.)

stlearn/tools/microenv/cci/permutation.py:77

lr_summary = np.zeros((lr_scores.shape[1], 3), np.int)

Results in:

AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Change np.int to int, and it's fine.

easlinger commented 4 months ago

Apologies, as I was creating a pull request, I realized you already fixed the issue related to np.int in the latest code. A new release with that fix would be convenient for pytoml/setuptools purposes when you get the chance.

Updating compatibility to newer versions of numpy and numba would still be a hugely helpful advancement if you have the time/bandwidth.

Thanks for all your work on this! The package has really been a godsend to help move forward one of my collaborations.

duypham2108 commented 4 months ago

Hello,

I followed the installation instructions for the stLearn package as suggested .

conda create -n stlearn python=3.10 conda activate stlearn git clone https://github.com/BiomedicalMachineLearning/stLearn.git cd stLearn python setup.py install

However, I encountered version conflicts issues.

error: numpy 1.21.6 is installed but numpy>=1.23 is required by {'scanpy', 'scikit-image'}

Could you please advise on how to resolve these version conflicts? Looking forward to your response.

Thank you!

Can you use python 3.8 instead of 3.10? We haven't tested with that version yet

duypham2108 commented 4 months ago

Apologies, as I was creating a pull request, I realized you already fixed the issue related to np.int in the latest code. A new release with that fix would be convenient for pytoml/setuptools purposes when you get the chance.

Updating compatibility to newer versions of numpy and numba would still be a hugely helpful advancement if you have the time/bandwidth.

Thanks for all your work on this! The package has really been a godsend to help move forward one of my collaborations.

Thanks for using our tool and your suggestions. We will try to update the python and all package versions soon