Couldn't install pygraphviz - macos

I have troubles installing pygraphviz on macOS Mojave 10.14.1. The Python version I used is 3.6.7.
When executing the command pip install pygraphviz, I get the following lengthy error message:
Collecting pygraphviz
Using cached https://files.pythonhosted.org/packages/7e/b1/d6d849ddaf6f11036f9980d433f383d4c13d1ebcfc3cd09bc845bda7e433/pygraphviz-1.5.zip
Building wheels for collected packages: pygraphviz
Running setup.py bdist_wheel for pygraphviz ... error
Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-install-x_fr0oej/pygraphviz/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 /private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-wheel-qre51z9v --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.6
creating build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/release.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/version.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/graphviz.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/agraph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
creating build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_setup.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_unicode.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_readwrite.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_string.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_html.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_node_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_drawing.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_subgraph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_edge_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_clear.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_layout.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_graph.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
copying pygraphviz/tests/test_attributes.py -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz/tests
running egg_info
writing pygraphviz.egg-info/PKG-INFO
writing dependency_links to pygraphviz.egg-info/dependency_links.txt
writing top-level names to pygraphviz.egg-info/top_level.txt
reading manifest file 'pygraphviz.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.png' under directory 'doc'
warning: no files found matching '*.html' under directory 'doc'
warning: no files found matching '*.txt' under directory 'doc'
warning: no files found matching '*.css' under directory 'doc'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.svn' found anywhere in distribution
no previously-included directories found matching 'doc/build'
writing manifest file 'pygraphviz.egg-info/SOURCES.txt'
copying pygraphviz/graphviz.i -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
copying pygraphviz/graphviz_wrap.c -> build/lib.macosx-10.9-x86_64-3.6/pygraphviz
running build_ext
building 'pygraphviz._graphviz' extension
creating build/temp.macosx-10.9-x86_64-3.6
creating build/temp.macosx-10.9-x86_64-3.6/pygraphviz
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.9-x86_64-3.6/pygraphviz/graphviz_wrap.o
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pygraphviz
Running setup.py clean for pygraphviz
Failed to build pygraphviz
Installing collected packages: pygraphviz
Running setup.py install for pygraphviz ... error
Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-install-x_fr0oej/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-record-kukz1ofd/install-record.txt --single-version-externally-managed --compile:
running install
Trying dpkg
Failed to find dpkg
Trying pkg-config
Failed to find pkg-config
Trying dotneato-config
Failed to find dotneato-config
Failed to find dotneato-config
Your Graphviz installation could not be found.
1) You don't have Graphviz installed:
Install Graphviz (http://graphviz.org)
2) Your Graphviz package might incomplete.
Install the binary development subpackage (e.g. libgraphviz-dev or similar.)
3) You are using Windows
There are no PyGraphviz binary packages for Windows but you might be
able to build it from this source. See
http://networkx.lanl.gov/pygraphviz/reference/faq.html
If you think your installation is correct you will need to manually
provide path to graphviz include and library. For example:
pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"
The current setting of library_dirs and include_dirs is:
library_dirs=None
include_dirs=None
error: Error locating graphviz.
----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-install-x_fr0oej/pygraphviz/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-record-kukz1ofd/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/rn/zr6qnswn7wb886b6twbfgjym0000gn/T/pip-install-x_fr0oej/pygraphviz/
Can anyone give me help? Thanks!
I applied the suggestion of #hoefling: xcode-select --install, and then try pip3 install pygraphviz. An error is still existing like the following pictures:

The question has been done by using this command:
pip install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--library-path=/usr/lib/graphviz/"

On Apple M1:
pip install --global-option=build_ext --global-option="-I/opt/homebrew/include/graphviz" --global-option="-L/opt/homebrew/Cellar/graphviz/2.46.1/lib/" pygraphviz

Related

can't install pycocotools "Cannot open include file: 'math.h': No such file or directory" [duplicate]

