Install mitmproxy

Hi,

i tried several times installing mitmproxy from pip3 install mitmproxy but always getting some errors

2021-01-11T09:17:31,016       running build_ext
2021-01-11T09:17:31,009     running build_ext
2021-01-11T09:17:31,149       building '_cffi_backend' extension
2021-01-11T09:17:31,136     building '_cffi_backend' extension
2021-01-11T09:17:31,165     creating build/temp.linux-mips-3.7
2021-01-11T09:17:31,179       creating build/temp.linux-mips-3.7
2021-01-11T09:17:31,205     creating build/temp.linux-mips-3.7/c
2021-01-11T09:17:31,216       creating build/temp.linux-mips-3.7/c
2021-01-11T09:17:31,238     gcc -Wno-unused-result -Wsign-compare -DNDEBUG -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mno-mips16 -mno-interlink-mips16 -iremap/builder/shared-workdir/build/sdk/build_dir/target-mips_24kc_musl/Python-3.7.9:Python-3.7.9 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mno-mips16 -mno-interlink-mips16 -iremap/builder/shared-workdir/build/sdk/build_dir/target-mips_24kc_musl/Python-3.7.9:Python-3.7.9 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DNDEBUG -fno-inline -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mno-mips16 -mno-interlink-mips16 -iremap/builder/shared-workdir/build/sdk/build_dir/target-mips_24kc_musl/Python-3.7.9:Python-3.7.9 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DNDEBUG -fno-inline -I/builder/shared-workdir/build/sdk/staging_dir/target-mips_24kc_musl/usr/include -I/builder/shared-workdir/build/sdk/staging_dir/target-mips_24kc_musl/include -I/builder/shared-workdir/build/sdk/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/usr/include -I/builder/shared-workdir/build/sdk/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/include/fortify -I/builder/shared-workdir/build/sdk/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/include -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.7 -c c/_cffi_backend.c -o build/temp.linux-mips-3.7/c/_cffi_backend.o
2021-01-11T09:17:31,254       gcc -Wno-unused-result -Wsign-compare -DNDEBUG -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mno-mips16 -mno-interlink-mips16 -iremap/builder/shared-workdir/build/sdk/build_dir/target-mips_24kc_musl/Python-3.7.9:Python-3.7.9 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mno-mips16 -mno-interlink-mips16 -iremap/builder/shared-workdir/build/sdk/build_dir/target-mips_24kc_musl/Python-3.7.9:Python-3.7.9 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DNDEBUG -fno-inline -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mno-mips16 -mno-interlink-mips16 -iremap/builder/shared-workdir/build/sdk/build_dir/target-mips_24kc_musl/Python-3.7.9:Python-3.7.9 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DNDEBUG -fno-inline -I/builder/shared-workdir/build/sdk/staging_dir/target-mips_24kc_musl/usr/include -I/builder/shared-workdir/build/sdk/staging_dir/target-mips_24kc_musl/include -I/builder/shared-workdir/build/sdk/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/usr/include -I/builder/shared-workdir/build/sdk/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/include/fortify -I/builder/shared-workdir/build/sdk/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/include -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.7 -c c/_cffi_backend.c -o build/temp.linux-mips-3.7/c/_cffi_backend.o
2021-01-11T09:17:39,116     c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
2021-01-11T09:17:39,232       c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
2021-01-11T09:17:39,332      #include <ffi.h>
2021-01-11T09:17:39,421        #include <ffi.h>
2021-01-11T09:17:39,472               ^~~~~~~
2021-01-11T09:17:39,489                 ^~~~~~~
2021-01-11T09:17:39,505     compilation terminated.
2021-01-11T09:17:39,541       compilation terminated.
2021-01-11T09:17:39,619       error: command 'gcc' failed with exit status 1
2021-01-11T09:17:39,606     error: command 'gcc' failed with exit status 1
2021-01-11T09:17:41,304     Running setup.py install for cffi: finished with status 'error'
2021-01-11T09:17:41,320       Running setup.py install for cffi: finished with status 'error'
2021-01-11T09:17:41,584   ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k6qkgmw7/cffi_0f358ef976aa45f5b6030ededb2c0f38/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k6qkgmw7/cffi_0f358ef976aa45f5b6030ededb2c0f38/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-g3ghekeq/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-iwtnpyjo/overlay --compile --install-headers /tmp/pip-build-env-iwtnpyjo/overlay/include/python3.7/cffi Check the logs for full command output.
2021-01-11T09:17:41,567 ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k6qkgmw7/cffi_0f358ef976aa45f5b6030ededb2c0f38/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k6qkgmw7/cffi_0f358ef976aa45f5b6030ededb2c0f38/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-g3ghekeq/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-iwtnpyjo/overlay --compile --install-headers /tmp/pip-build-env-iwtnpyjo/overlay/include/python3.7/cffi Check the logs for full command output.
2021-01-11T09:17:42,088   Exception information:
2021-01-11T09:17:41,603 Exception information:
2021-01-11T09:17:41,603 Traceback (most recent call last):
2021-01-11T09:17:41,603   File "/usr/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 854, in install
2021-01-11T09:17:41,603     req_description=str(self.req),
2021-01-11T09:17:41,603   File "/usr/lib/python3.7/site-packages/pip/_internal/operations/install/legacy.py", line 86, in install
2021-01-11T09:17:41,603     raise LegacyInstallFailure
2021-01-11T09:17:41,603 pip._internal.operations.install.legacy.LegacyInstallFailure
2021-01-11T09:17:41,603 
2021-01-11T09:17:41,603 During handling of the above exception, another exception occurred:
2021-01-11T09:17:41,603 
2021-01-11T09:17:41,603 Traceback (most recent call last):
2021-01-11T09:17:41,603   File "/usr/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 224, in _main
2021-01-11T09:17:41,603     status = self.run(options, args)
2021-01-11T09:17:41,603   File "/usr/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
2021-01-11T09:17:41,603     return func(self, options, args)
2021-01-11T09:17:41,603   File "/usr/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 403, in run
2021-01-11T09:17:41,603     pycompile=options.compile,
2021-01-11T09:17:41,603   File "/usr/lib/python3.7/site-packages/pip/_internal/req/__init__.py", line 90, in install_given_reqs
2021-01-11T09:17:41,603     pycompile=pycompile,
2021-01-11T09:17:41,603   File "/usr/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 858, in install
2021-01-11T09:17:41,603     six.reraise(*exc.parent)
2021-01-11T09:17:41,603   File "/usr/lib/python3.7/site-packages/pip/_vendor/six.py", line 703, in reraise
2021-01-11T09:17:41,603     raise value
2021-01-11T09:17:41,603   File "/usr/lib/python3.7/site-packages/pip/_internal/operations/install/legacy.py", line 76, in install
2021-01-11T09:17:41,603     cwd=unpacked_source_directory,
2021-01-11T09:17:41,603   File "/usr/lib/python3.7/site-packages/pip/_internal/utils/subprocess.py", line 275, in runner
2021-01-11T09:17:41,603     spinner=spinner,
2021-01-11T09:17:41,603   File "/usr/lib/python3.7/site-packages/pip/_internal/utils/subprocess.py", line 240, in call_subprocess
2021-01-11T09:17:41,603     raise InstallationError(exc_msg)
2021-01-11T09:17:41,603 pip._internal.exceptions.InstallationError: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k6qkgmw7/cffi_0f358ef976aa45f5b6030ededb2c0f38/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k6qkgmw7/cffi_0f358ef976aa45f5b6030ededb2c0f38/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-g3ghekeq/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-iwtnpyjo/overlay --compile --install-headers /tmp/pip-build-env-iwtnpyjo/overlay/include/python3.7/cffi Check the logs for full command output.
2021-01-11T09:17:42,105   Traceback (most recent call last):
2021-01-11T09:17:42,129     File "/usr/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 854, in install
2021-01-11T09:17:42,155       req_description=str(self.req),
2021-01-11T09:17:42,173     File "/usr/lib/python3.7/site-packages/pip/_internal/operations/install/legacy.py", line 86, in install
2021-01-11T09:17:42,195       raise LegacyInstallFailure
2021-01-11T09:17:42,216   pip._internal.operations.install.legacy.LegacyInstallFailure

