mvsnerf icon indicating copy to clipboard operation
mvsnerf copied to clipboard

Missing dependency definition - neither a requirements.txt nor a environment.yml

Open TommeTao opened this issue 2 years ago • 8 comments

Hi there,

May I kindly ask you to add a requirements.txt or environment.yml (with the later being prefered)? I am trying to get your code working and am running into multiple dependency issues, such as:

  • module not found errors for at least three packages, e.g., kornia
  • ImportError for inplace_abn, which might indicate an incompatible PyTorch version (ImportError: /mvsnerf/conda-env-py37/lib/python3.7/site-packages/inplace_abn/_backend.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZNK2at6Tensor3addEN3c106ScalarES2_)

Highly appreciated if you run something like conda env export --file environment.yml from within the active conda environment and add the file to the repository.

Thanks a lot!

TommeTao avatar Nov 26 '21 11:11 TommeTao

I agree. I faced same error... how can i fix it?

codestella avatar Dec 09 '21 04:12 codestella

@TommeTao hello, did you fix the error? ImportError: /mvsnerf/conda-env-py37/lib/python3.7/site-packages/inplace_abn/_backend.cpython-37m-x86_64-linux-gnu.so: undefined symbol: ZNK2at6Tensor3addEN3c106ScalarES2

codestella avatar Dec 09 '21 04:12 codestella

@codestella Your error appears, because you compiled some parts of your code (this case inplace_abn) with another pytorch version, than you use later on. This usually happens if you install packages that have a dependency for newer pytorch versions.

What I did was checking which package installs the new pytorch version. In my case this was "kornia" and I needed to specify "pip install kornia==0.5.11".

The dependencies for MVSNeRF that I installed with pip are pip install pytorch-lightning==1.3.5 inplace_abn imageio pillow scikit-image opencv-python configargparse lpips kornia==0.5.11 warmup_scheduler I hope that helps you!

peerschuett avatar Dec 09 '21 15:12 peerschuett

Well, I used pip install pytorch-lightning==1.3.5 inplace_abn imageio pillow scikit-image opencv-python configargparse lpips kornia==0.5.11 warmup_scheduler to install packages. But I got 'The CUDA version(11.5) detected is not the one used to compile pytorch(10.5)' error when installing inpalce_abn. Sorry, I can't remember exact output message. I guess pytorch-ligntning installs one version of torch compiled by CUDA 10.2 and inplace_abn detects this version and tries to use it. But it found the local cuda version dismatch with torch version, so it reports the error. I reinstalled pytorch using pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio==0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html to solve this problem.

Actually, I recommend to use anaconda to install packages in normal cases because conda is very good at managing dependies of different packages. However, there are some packages must be installed using pip in this project. Sad, I have to say using pip troubles me a lot.

hengfei-wang avatar Dec 20 '21 18:12 hengfei-wang

Another reminder:

Remember to do 'pip install imageio-ffmpeg' if you want to rendering videos.

