peng-lab / BaSiCPy

MIT License
61 stars 20 forks source link

Installation error #147

Open BioinfoTongLI opened 4 months ago

BioinfoTongLI commented 4 months ago

Hi there! Great work! many thanks for creating this tool!

I am having trouble installing it in a conda environment. I did:

conda create -n test python=3.9
conda activate test
pip install basicpy

and got this error.

Python 3.9.18 | packaged by conda-forge | (main, Dec 23 2023, 16:33:10) 
[GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from basicpy import BaSiC
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/mambaforge/envs/test/lib/python3.9/site-packages/basicpy/__init__.py", line 7, in <module>
    from basicpy.basicpy import BaSiC
  File "/home/ubuntu/mambaforge/envs/test/lib/python3.9/site-packages/basicpy/basicpy.py", line 27, in <module>
    from basicpy._jax_routines import ApproximateFit, LadmapFit
  File "/home/ubuntu/mambaforge/envs/test/lib/python3.9/site-packages/basicpy/_jax_routines.py", line 10, in <module>
    from basicpy.tools.dct_tools import JaxDCT
  File "/home/ubuntu/mambaforge/envs/test/lib/python3.9/site-packages/basicpy/tools/__init__.py", line 3, in <module>
    from basicpy.tools import dct_tools
  File "/home/ubuntu/mambaforge/envs/test/lib/python3.9/site-packages/basicpy/tools/dct_tools.py", line 13, in <module>
    import basicpy.tools._jax_idct
  File "/home/ubuntu/mambaforge/envs/test/lib/python3.9/site-packages/basicpy/tools/_jax_idct.py", line 6, in <module>
    from jax._src.numpy.util import _wraps
ImportError: cannot import name '_wraps' from 'jax._src.numpy.util' (/home/ubuntu/mambaforge/envs/test/lib/python3.9/site-packages/jax/_src/numpy/util.py)`

here's my pip list output:

Package                  Version
------------------------ -----------
annotated-types          0.6.0
BaSiCPy                  1.1.0
certifi                  2024.2.2
charset-normalizer       3.3.2
gradient-free-optimizers 1.3.0
hyperactive              4.6.0
idna                     3.6
imageio                  2.34.0
importlib-metadata       7.0.1
jax                      0.4.25
jaxlib                   0.4.25
joblib                   1.3.2
lazy_loader              0.3
ml-dtypes                0.3.2
networkx                 3.2.1
numpy                    1.26.4
opt-einsum               3.3.0
packaging                23.2
pandas                   1.5.3
pillow                   10.2.0
pip                      24.0
platformdirs             4.2.0
pooch                    1.8.1
pydantic                 2.6.3
pydantic_core            2.16.3
python-dateutil          2.9.0.post0
pytz                     2024.1
requests                 2.31.0
scikit-image             0.22.0
scikit-learn             1.4.1.post1
scipy                    1.12.0
setuptools               69.1.1
six                      1.16.0
threadpoolctl            3.3.0
tifffile                 2024.2.12
tqdm                     4.66.2
typing_extensions        4.10.0
urllib3                  2.2.1
wheel                    0.42.0
zipp                     3.17.0

Anything I am doing wrong? It looks like jax related?

prete commented 4 months ago

BaSiCPy 1.1.0 won't work with the latest jax versions. You'll need to pin down your jax/jaxlib to version <=0.4.23. This should fix it: pip install -U jax==0.4.23 jaxlib==0.4.23

(ymmv if you want the cuda versions)

BioinfoTongLI commented 4 months ago

awesome, it is working! indeed, would be great to have the cuda versions. Thanks!

yfukai commented 4 months ago

Thanks @prete and @BioinfoTongLI for your comments! Yeah maintaining JAX compatibility has been a source of headaches for us... I may work on something with PyTorch in the near future.

yfukai commented 4 months ago

I'll add the upper version constraint for jax for now.

BioinfoTongLI commented 4 months ago

great to know you are switching to torch! looking forward to it!

Boehmin commented 3 months ago

I am testing the shading correction just now and was wondering if there is any news regarding the cuda jaxlib-versions? I would love to run this pipeline using GPU since it is very slow otherwise. Thank you!