I'm trying to use object detection models from Tensorflow and need to get pycocotools installed. I'm doing this from a python (3) virtual environment on a Windows 10 machine. There seems to be some known issues around getting this working on Windows, and I'm pretty sure I've tried them all.
I've tried pip-installing pycocotools, with this error (fails building wheel):
(env) PS C:\Users\la01043601\ML_CameraVision\humanDetection> pip install pycocotools
Collecting pycocotools
Using cached pycocotools-2.0.2.tar.gz (23 kB)
Requirement already satisfied: setuptools>=18.0 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from pycocotools) (56.0.0)
Requirement already satisfied: cython>=0.27.3 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from pycocotools) (0.29.23)
Requirement already satisfied: matplotlib>=2.1.0 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from pycocotools) (3.4.2)
Requirement already satisfied: pyparsing>=2.2.1 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (2.4.7)
Requirement already satisfied: cycler>=0.10 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (0.10.0)
Requirement already satisfied: pillow>=6.2.0 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (8.2.0)
Requirement already satisfied: numpy>=1.16 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (1.19.5)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (1.3.1)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from matplotlib>=2.1.0->pycocotools) (2.8.1)
Requirement already satisfied: six in c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages (from cycler>=0.10->matplotlib>=2.1.0->pycocotools) (1.15.0)
Building wheels for collected packages: pycocotools
Building wheel for pycocotools (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-install-hjka7e0k\\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\\setup.py'"'"'; __file__='"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-install-hjka7e0k\\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\la01043601\AppData\Local\Temp\pip-wheel-i_wesduj'
cwd: C:\Users\la01043601\AppData\Local\Temp\pip-install-hjka7e0k\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\
Complete output (23 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.9\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.9\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.9\pycocotools
copying pycocotools\__init__.py -> build\lib.win-amd64-3.9\pycocotools
running build_ext
cythoning pycocotools/_mask.pyx to pycocotools\_mask.c
c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\la01043601\AppData\Local\Temp\pip-install-hjka7e0k\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\pycocotools\_mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'pycocotools._mask' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\common
creating build\temp.win-amd64-3.9\Release\pycocotools
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\numpy\core\include -I./common -Ic:\users\la01043601\ml_cameravision\humandetection\env\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include /Tc./common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\./common/maskApi.obj
maskApi.c
./common/maskApi.c(8): fatal error C1083: Cannot open include file: 'math.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for pycocotools
Running setup.py clean for pycocotools
Failed to build pycocotools
Installing collected packages: pycocotools
Running setup.py install for pycocotools ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-install-hjka7e0k\\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\\setup.py'"'"'; __file__='"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-install-hjka7e0k\\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\la01043601\AppData\Local\Temp\pip-record-crzypf9k\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\la01043601\ml_cameravision\humandetection\env\include\site\python3.9\pycocotools'
cwd: C:\Users\la01043601\AppData\Local\Temp\pip-install-hjka7e0k\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\
Complete output (21 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.9\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.9\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.9\pycocotools
copying pycocotools\__init__.py -> build\lib.win-amd64-3.9\pycocotools
running build_ext
skipping 'pycocotools\_mask.c' Cython extension (up-to-date)
building 'pycocotools._mask' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\common
creating build\temp.win-amd64-3.9\Release\pycocotools
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\numpy\core\include -I./common -Ic:\users\la01043601\ml_cameravision\humandetection\env\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include /Tc./common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\./common/maskApi.obj
maskApi.c
./common/maskApi.c(8): fatal error C1083: Cannot open include file: 'math.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-install-hjka7e0k\\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\\setup.py'"'"'; __file__='"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-install-hjka7e0k\\pycocotools_91d3c7ee2ad946f292455cc0fc685c5f\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\la01043601\AppData\Local\Temp\pip-record-crzypf9k\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\la01043601\ml_cameravision\humandetection\env\include\site\python3.9\pycocotools' Check the logs for full command output.
I've tried the fix from Phil Ferriere's repository (still fails building wheel, something with math.h file not found):
(env) PS C:\Users\la01043601\ML_CameraVision\humanDetection> pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Collecting git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Cloning https://github.com/philferriere/cocoapi.git to c:\users\la01043601\appdata\local\temp\pip-req-build-htao1r08
Running command git clone -q https://github.com/philferriere/cocoapi.git 'C:\Users\la01043601\AppData\Local\Temp\pip-req-build-htao1r08'
Building wheels for collected packages: pycocotools
Building wheel for pycocotools (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'"'"'; __file__='"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\la01043601\AppData\Local\Temp\pip-wheel-kktx8s70'
cwd: C:\Users\la01043601\AppData\Local\Temp\pip-req-build-htao1r08\PythonAPI
Complete output (20 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.9\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.9\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.9\pycocotools
copying pycocotools\__init__.py -> build\lib.win-amd64-3.9\pycocotools
running build_ext
building 'pycocotools._mask' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\common
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\pycocotools
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\numpy\core\include -I../common -Ic:\users\la01043601\ml_cameravision\humandetection\env\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\../common/maskApi.obj
maskApi.c
../common/maskApi.c(8): fatal error C1083: Cannot open include file: 'math.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for pycocotools
Running setup.py clean for pycocotools
ERROR: Command errored out with exit status 1:
command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'"'"'; __file__='"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
cwd: C:\Users\la01043601\AppData\Local\Temp\pip-req-build-htao1r08
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\la01043601\AppData\Local\Temp\pip-req-build-htao1r08\PythonAPI\setup.py", line 25, in <module>
cythonize(ext_modules)
File "c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Build\Dependencies.py", line 965, in cythonize
module_list, module_metadata = create_extension_list(
File "c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Build\Dependencies.py", line 815, in create_extension_list
for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
File "c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Build\Dependencies.py", line 114, in nonempty
raise ValueError(error_msg)
ValueError: 'pycocotools/_mask.pyx' doesn't match any files
----------------------------------------
ERROR: Failed cleaning build dir for pycocotools
Failed to build pycocotools
Installing collected packages: pycocotools
Running setup.py install for pycocotools ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'"'"'; __file__='"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\la01043601\AppData\Local\Temp\pip-record-ok0x1q7g\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\la01043601\ml_cameravision\humandetection\env\include\site\python3.9\pycocotools'
cwd: C:\Users\la01043601\AppData\Local\Temp\pip-req-build-htao1r08\PythonAPI
Complete output (9 lines):
running install
running build
running build_py
running build_ext
building 'pycocotools._mask' extension
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\numpy\core\include -I../common -Ic:\users\la01043601\ml_cameravision\humandetection\env\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\../common/maskApi.obj
maskApi.c
../common/maskApi.c(8): fatal error C1083: Cannot open include file: 'math.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'"'"'; __file__='"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-htao1r08\\PythonAPI\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\la01043601\AppData\Local\Temp\pip-record-ok0x1q7g\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\la01043601\ml_cameravision\humandetection\env\include\site\python3.9\pycocotools' Check the logs for full command output.
I've tried installing Visual C++ Build Tools (2015 version recommended by many other answers), but got the error that it was unable to find/download setup package, so I've made sure I have updates to the 2019 build tools, and they are added to my path.
Error I was getting is like this one. I also followed the video at the bottom of that solution and it didn't help.
I've tried using the suggested windows install for pycocotools (pycocotools-windows), which gives the following error:
(env) PS C:\Users\la01043601\ML_CameraVision\humanDetection> pip install cocoapi-windows
ERROR: Could not find a version that satisfies the requirement cocoapi-windows (from versions: none)
ERROR: No matching distribution found for cocoapi-windows
(env) PS C:\Users\la01043601\ML_CameraVision\humanDetection> pip install pycocotools-windows
ERROR: Could not find a version that satisfies the requirement pycocotools-windows (from versions: none)
ERROR: No matching distribution found for pycocotools-windows
Python and pip are on my Windows path. I gave up on one tutorial due to this, just to find the next one has a pycocotools dependency too.
(Also accepting suggestions for Tensorflow object detection tutorials that do not use pycocotools! Need a decent tutorial because I'm a beginner).
Edit: Have now also tried running the setup.py file the following way, still having issues with not finding a math.h file...
(env) PS C:\Users\la01043601\ML_CameraVision\humanDetection\sandbox\cocoapi\PythonAPI> python setup.py build_ext --inplace
Compiling pycocotools/_mask.pyx because it changed.
[1/1] Cythonizing pycocotools/_mask.pyx
C:\Users\la01043601\ML_CameraVision\humanDetection\env\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\la01043601\ML_CameraVision\humanDetection\sandbox\cocoapi\PythonAPI\pycocotools\_mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
running build_ext
building 'pycocotools._mask' extension
creating build
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\common
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\pycocotools
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\la01043601\ML_CameraVision\humanDetection\env\lib\site-packages\numpy\core\include -I../common -IC:\Users\la01043601\ML_CameraVision\humanDetection\env\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\../common/maskApi.obj
maskApi.c
../common/maskApi.c(8): fatal error C1083: Cannot open include file: 'math.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
Edit edit I forgot to mention that in the past couple days I also tried troubleshooting the math.h error, which suggests switching an include statement from "math.h" to "cmath", and using "quotes" instead of angle brackets, and since this happens when installing from a downloaded repo I even forked the repo the made the change on my version to download from there. Error as follows (now related to a missing 'crtdbg.h' file and I don't understand how everything works under the hood in Build Tools):
(env) PS C:\Users\la01043601\ML_CameraVision\humanDetection> pip install git+https://github.com/Broccoli-Hunter/cocoapi.git#subdirectory=PythonAPI
Collecting git+https://github.com/Broccoli-Hunter/cocoapi.git#subdirectory=PythonAPI
Cloning https://github.com/Broccoli-Hunter/cocoapi.git to c:\users\la01043601\appdata\local\temp\pip-req-build-atepfcnd
Running command git clone -q https://github.com/Broccoli-Hunter/cocoapi.git 'C:\Users\la01043601\AppData\Local\Temp\pip-req-build-atepfcnd'
Building wheels for collected packages: pycocotools
Building wheel for pycocotools (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-atepfcnd\\PythonAPI\\setup.py'"'"'; __file__='"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-atepfcnd\\PythonAPI\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\la01043601\AppData\Local\Temp\pip-wheel-4bje9txk'
cwd: C:\Users\la01043601\AppData\Local\Temp\pip-req-build-atepfcnd\PythonAPI
Complete output (20 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.9\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.9\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.9\pycocotools
copying pycocotools\__init__.py -> build\lib.win-amd64-3.9\pycocotools
running build_ext
building 'pycocotools._mask' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\common
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\pycocotools
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\numpy\core\include -I../common -Ic:\users\la01043601\ml_cameravision\humandetection\env\include -IC:\Python39\include -IC:\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include /Tc../common/maskApi.c /Fobuild\temp.win-amd64-3.9\Release\../common/maskApi.obj
maskApi.c
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30037\include\yvals.h(12): fatal error C1083: Cannot open include file: 'crtdbg.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for pycocotools
Running setup.py clean for pycocotools
ERROR: Command errored out with exit status 1:
command: 'c:\users\la01043601\ml_cameravision\humandetection\env\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-atepfcnd\\PythonAPI\\setup.py'"'"'; __file__='"'"'C:\\Users\\la01043601\\AppData\\Local\\Temp\\pip-req-build-atepfcnd\\PythonAPI\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
cwd: C:\Users\la01043601\AppData\Local\Temp\pip-req-build-atepfcnd
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\la01043601\AppData\Local\Temp\pip-req-build-atepfcnd\PythonAPI\setup.py", line 25, in <module>
cythonize(ext_modules)
File "c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Build\Dependencies.py", line 965, in cythonize
module_list, module_metadata = create_extension_list(
File "c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Build\Dependencies.py", line 815, in create_extension_list
for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't match any files" % filepattern):
File "c:\users\la01043601\ml_cameravision\humandetection\env\lib\site-packages\Cython\Build\Dependencies.py", line 114, in nonempty
raise ValueError(error_msg)
ValueError: 'pycocotools/_mask.pyx' doesn't match any files
----------------------------------------
ERROR: Failed cleaning build dir for pycocotools
Failed to build pycocotools
I managed to install pycocotools only after downloading the installer from this link and installing these:
me too! I ran "pip install pycocotools" on Linux, same error like this:
running build_ext
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/common
creating build/temp.linux-x86_64-3.7/pycocotools
gcc -pthread -B /home/ppp/anaconda3/envs/openmmlab/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-env-qzv5sdb4/overlay/lib/python3.7/site-packages/numpy/core/include -I./common -I/home/ppp/anaconda3/envs/openmmlab/include/python3.7m -c ./common/maskApi.c -o build/temp.linux-x86_64-3.7/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
./common/maskApi.c:8:18: fatal error: math.h: No such file or directory
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
----------------------------------------
ERROR: Failed building wheel for pycocotools
Failed to build pycocotools
ERROR: Could not build wheels for pycocotools which use PEP 517 and cannot be installed directly
I solved the problem by conda install pycocotools -c conda-forge
ps: python version==3.7.12
after everything failed, I installed visual c++ build tools using the link below
Visit https://myvs.download.prss.microsoft.com/db/mu_visual_cpp_build_tools_2015_update_3_x64_dvd_dfd9a39c.iso?t=36429cde-dc63-4657-8114-1c74ae0da9bf&e=1645739068&h=e153f9afa2fa5fd4ffae5a1cc714a2ab704115af952dfb82e1761e5553c7999a&su=1
after it has downloaded open it and run the setup file, everything should run smoothly.
Then in your environment run this code:-
pip install cython
then this one:
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
that should work, I am using TensorFlow version 2.3, Python 3.8
You may need to install:
sudo apt install python3.9-dev
Place another python version if you need 3.8 etc.
Then pycocotools is installed correctly, helped in my case when "Python.h" was not found.
Don't Forget to Restart your pc after install visual c++ build tools, in my case everything not working until I restart my PC after installing the build tools.

Pip error installing cryptography on Big Sur

Using pip version 20.2.4, Python 3.8.2 and Big Sur 11.0.1.
When I run pip install cryptography, I get this error:
Building wheels for collected packages: cffi
Building wheel for cffi (setup.py): started
Building wheel for cffi (setup.py): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /Users/xxx/projects/xxx/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/g8/nj6ghjhgj11j84rsjmqqb00000gn/T/pip-install-aufpkz3c/cffi/setup.py'"'"'; __file__='"'"'/private/var/folders/g8/nj6ghjhgj11j84rsjmqqb00000gn/T/pip-install-aufpkz3c/cffi/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 /private/var/folders/g8/nj6ghjhgj11j84rsjmqqb00000gn/T/pip-wheel-asotxqfl
cwd: /private/var/folders/g8/nj6ghjhgj11j84rsjmqqb00000gn/T/pip-install-aufpkz3c/cffi/
Complete output (42 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.14.6-x86_64-3.8
creating build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/backend_ctypes.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/error.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/setuptools_ext.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/cffi_opcode.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/vengine_gen.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/pkgconfig.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/model.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/ffiplatform.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/api.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/vengine_cpy.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/commontypes.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/lock.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/recompiler.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/cparser.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/verifier.py -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/_cffi_include.h -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/parse_c_type.h -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/_embedding.h -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
copying cffi/_cffi_errors.h -> build/lib.macosx-10.14.6-x86_64-3.8/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.macosx-10.14.6-x86_64-3.8
creating build/temp.macosx-10.14.6-x86_64-3.8/c
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/local/Cellar/libffi/3.3/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi -I/Users/xxxx/projects/xxxx/venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c c/_cffi_backend.c -o build/temp.macosx-10.14.6-x86_64-3.8/c/_cffi_backend.o
c/_cffi_backend.c:5854:2: error: Apple Arm64 ABI requires ffi_prep_cif_var
#error Apple Arm64 ABI requires ffi_prep_cif_var
^
c/_cffi_backend.c:6304:9: warning: 'ffi_prep_closure' is deprecated [-Wdeprecated-declarations]
if (ffi_prep_closure(closure, &cif_descr->cif,
^
/usr/local/Cellar/libffi/3.3/include/ffi.h:341:18: note: 'ffi_prep_closure' has been explicitly marked deprecated here
__attribute__((deprecated))
^
1 warning and 1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for cffi
I didn't ever encounter this before I upgraded MacOS. Any idea what I can try?
First install openssl
brew install openssl
Then export compiler options:
export CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS="1"
export LDFLAGS="-L/usr/local/opt/openssl#1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl#1.1/include"
and now you can use pip install
pip3 install cryptography==2.8
env LDFLAGS="-L$(brew --prefix openssl#1.1)/lib" CFLAGS="-I$(brew --prefix openssl#1.1)/include" pip install cryptography
The answer from #serge-g above worked well on M1 Mac / ARM64 with Homebrew and Big Sur 11.6.
I had to make the following changes:
brew install openssl
export CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS="1"
export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include"
At that point installing cryptography worked for me via
pip3 install cryptography==2.8
FYI, in my case cryptography was a dependency of the Azure CLI Python package (pip3 install azure-cli). Thanks to #serge-g for pointing me in the right direction!
According to this issue on cryptography's GitHub, as of November 2020, simply upgrading pip to the latest version allows this to work correctly. I was running into this error myself on pip 19 and upgrading to pip 21.0.1 fixed the issue for me.
You should try poetry shell and pip install cryptography

Install python package on Synology DiskStation

tldr: Cannot install python-docx and lxml on my Synology DiskStation via pip3 or python 3 -m pip install.
Long version:
I already had some problem installing pip3 and django, but I got it working. Now I wanted to create doc files within django. So, python-docx was recommended. However I cannot just say "pip3 install python-docx".
[Here I have erased the old output, because it was not valid anymore.]
I do not know what to do next. I also tried to install libxml2:
python3 -m pip install libxml2
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement libxml2 (from versions: none)
ERROR: No matching distribution found for libxml2
I googled, but many sites just recommend how to install certain dev packages on debian, which is not helping me.
Can you please tell me how to proceed?
Edit
After reading for hours and trying different things, including an install of entware, I have now a slightly different output.
python3 -m pip install python-docx
Defaulting to user installation because normal site-packages is not writeable
Processing /volume1/homes/admin/.cache/pip/wheels/5c/b3/f7/0b2150abcd02387566859213e86c490e38070d0aad388c1105/python_docx-0.8.10-py3-none-any.whl
Collecting lxml>=2.3.2
Using cached lxml-4.5.0.tar.gz (4.5 MB)
Building wheels for collected packages: lxml
Building wheel for lxml (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9_1bbtke/lxml/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-h4ugg_2s
cwd: /tmp/pip-install-9_1bbtke/lxml/
Complete output (91 lines):
Building lxml version 4.5.0.
Building without Cython.
ERROR: b'/bin/sh: xslt-config: command not found\n'
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.5
creating build/lib.linux-armv7l-3.5/lxml
copying src/lxml/doctestcompare.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/pyclasslookup.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/cssselect.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/__init__.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/ElementInclude.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/builder.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/_elementpath.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/sax.py -> build/lib.linux-armv7l-3.5/lxml
creating build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/__init__.py -> build/lib.linux-armv7l-3.5/lxml/includes
creating build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/defs.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/formfill.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/_diffcommand.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/_html5builder.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/soupparser.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/clean.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/_setmixin.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/__init__.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/builder.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/html5parser.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/ElementSoup.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/diff.py -> build/lib.linux-armv7l-3.5/lxml/html
creating build/lib.linux-armv7l-3.5/lxml/isoschematron
copying src/lxml/isoschematron/__init__.py -> build/lib.linux-armv7l-3.5/lxml/isoschematron
copying src/lxml/etree.h -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/etree_api.h -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/lxml.etree.h -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/lxml.etree_api.h -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/includes/schematron.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/c14n.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/relaxng.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xpath.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/tree.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xslt.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/uri.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/__init__.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/config.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xinclude.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/lxml-version.h -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/etree_defs.h -> build/lib.linux-armv7l-3.5/lxml/includes
creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources
creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
creating build/temp.linux-armv7l-3.5
creating build/temp.linux-armv7l-3.5/src
creating build/temp.linux-armv7l-3.5/src/lxml
/opt/bin/gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DSYNO_FIX_FLAG_BUG -DOPENSSL_NO_SSL3 -DOPENSSL_NO_SSL2 -mhard-float -mfpu=vfpv3-d16 -march=armv7-a -mcpu=marvell-pj4 -mtune=marvell-pj4 -DSYNOPLAT_F_ARMV7 -O2 -fno-diagnostics-show-caret -Wno-unused-local-typedefs -include /usr/syno/include/platformconfig.h -DSYNO_ENVIRONMENT -DBUILD_ARCH=32 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -g -DSDK_VER_MIN_REQUIRED=600 -pipe -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc/lxml/includes -I/volume1/#appstore/py3k/usr/local/include/python3.5m -c src/lxml/etree.c -o build/temp.linux-armv7l-3.5/src/lxml/etree.o -w
gcc: error trying to exec 'as': execvp: No such file or directory
cc1: fatal error: /usr/syno/include/platformconfig.h: No such file or directory
compilation terminated.
Compile failed: command '/opt/bin/gcc' failed with exit status 1
creating tmp
cc -I/usr/include/libxml2 -c /tmp/xmlXPathInit_wqm9l9k.c -o tmp/xmlXPathInit_wqm9l9k.o
unable to execute 'cc': No such file or directory
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command '/opt/bin/gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for lxml
Running setup.py clean for lxml
Failed to build lxml
Installing collected packages: lxml, python-docx
Running setup.py install for lxml ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9_1bbtke/lxml/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-_uhfue_j/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /var/services/homes/admin/.local/include/python3.5m/lxml
cwd: /tmp/pip-install-9_1bbtke/lxml/
Complete output (90 lines):
Building lxml version 4.5.0.
Building without Cython.
ERROR: b'/bin/sh: xslt-config: command not found\n'
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
running install
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.5
creating build/lib.linux-armv7l-3.5/lxml
copying src/lxml/doctestcompare.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/pyclasslookup.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/cssselect.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/__init__.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/ElementInclude.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/builder.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/_elementpath.py -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/sax.py -> build/lib.linux-armv7l-3.5/lxml
creating build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/__init__.py -> build/lib.linux-armv7l-3.5/lxml/includes
creating build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/defs.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/formfill.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/_diffcommand.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/_html5builder.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/soupparser.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/clean.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/_setmixin.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/usedoctest.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/__init__.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/builder.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/html5parser.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/ElementSoup.py -> build/lib.linux-armv7l-3.5/lxml/html
copying src/lxml/html/diff.py -> build/lib.linux-armv7l-3.5/lxml/html
creating build/lib.linux-armv7l-3.5/lxml/isoschematron
copying src/lxml/isoschematron/__init__.py -> build/lib.linux-armv7l-3.5/lxml/isoschematron
copying src/lxml/etree.h -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/etree_api.h -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/lxml.etree.h -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/lxml.etree_api.h -> build/lib.linux-armv7l-3.5/lxml
copying src/lxml/includes/schematron.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/c14n.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/relaxng.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xpath.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/dtdvalid.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/tree.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xslt.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/uri.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xmlschema.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/__init__.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/config.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/htmlparser.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xmlerror.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/xinclude.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/etreepublic.pxd -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/lxml-version.h -> build/lib.linux-armv7l-3.5/lxml/includes
copying src/lxml/includes/etree_defs.h -> build/lib.linux-armv7l-3.5/lxml/includes
creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources
creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/rng
creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl
creating build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.linux-armv7l-3.5/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
creating build/temp.linux-armv7l-3.5
creating build/temp.linux-armv7l-3.5/src
creating build/temp.linux-armv7l-3.5/src/lxml
/opt/bin/gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DSYNO_FIX_FLAG_BUG -DOPENSSL_NO_SSL3 -DOPENSSL_NO_SSL2 -mhard-float -mfpu=vfpv3-d16 -march=armv7-a -mcpu=marvell-pj4 -mtune=marvell-pj4 -DSYNOPLAT_F_ARMV7 -O2 -fno-diagnostics-show-caret -Wno-unused-local-typedefs -include /usr/syno/include/platformconfig.h -DSYNO_ENVIRONMENT -DBUILD_ARCH=32 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -g -DSDK_VER_MIN_REQUIRED=600 -pipe -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc/lxml/includes -I/volume1/#appstore/py3k/usr/local/include/python3.5m -c src/lxml/etree.c -o build/temp.linux-armv7l-3.5/src/lxml/etree.o -w
gcc: error trying to exec 'as': execvp: No such file or directory
cc1: fatal error: /usr/syno/include/platformconfig.h: No such file or directory
compilation terminated.
Compile failed: command '/opt/bin/gcc' failed with exit status 1
cc -I/usr/include/libxml2 -c /tmp/xmlXPathInit31sc0ump.c -o tmp/xmlXPathInit31sc0ump.o
unable to execute 'cc': No such file or directory
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command '/opt/bin/gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9_1bbtke/lxml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9_1bbtke/lxml/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-_uhfue_j/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /var/services/homes/admin/.local/include/python3.5m/lxml Check the logs for full command output.
If I see this correct, there is something wrong about something called "CC". But I still do not know what to do.
I may have found a solution. But I still have to test it. In the meantime you do not have to answer.
Via opkg I could install some of the packages and I also got a new install of python3. Somewhat confusing for me. So now I have a 2.7 that I never wanted from Synology and a 3.5 from the Synology package center and obviously a newer one from opkg.
However, I could install some packages, but others not. For example, I tried to install reportlab as a way to produce PDFs if python-docx would not run. But I could not install reportlab either, because it seems to miss something like libjpeg-dev or so. And I could also not find this in the opkg repo. However, suddenly python-docx could be installed and I am working with that now.
I am sorry that I cannot provide a better description for others who might have the same problem, but at least I tried to make my steps comprehensible.
Best regards

Unable to compile lxml using pip and NetBSD

I'm running NetBSD 7.1 and I'm trying to install Python's lxml package, using pip.
However I get this compilation error:
# pip install lxml
Collecting lxml
Using cached lxml-3.8.0.tar.gz
Installing collected packages: lxml
Running setup.py install for lxml ... error
Complete output from command /usr/pkg/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Xb5RT3/lxml/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-N6HUOc-record/install-record.txt --single-version-externally-managed --compile:
Building lxml version 3.8.0.
Building without Cython.
Using build configuration of libxslt 1.1.29
Building against libxml2/libxslt in one of the following directories:
/usr/pkg/lib
/usr/lib
running install
running build
running build_py
creating build
creating build/lib.netbsd-7.1-amd64-2.7
creating build/lib.netbsd-7.1-amd64-2.7/lxml
copying src/lxml/sax.py -> build/lib.netbsd-7.1-amd64-2.7/lxml
copying src/lxml/_elementpath.py -> build/lib.netbsd-7.1-amd64-2.7/lxml
copying src/lxml/builder.py -> build/lib.netbsd-7.1-amd64-2.7/lxml
copying src/lxml/ElementInclude.py -> build/lib.netbsd-7.1-amd64-2.7/lxml
copying src/lxml/__init__.py -> build/lib.netbsd-7.1-amd64-2.7/lxml
copying src/lxml/usedoctest.py -> build/lib.netbsd-7.1-amd64-2.7/lxml
copying src/lxml/cssselect.py -> build/lib.netbsd-7.1-amd64-2.7/lxml
copying src/lxml/pyclasslookup.py -> build/lib.netbsd-7.1-amd64-2.7/lxml
copying src/lxml/doctestcompare.py -> build/lib.netbsd-7.1-amd64-2.7/lxml
creating build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/__init__.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
creating build/lib.netbsd-7.1-amd64-2.7/lxml/html
copying src/lxml/html/diff.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/html
copying src/lxml/html/ElementSoup.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/html
copying src/lxml/html/html5parser.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/html
copying src/lxml/html/builder.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/html
copying src/lxml/html/__init__.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/html
copying src/lxml/html/usedoctest.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/html
copying src/lxml/html/_setmixin.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/html
copying src/lxml/html/clean.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/html
copying src/lxml/html/soupparser.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/html
copying src/lxml/html/_html5builder.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/html
copying src/lxml/html/_diffcommand.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/html
copying src/lxml/html/formfill.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/html
copying src/lxml/html/defs.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/html
creating build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron
copying src/lxml/isoschematron/__init__.py -> build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron
copying src/lxml/lxml.etree.h -> build/lib.netbsd-7.1-amd64-2.7/lxml
copying src/lxml/lxml.etree_api.h -> build/lib.netbsd-7.1-amd64-2.7/lxml
copying src/lxml/includes/etreepublic.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/xinclude.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/xmlerror.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/htmlparser.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/config.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/xmlschema.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/uri.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/xslt.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/tree.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/xmlparser.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/dtdvalid.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/xpath.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/relaxng.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/c14n.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/schematron.pxd -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/etree_defs.h -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
copying src/lxml/includes/lxml-version.h -> build/lib.netbsd-7.1-amd64-2.7/lxml/includes
creating build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron/resources
creating build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron/resources/rng
copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron/resources/rng
creating build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron/resources/xsl
copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron/resources/xsl
creating build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.netbsd-7.1-amd64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
running build_ext
building 'lxml.etree' extension
creating build/temp.netbsd-7.1-amd64-2.7
creating build/temp.netbsd-7.1-amd64-2.7/src
creating build/temp.netbsd-7.1-amd64-2.7/src/lxml
gcc -fno-strict-aliasing -O2 -pthread -I/usr/include -I/usr/pkg/include -DNDEBUG -O2 -pthread -I/usr/include -I/usr/pkg/include -fPIC -I/usr/pkg/include -I/usr/pkg/include/libxml2 -I/usr/include -Isrc/lxml/includes -I/usr/pkg/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.netbsd-7.1-amd64-2.7/src/lxml/lxml.etree.o -w
In file included from /usr/pkg/include/libxml2/limits.h:168:0,
from /usr/pkg/include/libxml2/syslimits.h:7,
from /usr/pkg/include/libxml2/limits.h:34,
from /usr/pkg/include/python2.7/Python.h:19,
from src/lxml/lxml.etree.c:84:
/usr/pkg/gcc5/lib/gcc/x86_64--netbsd/5.4.0/include-fixed/limits.h:168:61: fatal error: limits.h: No such file or directory
compilation terminated.
Compile failed: command 'gcc' failed with exit status 1
creating tmp
cc -I/usr/pkg/include -I/usr/pkg/include/libxml2 -I/usr/include -I/usr/include/libxml2 -c /tmp/xmlXPathInit_nXifU.c -o tmp/xmlXPathInit_nXifU.o
unable to execute 'cc': No such file or directory
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/pkg/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Xb5RT3/lxml/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-N6HUOc-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-Xb5RT3/lxml/
I'm on a clean NetBSD 7.1 minimal installation, but have added the following using pkgsrc:
# pkg_info
xmlcatmgr-2.2nb1 XML and SGML catalog manager
libxml2-2.9.4nb3 XML parser library from the GNOME project
libgpg-error-1.27 Definitions of common error values for all GnuPG components
libgcrypt-1.7.6 GNU cryptographic library
libxslt-1.1.29nb2 XSLT parser library from the GNOME project
mozilla-rootcerts-1.0.20170121nb5 Root CA certificates from the Mozilla Project
libffi-3.2.1nb2 Foreign function interface
python27-2.7.13nb1 Interpreted, interactive, object-oriented programming language
py27-expat-2.7.13 Python interface to expat
py27-appdirs-1.4.0 Module for determining appropriate, platform-specific dirs
py27-pyparsing-2.1.10 Pyparsing module for Python
py27-six-1.10.0 Python 2 and 3 compatibility utilities
py27-packaging-16.8 Core utilities for Python packages
py27-setuptools-34.3.2 New Python packaging system
py27-pip-9.0.1 Installs Python packages as an easy_install replacement
libxml-1.8.17nb4 XML parser (version 1), mainly used by the GNOME project
py27-libxml2-2.9.4nb2 Python wrapper for libxml2
py27-libxslt-1.1.29 Python wrapper for libxslt
gccmakedep-1.0.3 Create dependencies in Makefiles using gcc
gcc5-5.4.0nb2 The GNU Compiler Collection (GCC) - 5 Release Series
boost-headers-1.63.0 Free, peer-reviewed portable C++ source libraries (build-time headers)
compat_headers-0.2 Compatibility headers
This was due to the compiler set not being installed, as it's not part of the "minimal installation" package.
To keep things at minimum, one can choose "Custom installation" option instead and set Compiler Tools to "Yes".
Another way is to download and install the comp.tgz manually:
# cd /
# ftp ftp://ftp.netbsd.org (as an anonymous user)
> cd pub/NetBSD/NetBSD-7.1/amd64/binary/sets
> get comp.tgz
> exit
# tar --unlink -zxvpf comp.tgz
More details available on NetBSD's FAQ.

Pip install tesseract-ocr : failed with exit status 2

I've been trying to install Tesseract-ocr library for a long time. Read many similar problems related with other packages and given solutions and none worked.
I think problem is about the my Microsoft Visual Studio. There is an error given the code below:
error: command 'c:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\Bin\x86_amd64\cl.exe' failed with exit status 2
I uninstalled, reinstalled, updated and tried many things but still not working :(
Thanks already now!
C:\Users\af>pip install tesseract-ocr
Collecting tesseract-ocr
Using cached tesseract-ocr-0.0.1.tar.gz
Requirement already satisfied: cython in c:\python34\lib\site-packages (from tesseract-ocr)
Building wheels for collected packages: tesseract-ocr
Running setup.py bdist_wheel for tesseract-ocr ... error
Complete output from command c:\python34\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\af\\AppData\\Local\\Temp\\pip-build-ggf9qvw1\\tesseract-ocr\\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 C:\Users\af\AppData\Local\Temp\tmpdnkpad7cpip-wheel- --python-tag cp34:
running bdist_wheel
running build
running build_py
file tesseract_ocr.py (for module tesseract_ocr) not found
file tesseract_ocr.py (for module tesseract_ocr) not found
running build_ext
building 'tesseract_ocr' extension
creating build
creating build\temp.win-amd64-3.4
creating build\temp.win-amd64-3.4\Release
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\x86_amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python34\include -Ic:\python34\include /Tptesseract_ocr.cpp /Fobuild\temp.win-amd64-3.4\Release\tesseract_ocr.obj
tesseract_ocr.cpp
tesseract_ocr.cpp(463) : fatal error C1083: Cannot open include file: 'leptonica/allheaders.h': No such file or directory
error: command 'c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Bin\\x86_amd64\\cl.exe' failed with exit status 2
----------------------------------------
Failed building wheel for tesseract-ocr
Running setup.py clean for tesseract-ocr
Failed to build tesseract-ocr
Installing collected packages: tesseract-ocr
Running setup.py install for tesseract-ocr ... error
Complete output from command c:\python34\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\af\\AppData\\Local\\Temp\\pip-build-ggf9qvw1\\tesseract-ocr\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\af\AppData\Local\Temp\pip-tcjuee8m-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
file tesseract_ocr.py (for module tesseract_ocr) not found
file tesseract_ocr.py (for module tesseract_ocr) not found
running build_ext
building 'tesseract_ocr' extension
creating build
creating build\temp.win-amd64-3.4
creating build\temp.win-amd64-3.4\Release
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\x86_amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python34\include -Ic:\python34\include /Tptesseract_ocr.cpp /Fobuild\temp.win-amd64-3.4\Release\tesseract_ocr.obj
tesseract_ocr.cpp
tesseract_ocr.cpp(463) : fatal error C1083: Cannot open include file: 'leptonica/allheaders.h': No such file or directory
error: command 'c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Bin\\x86_amd64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\python34\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\af\\AppData\\Local\\Temp\\pip-build-ggf9qvw1\\tesseract-ocr\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\af\AppData\Local\Temp\pip-tcjuee8m-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\af\AppData\Local\Temp\pip-build-ggf9qvw1\tesseract-ocr\
consider using pytesseract, worked for me on python 3.6: pip install pytesseract
If you encounter problems installing it directly by running the above command, try this link :
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Use the "find" tool to find pytesseract and in the directory where its downloaded, hold shift and right click, youll get an option to open a command window there and run:
pip install "filename"
You could also try downloading tesseract-ocr from the link above and perform the installation offline like i just explained.
Never quite figured out why, but some installations that failed worked when dowloaded. Hope that helps.
The fix for this issue is on the Compiling Page of tesseract-ocr
sudo apt-get install libleptonica-dev
I can tell you that this fixed the issue on a Raspberry Pi (Jessie and Stretch) and Debian (8 and 9)

Resources