Since I ran into some difficulties installing flownet2-pytorch using conda, I am saving the steps I undertook for posterity.
NOTE:
- This aids in the installation of this fork, which contains a few tweaks for ease of installation. It has not been tested on the original repository. This fork is of the latest version of flownet2-pytorch, as of the time of publication of this gist. The fork does not change any of the source files.
- I will share the complete set of dependencies, as well as my system details in later files in this gist. You may try skipping step 2 below by directly installing this set of dependencies using
conda env create -f env.yml
, and it should work if you have a similar system. - The steps assume that the conda-forge channel is a part of your conda config. If this is not the case, you can add it as below (because it should be anyway):
conda config --add channels conda-forge
- clone the repository
git clone https://github.com/VedanshM/flownet2-pytorch/tree/60119989782151c15157661ca8cf0a77e414368c
- The smallest set of reproducible steps I could plan to successfully install the dependencies, are as below:
- Create the environment, and activate it.
conda create -n flownet2 -y conda activate flownet2
- First, install the python dependencies mentioned in the official repository.
conda install pytorch==0.4.1 -y conda install colorama numpy scikit-image setproctitle tensorboardx tqdm -y
- Install
cudatoolkit-dev=11.3
for ensured compatibility with flownet2. My local nvcc version was (is) 11.5, which was causing some conflicts. 11.3 seemed to work based on trial and error.
conda install cudatoolkit-dev=11.3 -y
- The gcc version cannot be more than 10, to ensure compatibility with CUDA.
conda install 'gxx<10' -y
- Install pytorch locally in accordance with our cuda version (11.3), as recommended in the official site. (I know that pytorch was installed before as well, but the dependencies don't seem to work if I immediately install 1.12.1. Thus, either directly install from the env file below, or follow these steps in this order).
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch -y
- Finally, some gcc activation scripts are required to run the install scripts in flownet that are not installed above. Thus, run the following:
conda install gxx_linux-64 -y
- The installation scripts require
crypt.h
, which is not installed by conda along with python as mentioned here. Thus, copy the file from your local include, as:
cp /usr/include/crypt.h ~/miniconda3/envs/flownet2/include/python3.7m
if you're not using miniconda, use the script in the linked discussion instead. You may have to change your env name, and python version as required.
- Now, attempt to run
bash install.sh
. If it complains about some missing modules, then proceed, otherwise you're done!
cd flownet2-pytorch
bash install.sh
- If the above step failed, you may need to build the
resample2d_package
module by running thesetup.py
script in the corresponding directory. Navigate to the resample2d_package directory and run the setup scripts:
cd flownet2-pytorch/networks/resample2d_package
python setup.py build
python setup.py install
- Finally, navigate back to the root of the clone, and run
bash install.sh
again.
You should have flownet2-pytorch installed succesfully! Good luck!