pmneila / PyMaxflow

Python library for creating flow networks and computing the maxflow/mincut (aka graph-cuts for Python)
http://pmneila.github.io/PyMaxflow/
242 stars 59 forks source link

unable to install on Ubuntu 18.04.3 LTS using pip #46

Closed lognat0704 closed 4 years ago

lognat0704 commented 4 years ago

Hi pmneila,

My environment is Ubuntu18.04.3+ PyTorch 3.7. I cant figure out the error message and don't know what to do next. I did update my pip install to latest version, but still not working. Really appreciate your help.

Collecting pymaxflow
  Using cached PyMaxflow-1.2.12.tar.gz (122 kB)
Building wheels for collected packages: pymaxflow
  Building wheel for pymaxflow (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/hy/anaconda3/envs/graphcut/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lmrt_37y/pymaxflow/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lmrt_37y/pymaxflow/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-p37400k7
       cwd: /tmp/pip-install-lmrt_37y/pymaxflow/
  Complete output (18 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/maxflow
  copying maxflow/__init__.py -> build/lib.linux-x86_64-3.8/maxflow
  copying maxflow/fastmin.py -> build/lib.linux-x86_64-3.8/maxflow
  copying maxflow/version.py -> build/lib.linux-x86_64-3.8/maxflow
  running build_ext
  building 'maxflow._maxflow' extension
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/maxflow
  creating build/temp.linux-x86_64-3.8/maxflow/src
  creating build/temp.linux-x86_64-3.8/maxflow/src/core
  gcc -pthread -B /home/hy/anaconda3/envs/graphcut/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Imaxflow/src -I/tmp/pip-install-lmrt_37y/pymaxflow/.eggs/numpy-1.18.1-py3.8-linux-x86_64.egg/numpy/core/include -I/home/hy/anaconda3/envs/graphcut/include/python3.8 -c maxflow/src/_maxflow.cpp -o build/temp.linux-x86_64-3.8/maxflow/src/_maxflow.o
  gcc: error trying to exec 'cc1plus': execvp: No such file or directory
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pymaxflow
  Running setup.py clean for pymaxflow
Failed to build pymaxflow
Installing collected packages: pymaxflow
    Running setup.py install for pymaxflow ... error
    ERROR: Command errored out with exit status 1:
     command: /home/hy/anaconda3/envs/graphcut/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lmrt_37y/pymaxflow/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lmrt_37y/pymaxflow/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xpgkggtq/install-record.txt --single-version-externally-managed --compile --install-headers /home/hy/anaconda3/envs/graphcut/include/python3.8/pymaxflow
         cwd: /tmp/pip-install-lmrt_37y/pymaxflow/
    Complete output (18 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/maxflow
    copying maxflow/__init__.py -> build/lib.linux-x86_64-3.8/maxflow
    copying maxflow/fastmin.py -> build/lib.linux-x86_64-3.8/maxflow
    copying maxflow/version.py -> build/lib.linux-x86_64-3.8/maxflow
    running build_ext
    building 'maxflow._maxflow' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/maxflow
    creating build/temp.linux-x86_64-3.8/maxflow/src
    creating build/temp.linux-x86_64-3.8/maxflow/src/core
    gcc -pthread -B /home/hy/anaconda3/envs/graphcut/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Imaxflow/src -I/tmp/pip-install-lmrt_37y/pymaxflow/.eggs/numpy-1.18.1-py3.8-linux-x86_64.egg/numpy/core/include -I/home/hy/anaconda3/envs/graphcut/include/python3.8 -c maxflow/src/_maxflow.cpp -o build/temp.linux-x86_64-3.8/maxflow/src/_maxflow.o
    gcc: error trying to exec 'cc1plus': execvp: No such file or directory
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/hy/anaconda3/envs/graphcut/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lmrt_37y/pymaxflow/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lmrt_37y/pymaxflow/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-xpgkggtq/install-record.txt --single-version-externally-managed --compile --install-headers /home/hy/anaconda3/envs/graphcut/include/python3.8/pymaxflow Check the logs for full command output.
lognat0704 commented 4 years ago

Just solved the problem by installing GCC. https://www.osetc.com/en/how-to-install-build-essential-on-ubuntu-16-04-18-04-linux.html