facebookresearch / AnimatedDrawings

Code to accompany "A Method for Animating Children's Drawings of the Human Figure"
MIT License
10.62k stars 934 forks source link

Add additional instructions for macOS allowing to run locally #258

Closed gravityrail closed 8 months ago

gravityrail commented 11 months ago

I hit a bug running the Docker container on my M2 Macbook Pro, but was eventually able to get it running locally by slightly tweaking the dependencies. Since some people may prefer this approach or find it educational, I added it to the README and added an example torchserve config file.

facebook-github-bot commented 11 months ago

Hi @gravityrail!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

facebook-github-bot commented 11 months ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

kekearif commented 9 months ago

I am interested in running this locally on my Mac without docker however I am running into an issue when installing the dependencies.

pip install -U openmim torch==1.13.0 torchserve mmdet==2.27.0 mmpose==0.29.0 mmtrack numpy==1.23.3 requests==2.31.0 scipy==1.10.0 tqdm==4.64.1 gives me the following error:

Building wheels for collected packages: pycocotools, xtcocotools
  Building wheel for pycocotools (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [44 lines of output]
      /private/var/folders/m2/w681m9fj2fx_wg7l_m38_bz00000gn/T/pip-install-ki1sbci8/pycocotools_ed6682077fe749138b1583b573775253/setup.py:12: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.Distribution().fetch_build_eggs(setup_requires)
      /Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-11.1-arm64-cpython-38
      creating build/lib.macosx-11.1-arm64-cpython-38/pycocotools
      copying pycocotools/coco.py -> build/lib.macosx-11.1-arm64-cpython-38/pycocotools
      copying pycocotools/mask.py -> build/lib.macosx-11.1-arm64-cpython-38/pycocotools
      copying pycocotools/__init__.py -> build/lib.macosx-11.1-arm64-cpython-38/pycocotools
      copying pycocotools/cocoeval.py -> build/lib.macosx-11.1-arm64-cpython-38/pycocotools
      running build_ext
      Compiling pycocotools/_mask.pyx because it changed.
      [1/1] Cythonizing pycocotools/_mask.pyx
      /private/var/folders/m2/w681m9fj2fx_wg7l_m38_bz00000gn/T/pip-install-ki1sbci8/pycocotools_ed6682077fe749138b1583b573775253/.eggs/Cython-3.0.8-py3.8.egg/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /private/var/folders/m2/w681m9fj2fx_wg7l_m38_bz00000gn/T/pip-install-ki1sbci8/pycocotools_ed6682077fe749138b1583b573775253/pycocotools/_mask.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      building 'pycocotools._mask' extension
      creating build/common
      creating build/temp.macosx-11.1-arm64-cpython-38
      creating build/temp.macosx-11.1-arm64-cpython-38/common
      creating build/temp.macosx-11.1-arm64-cpython-38/pycocotools
      gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/kekearif/miniconda3/envs/animated_drawings/include -arch arm64 -I/Users/kekearif/miniconda3/envs/animated_drawings/include -arch arm64 -I/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/numpy/core/include -I./common -I/Users/kekearif/miniconda3/envs/animated_drawings/include/python3.8 -c ../common/maskApi.c -o build/temp.macosx-11.1-arm64-cpython-38/../common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
      clang: error: no such file or directory: '../common/maskApi.c'
      clang: error: no input files
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pycocotools
  Running setup.py clean for pycocotools
  Building wheel for xtcocotools (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [42 lines of output]
      /Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/m2/w681m9fj2fx_wg7l_m38_bz00000gn/T/pip-install-ki1sbci8/xtcocotools_124bd6d28f184d32b7270b5436a57c8d/setup.py", line 106, in <module>
          setup(
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/__init__.py", line 102, in setup
          _install_setup_requires(attrs)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/__init__.py", line 75, in _install_setup_requires
          _fetch_build_eggs(dist)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/__init__.py", line 80, in _fetch_build_eggs
          dist.fetch_build_eggs(dist.setup_requires)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/dist.py", line 636, in fetch_build_eggs
          return _fetch_build_eggs(self, requires)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/installer.py", line 38, in _fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/pkg_resources/__init__.py", line 813, in resolve
          dist = self._resolve_dist(
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/pkg_resources/__init__.py", line 849, in _resolve_dist
          dist = best[req.key] = env.best_match(
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1119, in best_match
          return self.obtain(req, installer)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1130, in obtain
          return installer(requirement) if installer else None
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/installer.py", line 106, in _fetch_build_egg_no_warn
          wheel.install_as_egg(dist_location)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/wheel.py", line 120, in install_as_egg
          self._install_as_egg(destination_eggdir, zf)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/wheel.py", line 128, in _install_as_egg
          self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/wheel.py", line 173, in _convert_metadata
          os.rename(dist_info, egg_info)
      OSError: [Errno 66] Directory not empty: '/private/var/folders/m2/w681m9fj2fx_wg7l_m38_bz00000gn/T/pip-install-ki1sbci8/xtcocotools_124bd6d28f184d32b7270b5436a57c8d/.eggs/matplotlib-3.7.5-py3.8-macosx-11.1-arm64.egg/matplotlib-3.7.5.dist-info' -> '/private/var/folders/m2/w681m9fj2fx_wg7l_m38_bz00000gn/T/pip-install-ki1sbci8/xtcocotools_124bd6d28f184d32b7270b5436a57c8d/.eggs/matplotlib-3.7.5-py3.8-macosx-11.1-arm64.egg/EGG-INFO'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for xtcocotools
  Running setup.py clean for xtcocotools
  error: subprocess-exited-with-error

  × python setup.py clean did not run successfully.
  │ exit code: 1
  ╰─> [42 lines of output]
      /Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/__init__.py:80: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/m2/w681m9fj2fx_wg7l_m38_bz00000gn/T/pip-install-ki1sbci8/xtcocotools_124bd6d28f184d32b7270b5436a57c8d/setup.py", line 106, in <module>
          setup(
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/__init__.py", line 102, in setup
          _install_setup_requires(attrs)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/__init__.py", line 75, in _install_setup_requires
          _fetch_build_eggs(dist)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/__init__.py", line 80, in _fetch_build_eggs
          dist.fetch_build_eggs(dist.setup_requires)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/dist.py", line 636, in fetch_build_eggs
          return _fetch_build_eggs(self, requires)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/installer.py", line 38, in _fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/pkg_resources/__init__.py", line 813, in resolve
          dist = self._resolve_dist(
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/pkg_resources/__init__.py", line 849, in _resolve_dist
          dist = best[req.key] = env.best_match(
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1119, in best_match
          return self.obtain(req, installer)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1130, in obtain
          return installer(requirement) if installer else None
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/installer.py", line 106, in _fetch_build_egg_no_warn
          wheel.install_as_egg(dist_location)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/wheel.py", line 120, in install_as_egg
          self._install_as_egg(destination_eggdir, zf)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/wheel.py", line 128, in _install_as_egg
          self._convert_metadata(zf, destination_eggdir, dist_info, egg_info)
        File "/Users/kekearif/miniconda3/envs/animated_drawings/lib/python3.8/site-packages/setuptools/wheel.py", line 173, in _convert_metadata
          os.rename(dist_info, egg_info)
      OSError: [Errno 66] Directory not empty: '/private/var/folders/m2/w681m9fj2fx_wg7l_m38_bz00000gn/T/pip-install-ki1sbci8/xtcocotools_124bd6d28f184d32b7270b5436a57c8d/.eggs/matplotlib-3.7.5-py3.8-macosx-11.1-arm64.egg/matplotlib-3.7.5.dist-info' -> '/private/var/folders/m2/w681m9fj2fx_wg7l_m38_bz00000gn/T/pip-install-ki1sbci8/xtcocotools_124bd6d28f184d32b7270b5436a57c8d/.eggs/matplotlib-3.7.5-py3.8-macosx-11.1-arm64.egg/EGG-INFO'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed cleaning build dir for xtcocotools
Failed to build pycocotools xtcocotools
ERROR: Could not build wheels for pycocotools, xtcocotools, which is required to install pyproject.toml-based projects

@gravityrail any idea on how this can be resolved? Followed all the steps in order.