2021-01-11T09:17:42,268   During handling of the above exception, another exception occurred:

2021-01-11T09:17:42,310   Traceback (most recent call last):
2021-01-11T09:17:42,493     File "/usr/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 224, in _main
2021-01-11T09:17:42,515       status = self.run(options, args)
2021-01-11T09:17:42,548     File "/usr/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
2021-01-11T09:17:42,587       return func(self, options, args)
2021-01-11T09:17:42,612     File "/usr/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 403, in run
2021-01-11T09:17:42,658       pycompile=options.compile,
2021-01-11T09:17:42,680     File "/usr/lib/python3.7/site-packages/pip/_internal/req/__init__.py", line 90, in install_given_reqs
2021-01-11T09:17:42,703       pycompile=pycompile,
2021-01-11T09:17:42,842     File "/usr/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 858, in install
2021-01-11T09:17:42,864       six.reraise(*exc.parent)
2021-01-11T09:17:42,897     File "/usr/lib/python3.7/site-packages/pip/_vendor/six.py", line 703, in reraise
2021-01-11T09:17:42,919       raise value
2021-01-11T09:17:42,950     File "/usr/lib/python3.7/site-packages/pip/_internal/operations/install/legacy.py", line 76, in install
2021-01-11T09:17:42,972       cwd=unpacked_source_directory,
2021-01-11T09:17:42,998     File "/usr/lib/python3.7/site-packages/pip/_internal/utils/subprocess.py", line 275, in runner
2021-01-11T09:17:43,015       spinner=spinner,
2021-01-11T09:17:43,037     File "/usr/lib/python3.7/site-packages/pip/_internal/utils/subprocess.py", line 240, in call_subprocess
2021-01-11T09:17:43,065       raise InstallationError(exc_msg)
2021-01-11T09:17:43,100   pip._internal.exceptions.InstallationError: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-k6qkgmw7/cffi_0f358ef976aa45f5b6030ededb2c0f38/setup.py'"'"'; __file__='"'"'/tmp/pip-install-k6qkgmw7/cffi_0f358ef976aa45f5b6030ededb2c0f38/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-g3ghekeq/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-iwtnpyjo/overlay --compile --install-headers /tmp/pip-build-env-iwtnpyjo/overlay/include/python3.7/cffi Check the logs for full command output.
2021-01-11T09:17:44,723 Removed build tracker: '/tmp/pip-req-tracker-g0_8gg1m'
2021-01-11T09:17:44,736   Removed build tracker: '/tmp/pip-req-tracker-g0_8gg1m'
2021-01-11T09:17:51,843 ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-iwtnpyjo/overlay --no-warn-script-location -v --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output.
2021-01-11T09:17:51,929 Exception information:
2021-01-11T09:17:51,929 Traceback (most recent call last):
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 224, in _main
2021-01-11T09:17:51,929     status = self.run(options, args)
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
2021-01-11T09:17:51,929     return func(self, options, args)
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 321, in run
2021-01-11T09:17:51,929     reqs, check_supported_wheels=not options.target_dir
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 122, in resolve
2021-01-11T09:17:51,929     requirements, max_rounds=try_to_avoid_resolution_too_deep,
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 445, in resolve
2021-01-11T09:17:51,929     state = resolution.resolve(requirements, max_rounds=max_rounds)
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 339, in resolve
2021-01-11T09:17:51,929     failure_causes = self._attempt_to_pin_criterion(name, criterion)
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 207, in _attempt_to_pin_criterion
2021-01-11T09:17:51,929     criteria = self._get_criteria_to_update(candidate)
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_vendor/resolvelib/resolvers.py", line 198, in _get_criteria_to_update
2021-01-11T09:17:51,929     for r in self._p.get_dependencies(candidate):
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/provider.py", line 172, in get_dependencies
2021-01-11T09:17:51,929     for r in candidate.iter_dependencies(with_requires)
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/provider.py", line 171, in <listcomp>
2021-01-11T09:17:51,929     r
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 257, in iter_dependencies
2021-01-11T09:17:51,929     requires = self.dist.requires() if with_requires else ()
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 239, in dist
2021-01-11T09:17:51,929     self._prepare()
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 226, in _prepare
2021-01-11T09:17:51,929     dist = self._prepare_distribution()
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 319, in _prepare_distribution
2021-01-11T09:17:51,929     self._ireq, parallel_builds=True,
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 480, in prepare_linked_requirement
2021-01-11T09:17:51,929     return self._prepare_linked_requirement(req, parallel_builds)
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 524, in _prepare_linked_requirement
2021-01-11T09:17:51,929     req, self.req_tracker, self.finder, self.build_isolation,
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 88, in _get_prepared_distribution
2021-01-11T09:17:51,929     abstract_dist.prepare_distribution_metadata(finder, build_isolation)
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/distributions/sdist.py", line 39, in prepare_distribution_metadata
2021-01-11T09:17:51,929     self._setup_isolation(finder)
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/distributions/sdist.py", line 69, in _setup_isolation
2021-01-11T09:17:51,929     "Installing build dependencies"
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/build_env.py", line 206, in install_requirements
2021-01-11T09:17:51,929     call_subprocess(args, spinner=spinner)
2021-01-11T09:17:51,929   File "/usr/lib/python3.7/site-packages/pip/_internal/utils/subprocess.py", line 240, in call_subprocess
2021-01-11T09:17:51,929     raise InstallationError(exc_msg)
2021-01-11T09:17:51,929 pip._internal.exceptions.InstallationError: Command errored out with exit status 1: /usr/bin/python3 /usr/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-iwtnpyjo/overlay --no-warn-script-location -v --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output.
2021-01-11T09:17:55,743 Removed cryptography<3.3,>=3.2 from https://files.pythonhosted.org/packages/94/5c/42de91c7fbdb817b2d9a4e64b067946eb38a4eb36c1a09c96c87a0f86a82/cryptography-3.2.1.tar.gz#sha256=d3d5e10be0cf2a12214ddee45c6bd203dab435e3d83b4560c03066eda600bfe3 (from mitmproxy) from build tracker '/tmp/pip-req-tracker-g0_8gg1m'
2021-01-11T09:17:55,780 Removed build tracker: '/tmp/pip-req-tracker-g0_8gg1m'

i already installed gcc, python3-dev but still errors.
how to solve it ?

ffi.h comes with libffi-dev(el), and if you need ffi.h, you probably going to need libffi too.

hi, frollic...
i already installed libffi, but opkg install libffi-dev there's no packages in openwrt.
how to install it ?

Are you trying to compile on OpenWrt?

not yet to try compiling openwrt..
i dont know how to compile it..
i think there're some missing packages that mitmproxy needs.

In most cases, you cannot compile directly on an OpenWrt device.

See: