Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation issue with version conflicts #293

Open
Huyuling1 opened this issue May 30, 2024 · 5 comments
Open

Installation issue with version conflicts #293

Huyuling1 opened this issue May 30, 2024 · 5 comments

Comments

@Huyuling1
Copy link

Huyuling1 commented May 30, 2024

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
Copy link
Author

Huyuling1 commented May 30, 2024

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 email = "[email protected]"
5 version = "0.4.11"
----> 8 from . import add
9 from . import pp
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 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

@Huyuling1 Huyuling1 changed the title Installation Issue with Version Conflicts Installation issue with version conflicts May 30, 2024
@easlinger
Copy link

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:

  • Many packages I work with in conjunction with stlearn require numpy>=1.23, but this package requires numba 0.55.2, which depends on numpy<1.23 and >=1.18
  • Some of the source code seems to rely on deprecated parts of numpy, e.g., using np.int instead of int (I think this is an easy enough fix -- I did a bad thing out of expediency and just changed the source code, and everything worked fine in a clean environment with just stlearn's dependencies and not my other ones. See below for specifics)
  • Trying to harmonize various packages lead me to conflicts between requirements for setuptools > versus < 60.0.06
  • Things I do to fix the numpy issues tend to mess with numba compatibility

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
Copy link

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
Copy link
Collaborator

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants