benjiebob / SMALify

This repository contains an implementation for performing 3D animal (quadruped) reconstruction from a monocular image or video. The system adapts the pose (limb positions) and shape (animal type/height/weight) parameters for the SMAL deformable quadruped model, as well as camera parameters until the projected SMAL model aligns with 2D keypoints and silhouette segmentations extracted from the input frame(s).
106 stars 18 forks source link

conda create environment with requirements.txt error #25

Open Quartenia opened 3 years ago

Quartenia commented 3 years ago

Hi! I'm experiencing some issues creating the environment using miniconda on Linux using the requirements.txt file. The installed Miniconda version is conda 4.9.2 on Ubuntu 18.04.4 LTS.

I've not much experience with Anaconda and Linux so I'm not sure if I'm missing anything.

The error I'm getting when running the command conda create --name env_smalify --file requirements.txt is:

Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - packaging==20.4=pypi_0
  - termcolor==1.1.0=pypi_0
  - dataclasses==0.6=pypi_0
  - pyyaml==5.3.1=pypi_0
  - cython==0.29.21=pypi_0
  - gcc-7==7.1.0=0
  - pytorch==1.6.0=py3.8_cuda10.1.243_cudnn7.6.3_0
  - opencv-contrib-python==4.4.0.44=pypi_0
  - kiwisolver==1.2.0=pypi_0
  - cycler==0.10.0=pypi_0
  - nibabel==3.1.1=pypi_0
  - tqdm==4.50.0=pypi_0
  - tabulate==0.8.7=pypi_0
  - matplotlib==3.3.2=pypi_0
  - torchvision==0.7.0=py38_cu101
  - portalocker==2.0.0=pypi_0
  - imageio==2.9.0=pypi_0
  - pyparsing==2.4.7=pypi_0
  - python-dateutil==2.8.1=pypi_0
  - yacs==0.1.8=pypi_0
  - chumpy==0.70=pypi_0
  - fvcore==0.1.2.post20200929=pypi_0
  - future==0.18.2=pypi_0
  - scipy==1.5.2=pypi_0
  - torchgeometry==0.1.2=pypi_0
  - trimesh==3.8.10=pypi_0
  - pytorch3d==0.2.5=pypi_0
  - pycocotools==2.0=pypi_0

Current channels:

  - https://conda.anaconda.org/conda-forge/linux-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://conda.anaconda.org/pypi/linux-64
  - https://conda.anaconda.org/pypi/noarch
  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.
benjiebob commented 3 years ago

Thanks very much for reporting this; I am able to reproduce the error. Tagging @OllieBoyne. One of us will fix soon!

Quartenia commented 3 years ago

Thank you for the quick reply @benjiebob !

Would there be a workaround by changing something in my setup?

benjiebob commented 3 years ago

Yes of course, the basic workaround is to just install the packages manually. I'd recommend installing PyTorch first. Afterwards, these commands should cover the rest (sorry if I've forgotten a couple... if so, please could you let me know below):

pip install "git+https://github.com/facebookresearch/pytorch3d.git"
pip install matplotlib opencv-contrib-python scipy nibabel tqdm trimesh imageio ffmpeg cython chumpy
python -m pip install "git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI"

If you happen to see a GCC related error when you install pytorch3d (the first of the 3 commands above), make sure you have a recent gcc version installed. I tend to use conda packages to upgrade:

conda install -c omgarcia isl
conda install -c creditx gcc-7

After this, you should be able to run the commands above as normal

Quartenia commented 3 years ago

I got it to work but i got this error:

Traceback (most recent call last):
  File "smal_fitter/optimize_to_joints.py", line 147, in <module>
    main()
  File "smal_fitter/optimize_to_joints.py", line 140, in main
    model.generate_visualization(image_exporter)
  File "/root/SMALify/smal_fitter/smal_fitter.py", line 210, in generate_visualization
    rot_matrix = torch.from_numpy(R.from_euler('y', 180.0, degrees=True).as_dcm()).float().to(self.device)
AttributeError: 'scipy.spatial.transform.rotation.Rotation' object has no attribute 'as_dcm'

which I fixed by installing pip install scipy==1.5.2 which is the version listed in the requirements.txt. Apparently as_dcm does not work with scipy 1.6.0, which was installed with pip install matplotlib opencv-contrib-python scipy nibabel tqdm trimesh imageio ffmpeg cython chumpy as you suggested.