Can authors check their code and make a good guideline? :-(

hengfei-wang avatar Dec 20 '21 22:12 hengfei-wang

Thanks @hengfei-wang for the tip. Thats problem with inplace_abn come from different cuda version of the system and cuda version of pytorch.

I tried to install pytorch + cudatoolkit==11.3 via conda, but in jupyter i had torch.cuda.is_available() == False

After installing all with pip works like a charm.

My installation process:

conda create -n mvsnerf python=3.8
conda activate mvsnerf
pip install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio==0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
pip install pytorch-lightning==1.3.5 imageio pillow scikit-image opencv-python configargparse lpips kornia warmup_scheduler matplotlib

Installing inplace_abn from source

git clone https://github.com/mapillary/inplace_abn.git
cd inplace_abn
python setup.py install

Dear authors (@apchenstu), please check your repository and notebooks before you publish it, a lot of imports are missed, variables aren't initiated, no dependencies file and full installation requirements. Running just single file become challenging!

sviperm avatar Dec 21 '21 11:12 sviperm

besides above, I found that:

  1. torchmetrics==0.5.0 (otherwise error:
from torchmetrics.utilities.data import get_num_classes as _get_num_classes
ImportError: cannot import name 'get_num_classes' from 'torchmetrics.utilities.data' (/home/anaconda3/envs/mvsnerf/lib/python3.8/site-packages/torchmetrics/utilities/data.py))

) 2. setuptools==59.5.0 (otherwise error:

AttributeError: module 'distutils' has no attribute 'version'

) 3. test-tube==0.7.5 (otherwise error:

Traceback (most recent call last):
  File "train_mvs_nerf_finetuning_pl.py", line 302, in <module>
    logger = loggers.TestTubeLogger(
  File "/home/anaconda3/envs/mvsnerf/lib/python3.8/site-packages/pytorch_lightning/loggers/test_tube.py", line 98, in __init__
    raise ImportError(
ImportError: You want to use `test_tube` logger which is not installed yet, install it with `pip install test-tube`.

) 4. pillow==9.5.0 (otherwise error:

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

)

elenacliu avatar Jul 17 '23 14:07 elenacliu

My pip's environment.yml and requirements.txt for you to try and use:

environment.yml

name: mvsnerf
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - pytorch
  - conda-forge
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2023.05.30=h06a4308_0
  - ld_impl_linux-64=2.38=h1181459_1
  - libffi=3.4.4=h6a678d5_0
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.9=h7f8727e_0
  - pip=23.1.2=py38h06a4308_0
  - python=3.8.17=h955ad1f_0
  - readline=8.2=h5eee18b_0
  - sqlite=3.41.2=h5eee18b_0
  - tk=8.6.12=h1ccaba5_0
  - wheel=0.38.4=py38h06a4308_0
  - xz=5.4.2=h5eee18b_0
  - zlib=1.2.13=h5eee18b_0
  - pip:
    - absl-py==1.4.0
    - aiohttp==3.8.4
    - aiosignal==1.3.1
    - async-timeout==4.0.2
    - attrs==23.1.0
    - cachetools==5.3.1
    - certifi==2023.5.7
    - charset-normalizer==3.2.0
    - configargparse==1.5.5
    - contourpy==1.1.0
    - cycler==0.11.0
    - fonttools==4.41.0
    - frozenlist==1.4.0
    - fsspec==2023.6.0
    - future==0.18.3
    - google-auth==2.22.0
    - google-auth-oauthlib==1.0.0
    - grpcio==1.56.0
    - idna==3.4
    - imageio==2.31.1
    - importlib-metadata==6.8.0
    - importlib-resources==6.0.0
    - inplace-abn==1.1.1.dev7+gd7dd3e1
    - kiwisolver==1.4.4
    - kornia==0.6.12
    - lazy-loader==0.3
    - lightning-utilities==0.9.0
    - lpips==0.1.4
    - markdown==3.4.3
    - markupsafe==2.1.3
    - matplotlib==3.7.2
    - multidict==6.0.4
    - networkx==3.1
    - numpy==1.24.4
    - oauthlib==3.2.2
    - opencv-python==4.8.0.74
    - pandas==2.0.3
    - pillow==9.5.0
    - protobuf==4.23.4
    - pyasn1==0.5.0
    - pyasn1-modules==0.3.0
    - pydeprecate==0.3.0
    - pyparsing==3.0.9
    - python-dateutil==2.8.2
    - pytorch-lightning==1.3.5
    - pytz==2023.3
    - pywavelets==1.4.1
    - pyyaml==5.4.1
    - requests==2.31.0
    - requests-oauthlib==1.3.1
    - rsa==4.9
    - scikit-image==0.21.0
    - scipy==1.10.1
    - setuptools==59.5.0
    - six==1.16.0
    - tensorboard==2.13.0
    - tensorboard-data-server==0.7.1
    - test-tube==0.7.5
    - tifffile==2023.7.10
    - torch==1.10.1+cu113
    - torchaudio==0.10.1+cu113
    - torchmetrics==0.5.0
    - torchvision==0.11.2+cu113
    - tqdm==4.65.0
    - tzdata==2023.3
    - urllib3==1.26.16
    - warmup-scheduler==0.3
    - werkzeug==2.3.6
    - yarl==1.9.2
    - zipp==3.16.2

requirements.txt

absl-py==1.4.0
aiohttp==3.8.4
aiosignal==1.3.1
async-timeout==4.0.2
attrs==23.1.0
black==23.1.0
cachetools==5.3.1
certifi==2023.5.7
charset-normalizer==3.2.0
click==8.1.3
ConfigArgParse==1.5.5
contourpy==1.1.0
cycler==0.11.0
fonttools==4.41.0
frozenlist==1.4.0
fsspec==2023.6.0
future==0.18.3
google-auth==2.22.0
google-auth-oauthlib==1.0.0
grpcio==1.56.0
idna==3.4
imageio==2.31.1
importlib-metadata==6.8.0
importlib-resources==6.0.0
inplace-abn==1.1.1.dev7+gd7dd3e1
kiwisolver==1.4.4
kornia==0.6.12
lazy_loader==0.3
lightning-utilities==0.9.0
lpips==0.1.4
Markdown==3.4.3
MarkupSafe==2.1.3
matplotlib==3.7.2
multidict==6.0.4
mypy-extensions==1.0.0
networkx==3.1
numpy==1.24.4
oauthlib==3.2.2
opencv-python==4.8.0.74
packaging==23.0
pandas==2.0.3
pathspec==0.11.1
Pillow==9.5.0
platformdirs==3.1.1
protobuf==4.23.4
pyasn1==0.5.0
pyasn1-modules==0.3.0
pyDeprecate==0.3.0
pyparsing==3.0.9
python-dateutil==2.8.2
pytorch-lightning==1.3.5
pytz==2023.3
PyWavelets==1.4.1
PyYAML==5.4.1
requests==2.31.0
requests-oauthlib==1.3.1
rsa==4.9
scikit-image==0.21.0
scipy==1.10.1
six==1.16.0
tensorboard==2.13.0
tensorboard-data-server==0.7.1
test-tube==0.7.5
tifffile==2023.7.10
tomli==2.0.1
torch==1.10.1+cu113
torchaudio==0.10.1+cu113
torchmetrics==0.5.0
torchvision==0.11.2+cu113
tqdm==4.65.0
typing_extensions==4.5.0
tzdata==2023.3
urllib3==1.26.16
warmup-scheduler==0.3
Werkzeug==2.3.6
yarl==1.9.2
zipp==3.16.2

and for the inplace_abn pacakge:

Installing inplace_abn from source

git clone https://github.com/mapillary/inplace_abn.git
cd inplace_abn
python setup.py install

elenacliu avatar Jul 17 '23 15:07 elenacliu