dpeerlab / ENVI

MIT License
36 stars 6 forks source link

An error when installing envi #9

Open HelloWorldLTY opened 5 months ago

HelloWorldLTY commented 5 months ago

Hi, there is a bug when I follow the readme file to install envi:

File /gpfs/gibbs/project/zhao/tl688/conda_envs/envi/lib/python3.9/site-packages/jax/_src/scipy/linalg.py:403
    399   del overwrite_b, debug, check_finite  # unused
    400   return _solve_triangular(a, b, trans, lower, unit_diagonal)
--> 403 @_wraps(scipy.linalg.tril)
    404 def tril(m: ArrayLike, k: int = 0) -> Array:
    405   return jnp.tril(m, k)
    408 @_wraps(scipy.linalg.triu)
    409 def triu(m: ArrayLike, k: int = 0) -> Array:

AttributeError: module 'scipy.linalg' has no attribute 'tril'

Would you please help me figure out it? Thanks.

shahrozeabbas commented 5 months ago

Getting the same error. Package is installed without problems but this error appears when trying to import in an interactive session.

mtoninel commented 5 months ago

I was faced with the same issue and managed to solve it by installing a previous version of scipy. It appears that from version 1.13.0 (the one I had installed following recommendations for this package) they deprecated the use of tril as well as other functions from the linalg module (see https://docs.scipy.org/doc/scipy/release/1.11.0-notes.html#id20). Citing from their docs:

The scipy.linalg functions tri, triu & tril are deprecated and will be removed in SciPy 1.13. Users are recommended to use the NumPy versions of these functions with identical names.

Therefore running the following code solved the issue for me:

pip install scipy==1.12.0

I don't know if this might be worth a PR. Maybe the author has a fix already in the works.

HelloWorldLTY commented 5 months ago

I was faced with the same issue and managed to solve it by installing a previous version of scipy. It appears that from version 1.13.0 (the one I had installed following recommendations for this package) they deprecated the use of tril as well as other functions from the linalg module (see https://docs.scipy.org/doc/scipy/release/1.11.0-notes.html#id20). Citing from their docs:

The scipy.linalg functions tri, triu & tril are deprecated and will be removed in SciPy 1.13. Users are recommended to use the NumPy versions of these functions with identical names.

Therefore running the following code solved the issue for me:

pip install scipy==1.12.0

I don't know if this might be worth a PR. Maybe the author has a fix already in the works.

Thanks for your solution, it works for me. I think I can open a PR and it seems that there is no explict information for this bug, moreover, it seems that we also need to install scanpy, which is also not mentioned by this tool.

I also face a problem about installing gpu version of jax for this model. I will try the updated one later.

-- update: It seems that we cannot pull the request since we are not collobrators. Let's wait for their news.

HelloWorldLTY commented 5 months ago

Hi, it seems that I also cannot install the cuda version of jax:

WARNING: jax 0.4.23 does not provide the extra 'cuda11-pip'

Based on the codes provided in the read me file. Does anyone successfully install the jax with cuda setting? Thanks.

mtoninel commented 5 months ago

Hi, it seems that I also cannot install the cuda version of jax:

WARNING: jax 0.4.23 does not provide the extra 'cuda11-pip'

Based on the codes provided in the read me file. Does anyone successfully install the jax with cuda setting? Thanks.

I managed to install jax on my system (with CUDA at version 12.2 installed) by running:

# Following guidelines at https://jax.readthedocs.io/en/latest/installation.html#pip-installation-gpu-cuda-installed-via-pip-easier
# Update pip first
pip install --upgrade pip

# Then install jax based on cuda version
pip install --upgrade "jax[cuda12_pip]==0.4.23" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

If you have a different version of CUDA installed on your system you should be able to accomodate for that by specifying it in the command above (e.g. jax[cuda11_pip]). I still need to test the package as a whole so this might end up causing issues later on...

Hope this helps!

DoronHav commented 4 months ago

Apologies for the late response.

Thank you for pointing this out, we have been seeing issues with people running ENVI on cuda11... We found that instead of installing jax with

pip install -U "jax[cuda12_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

You should run these commands instead (notice the scipy specification):

pip install --upgrade "jax[cuda11_local]==0.4.23" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

pip install cuda-python==11.8.2
pip install nvidia-cudnn-cu11===8.6.0.163

pip install nvidia-cublas-cu11 nvidia-cuda-nvcc-cu11 nvidia-cuda-runtime-cu11  nvidia-cufft-cu11 nvidia-cusolver-cu11 nvidia-cusparse-cu11  nvidia-cuda-cupti-cu11

pip install scipy==1.9.3

And then install ENVI:

pip install scenvi

Let us know if this works for you as well!