azeam / camset

GUI for v4l2-ctl
GNU General Public License v3.0
165 stars 17 forks source link

Install fails on pycairo dependancy #8

Closed kerryhatcher closed 3 years ago

kerryhatcher commented 3 years ago

Attempted install fails with either pip or pipx to install on Ubuntu 20.04. I'm using pyenv to manage my user python.

Note: I understand this is an issue with pycairo and not camset however it would benefit users of camset to figure this out and add a workaround or fix to the readme. I've spent a small amount of time attempting to debug the issue (installing dependencies and other ideas I found via Googling). Ended up just using v4l2-ctl to solve my immedate need but I'd much rather use Camset in the future.

Expected:

pip(x) install camset to successfully install application.

Experienced:

kwhatcher@kwhatcher-Precision-7710:~$ pipx install camset
  ERROR: Command errored out with exit status 1:
   command: /home/kwhatcher/.local/pipx/venvs/camset/bin/python /home/kwhatcher/.local/pipx/shared/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-_q6emlf5/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
       cwd: None
  Complete output (38 lines):
  Collecting setuptools
    Using cached setuptools-50.3.2-py3-none-any.whl (785 kB)
  Collecting wheel
    Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)
  Collecting pycairo
    Using cached pycairo-1.20.0.tar.gz (344 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Building wheels for collected packages: pycairo
    Building wheel for pycairo (PEP 517): started
    Building wheel for pycairo (PEP 517): finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /home/kwhatcher/.local/pipx/venvs/camset/bin/python /home/kwhatcher/.local/pipx/shared/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpvwcx2zh3
         cwd: /tmp/pip-install-v_y642_k/pycairo
    Complete output (15 lines):
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/cairo
    copying cairo/__init__.py -> build/lib.linux-x86_64-3.8/cairo
    copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.8/cairo
    copying cairo/py.typed -> build/lib.linux-x86_64-3.8/cairo
    running build_ext
    Package cairo was not found in the pkg-config search path.
    Perhaps you should add the directory containing `cairo.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'cairo' found
    Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
    ----------------------------------------
    ERROR: Failed building wheel for pycairo
  Failed to build pycairo
  ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/kwhatcher/.local/pipx/venvs/camset/bin/python /home/kwhatcher/.local/pipx/shared/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-_q6emlf5/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.

Error installing camset.
kwhatcher@kwhatcher-Precision-7710:~$ pip install camset
Collecting camset
  Using cached camset-0.0.11-py3-none-any.whl (66 kB)
Collecting opencv-python
  Using cached opencv_python-4.4.0.46-cp38-cp38-manylinux2014_x86_64.whl (49.5 MB)
Collecting PyGObject
  Using cached PyGObject-3.38.0.tar.gz (712 kB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /home/kwhatcher/.pyenv/versions/3.8.3/bin/python3 /home/kwhatcher/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-p9_85o11/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
       cwd: None
  Complete output (38 lines):
  Collecting setuptools
    Using cached setuptools-50.3.2-py3-none-any.whl (785 kB)
  Collecting wheel
    Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)
  Collecting pycairo
    Using cached pycairo-1.20.0.tar.gz (344 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Building wheels for collected packages: pycairo
    Building wheel for pycairo (PEP 517): started
    Building wheel for pycairo (PEP 517): finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /home/kwhatcher/.pyenv/versions/3.8.3/bin/python3 /home/kwhatcher/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpz99nsbo4
         cwd: /tmp/pip-install-xgfrb23z/pycairo
    Complete output (15 lines):
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/cairo
    copying cairo/__init__.py -> build/lib.linux-x86_64-3.8/cairo
    copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.8/cairo
    copying cairo/py.typed -> build/lib.linux-x86_64-3.8/cairo
    running build_ext
    Package cairo was not found in the pkg-config search path.
    Perhaps you should add the directory containing `cairo.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'cairo' found
    Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
    ----------------------------------------
    ERROR: Failed building wheel for pycairo
  Failed to build pycairo
  ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/kwhatcher/.pyenv/versions/3.8.3/bin/python3 /home/kwhatcher/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-p9_85o11/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.
azeam commented 3 years ago

It seems something changed recently (and hopefully temporarily) as I haven't experienced this before, but while experimenting package dependencies for the recent PR #7 I caught this error as well. Not sure exactly which package that solved it, but did you see the updated install suggestion in readme.md, namely sudo apt-get install libcairo2-dev libgirepository1.0-dev. See if that works, otherwise I will try to narrow it down better.

kerryhatcher commented 3 years ago

I had tried that before I opened the issue, but just ran it again just to double check and apt reports those are already installed.

Does make me feel better that I'm not just doing something super noobish ;)

azeam commented 3 years ago

Hm, I re-tested a bit and for me sudo apt-get remove libcairo2-dev libgirepository1.0-dev && pip uninstall pycairo camset PyGOjbect && pip install camset --no-cache gives me an identical error message as you posted above, but sudo apt-get install libcairo2-dev libgirepository1.0-dev && pip install camset --no-cache works. This is, however, not a clean Ubuntu install so it's possible that I have some other non-default package installed, but I think those should be enough. What is your output of pkg-config --variable pc_path pkg-config and echo $PKG_CONFIG_PATH ?

kerryhatcher commented 3 years ago

It would seem that $PKG_CONFIG_PATH was not set, it echos a blank line. I noticed that the output of pkg-config --variable pc_path pkg-config referenced linuxbrew directories. I used brew to setup python and pyenv (along with lots of other non related things).

I tried installing the brew versions of the dependencies and that seemed to do the trick. brew install cairo pkg-config pygobject3 gtk+3

Once that finished (its a huge install with a crazy number of sub dependencies) both pipx install camset and pip install camset --no-cache worked just fine. App seems to work great as well.

If you're open to it I can fork the repo and add some information for Brew users like myself to the docs and open a PR. Just let me know.

Thanks!!!!

camset_works

azeam commented 3 years ago

Great, glad you managed to get it working! :) And you are more than welcome to send a PR with Brew instructions, I have no experience with that, so it would be helpful!