allenai / satlas-super-resolution

Apache License 2.0
190 stars 24 forks source link

Numpy version is not working #35

Open axin1301 opened 1 month ago

axin1301 commented 1 month ago

Hi, thank you for your contribution to our community. When I reproduce the results, I got stuck by "ImportError: numpy._core.multiarray failed to import". Could you please show me your python package versions so that I can run the inference with no errors? Thank you.

piperwolters commented 1 month ago

Hello! Could you try creating an environment with these steps?

JacobJeppesen commented 2 weeks ago

I encountered the same issue, which was due to numpy 2.0. Was fixed by setting numpy==1.26.4 in requirements.txt.

@piperwolters would you be open to pinning all the dependencies in the repo? One way of doing it could be by using pip-compile: https://github.com/jazzband/pip-tools?tab=readme-ov-file#requirements-from-requirementsin

If you make a brief adjustment by writing the dependencies in a requirements.in file like this:

basicsr==1.4.2
lpips
numpy==1.26.4
scikit-image
Pillow
opencv_python
kornia
wandb
git+https://github.com/openai/CLIP.git
open_clip_torch
torch==2.1.0
torchvision==0.16.0

--find-links=https://girder.github.io/large_image_wheels
GDAL

Then you can run pip install pip-tools and then pip-compile requirements.in, and you should get a requirements.txt file similar to the one below. That would secure the versioning of all the required packages, and also add gdal to requirements.txt, so it's automatically installed when running pip install -r requirements.txt. I usually then add both the requirements.in and requirements.txt files to the repo, such that they're available for reference.

#
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
#    pip-compile requirements.in
#
--find-links https://girder.github.io/large_image_wheels

absl-py==2.1.0
    # via tb-nightly
addict==2.4.0
    # via basicsr
basicsr==1.4.2
    # via -r requirements.in
certifi==2024.7.4
    # via
    #   requests
    #   sentry-sdk
charset-normalizer==3.3.2
    # via requests
click==8.1.7
    # via wandb
clip @ git+https://github.com/openai/CLIP.git
    # via -r requirements.in
docker-pycreds==0.4.0
    # via wandb
filelock==3.15.4
    # via
    #   huggingface-hub
    #   torch
    #   triton
fsspec==2024.6.1
    # via
    #   huggingface-hub
    #   torch
ftfy==6.2.0
    # via
    #   clip
    #   open-clip-torch
future==1.0.0
    # via basicsr
gdal==3.10.0
    # via -r requirements.in
gitdb==4.0.11
    # via gitpython
gitpython==3.1.43
    # via wandb
grpcio==1.65.1
    # via tb-nightly
huggingface-hub==0.24.2
    # via
    #   open-clip-torch
    #   timm
idna==3.7
    # via requests
imageio==2.34.2
    # via scikit-image
importlib-metadata==8.2.0
    # via
    #   markdown
    #   yapf
jinja2==3.1.4
    # via torch
kornia==0.7.3
    # via -r requirements.in
kornia-rs==0.1.5
    # via kornia
lazy-loader==0.4
    # via scikit-image
lmdb==1.5.1
    # via basicsr
lpips==0.1.4
    # via -r requirements.in
markdown==3.6
    # via tb-nightly
markupsafe==2.1.5
    # via
    #   jinja2
    #   werkzeug
mpmath==1.3.0
    # via sympy
networkx==3.2.1
    # via
    #   scikit-image
    #   torch
numpy==1.26.4
    # via
    #   -r requirements.in
    #   basicsr
    #   imageio
    #   lpips
    #   opencv-python
    #   scikit-image
    #   scipy
    #   tb-nightly
    #   tifffile
    #   torchvision
nvidia-cublas-cu12==12.1.3.1
    # via
    #   nvidia-cudnn-cu12
    #   nvidia-cusolver-cu12
    #   torch
nvidia-cuda-cupti-cu12==12.1.105
    # via torch
nvidia-cuda-nvrtc-cu12==12.1.105
    # via torch
nvidia-cuda-runtime-cu12==12.1.105
    # via torch
nvidia-cudnn-cu12==8.9.2.26
    # via torch
nvidia-cufft-cu12==11.0.2.54
    # via torch
nvidia-curand-cu12==10.3.2.106
    # via torch
nvidia-cusolver-cu12==11.4.5.107
    # via torch
nvidia-cusparse-cu12==12.1.0.106
    # via
    #   nvidia-cusolver-cu12
    #   torch
nvidia-nccl-cu12==2.18.1
    # via torch
nvidia-nvjitlink-cu12==12.5.82
    # via
    #   nvidia-cusolver-cu12
    #   nvidia-cusparse-cu12
nvidia-nvtx-cu12==12.1.105
    # via torch
open-clip-torch==2.26.1
    # via -r requirements.in
opencv-python==4.10.0.84
    # via
    #   -r requirements.in
    #   basicsr
packaging==24.1
    # via
    #   clip
    #   huggingface-hub
    #   kornia
    #   lazy-loader
    #   scikit-image
pillow==10.4.0
    # via
    #   -r requirements.in
    #   basicsr
    #   imageio
    #   scikit-image
    #   torchvision
platformdirs==4.2.2
    # via
    #   wandb
    #   yapf
protobuf==4.25.4
    # via
    #   tb-nightly
    #   wandb
psutil==6.0.0
    # via wandb
pyyaml==6.0.1
    # via
    #   basicsr
    #   huggingface-hub
    #   timm
    #   wandb
regex==2024.7.24
    # via
    #   clip
    #   open-clip-torch
requests==2.32.3
    # via
    #   basicsr
    #   huggingface-hub
    #   torchvision
    #   wandb
safetensors==0.4.3
    # via timm
scikit-image==0.24.0
    # via
    #   -r requirements.in
    #   basicsr
scipy==1.13.1
    # via
    #   basicsr
    #   lpips
    #   scikit-image
sentry-sdk==2.11.0
    # via wandb
setproctitle==1.3.3
    # via wandb
six==1.16.0
    # via
    #   docker-pycreds
    #   tb-nightly
smmap==5.0.1
    # via gitdb
sympy==1.13.1
    # via torch
tb-nightly==2.18.0a20240729
    # via basicsr
tensorboard-data-server==0.7.2
    # via tb-nightly
tifffile==2024.7.24
    # via scikit-image
timm==1.0.8
    # via open-clip-torch
tomli==2.0.1
    # via yapf
torch==2.1.0
    # via
    #   -r requirements.in
    #   basicsr
    #   clip
    #   kornia
    #   lpips
    #   open-clip-torch
    #   timm
    #   torchvision
torchvision==0.16.0
    # via
    #   -r requirements.in
    #   basicsr
    #   clip
    #   lpips
    #   open-clip-torch
    #   timm
tqdm==4.66.4
    # via
    #   basicsr
    #   clip
    #   huggingface-hub
    #   lpips
    #   open-clip-torch
triton==2.1.0
    # via torch
typing-extensions==4.12.2
    # via
    #   huggingface-hub
    #   torch
    #   wandb
urllib3==2.2.2
    # via
    #   requests
    #   sentry-sdk
wandb==0.17.5
    # via -r requirements.in
wcwidth==0.2.13
    # via ftfy
werkzeug==3.0.3
    # via tb-nightly
yapf==0.40.2
    # via basicsr
zipp==3.19.2
    # via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools
piperwolters commented 2 weeks ago

Hi Jacob, thanks for the suggestion. I have pinned numpy in requirements.txt for now, and will look into pinning the rest of them (maybe using pip-compile).