install pycocotools in Mac m1 - macos

python 3.9
pip 22.3.1
setuptools 66.0.0
wheel 0.38.4
when install yolox, there is always error in installing pycocotools as below:
× Building wheel for pycocotools (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-cpython-39
creating build/lib.macosx-10.9-universal2-cpython-39/pycocotools
copying pycocotools/coco.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools
copying pycocotools/mask.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools
copying pycocotools/init.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools
copying pycocotools/cocoeval.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools
running build_ext
cythoning pycocotools/_mask.pyx to pycocotools/mask.c
/private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-build-env-kb70uki/overlay/lib/python3.9/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: /private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-install-zc58cnkb/pycocotools_f63b404805f6427bb06acdd61bfd63a0/pycocotools/mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'pycocotools.mask' extension
creating build/temp.macosx-10.9-universal2-cpython-39
creating build/temp.macosx-10.9-universal2-cpython-39/common
creating build/temp.macosx-10.9-universal2-cpython-39/pycocotools
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.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-build-env-kb70uki/overlay/lib/python3.9/site-packages/numpy/core/include -I./common -I/Users/zhangelaine/env/YOLOX/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c ./common/maskApi.c -o build/temp.macosx-10.9-universal2-cpython-39/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
./common/maskApi.c:151:32: warning: unused variable 'xp' [-Wunused-variable]
uint h, w, xs, ys, xe, ye, xp, cc; siz j, m;
^
1 warning generated.
./common/maskApi.c:151:32: warning: unused variable 'xp' [-Wunused-variable]
uint h, w, xs, ys, xe, ye, xp, cc; siz j, m;
^
1 warning generated.
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.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-build-env-kb70uki/overlay/lib/python3.9/site-packages/numpy/core/include -I./common -I/Users/zhangelaine/env/YOLOX/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c pycocotools/_mask.c -o build/temp.macosx-10.9-universal2-cpython-39/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99
pycocotools/_mask.c:6:10: fatal error: 'Python.h' file not found
#include "Python.h"
^~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycocotools
Failed to build pycocotools
ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects
so i goto pycocotools website to downlord whl file.
https://pypi.tuna.tsinghua.edu.cn/simple/pycocotools-windows/ and got error as below
ERROR: pycocotools_windows-2.0.0.2-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform.
any suggestion ? thanks a lot

solution : use miniforge to install conda
and install pycocotools with conda in Mac m1. It works, no error anymore
however pip install in conda env is a little bit complicated,
i am tring it.

Related

Cannot install pdftopng

Trying to install pdftopng with pip which is version 23.0.1 I get
~/06-Projekte/PycharmProjects/sgf2eps % pip install pdftopng
Collecting pdftopng
Using cached pdftopng-0.1.0.tar.gz (11 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting Click>=7.0
Using cached click-8.1.3-py3-none-any.whl (96 kB)
Building wheels for collected packages: pdftopng
Building wheel for pdftopng (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pdftopng (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [35 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-13-x86_64-cpython-311
creating build/lib.macosx-13-x86_64-cpython-311/pdftopng
copying src/pdftopng/__init__.py -> build/lib.macosx-13-x86_64-cpython-311/pdftopng
copying src/pdftopng/__version__.py -> build/lib.macosx-13-x86_64-cpython-311/pdftopng
running egg_info
writing src/pdftopng.egg-info/PKG-INFO
writing dependency_links to src/pdftopng.egg-info/dependency_links.txt
writing requirements to src/pdftopng.egg-info/requires.txt
writing top-level names to src/pdftopng.egg-info/top_level.txt
reading manifest file 'src/pdftopng.egg-info/SOURCES.txt'
writing manifest file 'src/pdftopng.egg-info/SOURCES.txt'
copying src/pdftopng/pdftopng.cpp -> build/lib.macosx-13-x86_64-cpython-311/pdftopng
running build_ext
creating var
creating var/folders
creating var/folders/rf
creating var/folders/rf/5wykxh413gg6djy1vmg0ypww0000gn
creating var/folders/rf/5wykxh413gg6djy1vmg0ypww0000gn/T
clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/local/opt/python#3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c /var/folders/rf/5wykxh413gg6djy1vmg0ypww0000gn/T/tmpl6tvr13s.cpp -o var/folders/rf/5wykxh413gg6djy1vmg0ypww0000gn/T/tmpl6tvr13s.o -std=c++14
clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/local/opt/python#3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c /var/folders/rf/5wykxh413gg6djy1vmg0ypww0000gn/T/tmpav4l0ebv.cpp -o var/folders/rf/5wykxh413gg6djy1vmg0ypww0000gn/T/tmpav4l0ebv.o -fvisibility=hidden
building 'pdftopng.pdftopng' extension
creating build/temp.macosx-13-x86_64-cpython-311
creating build/temp.macosx-13-x86_64-cpython-311/src
creating build/temp.macosx-13-x86_64-cpython-311/src/pdftopng
clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -DVERSION_INFO=\"0.1.0\" -Ilib/poppler -Ilib/poppler/fofi -Ilib/poppler/goo -Ilib/poppler/poppler -Ilib/poppler/build -Ilib/poppler/build/poppler -Ilib/poppler/utils -Ilib/poppler/build/utils -I/private/var/folders/rf/5wykxh413gg6djy1vmg0ypww0000gn/T/pip-build-env-xio3q4pz/overlay/lib/python3.11/site-packages/pybind11/include -I/usr/local/opt/python#3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c src/pdftopng/pdftopng.cpp -o build/temp.macosx-13-x86_64-cpython-311/src/pdftopng/pdftopng.o -O3 -Wall -shared -fPIC -stdlib=libc++ -mmacosx-version-min=10.7 -std=c++14 -fvisibility=hidden
clang: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
src/pdftopng/pdftopng.cpp:44:10: fatal error: 'config.h' file not found
#include "config.h"
^~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pdftopng
Failed to build pdftopng
ERROR: Could not build wheels for pdftopng, which is required to install pyproject.toml-based projects
The strange thing is, that I already had pdftopng installed and it has been working. I don't know what happens.

error: command 'gcc' failed with exit status 1 fatal error: 'vector' file not found

I ran pip install annoy and got the following error:
Collecting annoy
Using cached https://files.pythonhosted.org/packages/b5/28/f8ce7400344090bb5cfa1c9fae3fdb03b9438db082d458686442633d82a3/annoy-1.15.0.tar.gz
Building wheels for collected packages: annoy
Running setup.py bdist_wheel for annoy ... error
Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/yp/4w8nvxls4y99r68kpxzzwdl00000gn/T/pip-build-h3hirwtn/annoy/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 /var/folders/yp/4w8nvxls4y99r68kpxzzwdl00000gn/T/tmpdqliidvopip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.6-x86_64-3.6
creating build/lib.macosx-10.6-x86_64-3.6/annoy
copying annoy/__init__.py -> build/lib.macosx-10.6-x86_64-3.6/annoy
running build_ext
building 'annoy.annoylib' extension
creating build/temp.macosx-10.6-x86_64-3.6
creating build/temp.macosx-10.6-x86_64-3.6/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I/anaconda3/include/python3.6m -c src/annoymodule.cc -o build/temp.macosx-10.6-x86_64-3.6/src/annoymodule.o -O3 -ffast-math -fno-associative-math -march=native
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from src/annoymodule.cc:15:
src/annoylib.h:49:10: fatal error: 'vector' file not found
#include <vector>
^~~~~~~~
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
From reading other stackoverflow answers, I should compile with g++ rather than gcc? How do I do that?
I should compile with g++ rather than gcc : visibly yes, #include <vector> is typically C++, not C
The way to install g++ depend on the platform/OS you use

Mac OS X (10.12.6) with Python 3.7.0a install lxml failed

I've already built libxslt(1.1.31) and libxml2(2.9.7) with homebrew and made link:
brew install libxml2
Warning: libxml2 2.9.7 is already installed
brew install libxslt
Warning: libxslt 1.1.31 is already installed
installed Xcode and tried to reinstall the command-line tools:
xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
exported C_INCLUDE_PATH:
echo $C_INCLUDE_PATH
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
tried this:
STATIC_DEPS=true pip install lxml
tried easy_install and tried to build it from the source code.
But, all methods failed. It really makes me confused.
The error message is :
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DCYTHON_CLINE_IN_TRACEBACK=1 -I/usr/local/Cellar/libxslt/1.1.31/include -I/usr/local/Cellar/libxml2/2.9.7/include/libxml2 -Isrc -Isrc/lxml/includes -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/lxml/etree.c -o build/temp.macosx-10.6-intel-3.7/src/lxml/etree.o -w -flat_namespace
src/lxml/etree.c:243289:21: error: no member named 'exc_state' in 'struct _ts'
*type = tstate->exc_state.exc_type;
~~~~~~ ^
src/lxml/etree.c:243290:22: error: no member named 'exc_state' in 'struct _ts'
*value = tstate->exc_state.exc_value;
~~~~~~ ^
[...(same error omitted)]
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Compile failed: command '/usr/bin/clang' failed with exit status 1
creating var
creating var/folders
creating var/folders/5m
creating var/folders/5m/61f2z4pn75q0jbg65kn4cjzc0000gn
creating var/folders/5m/61f2z4pn75q0jbg65kn4cjzc0000gn/T
cc -I/usr/local/Cellar/libxslt/1.1.31/include -I/usr/local/Cellar/libxml2/2.9.7/include/libxml2 -I/usr/include/libxml2 -c /var/folders/5m/61f2z4pn75q0jbg65kn4cjzc0000gn/T/xmlXPathInitmvd417vw.c -o var/folders/5m/61f2z4pn75q0jbg65kn4cjzc0000gn/T/xmlXPathInitmvd417vw.o
/var/folders/5m/61f2z4pn75q0jbg65kn4cjzc0000gn/T/xmlXPathInitmvd417vw.c:2:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main (int argc, char **argv) {
^
1 warning generated.
cc var/folders/5m/61f2z4pn75q0jbg65kn4cjzc0000gn/T/xmlXPathInitmvd417vw.o -L/usr/local/Cellar/libxslt/1.1.31/lib -L/usr/local/Cellar/libxml2/2.9.6/lib -lxml2 -o a.out
ld: warning: directory not found for option '-L/usr/local/Cellar/libxml2/2.9.6/lib'
error: command '/usr/bin/clang' failed with exit status 1
Failed building wheel for lxml
Try using:
CFLAGS="-O0" sudo pip install lxml
Hope this heps!

Error: Installing PyObjus kivy

I'm installing PyObjus: sudo python setup.py install-> logging command:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-intel-2.7
creating build/lib.macosx-10.9-intel-2.7/pyobjus
copying pyobjus/__init__.py -> build/lib.macosx-10.9-intel-2.7/pyobjus
copying pyobjus/debug.py -> build/lib.macosx-10.9-intel-2.7/pyobjus
copying pyobjus/dylib_manager.py -> build/lib.macosx-10.9-intel-2.7/pyobjus
copying pyobjus/objc_py_types.py -> build/lib.macosx-10.9-intel-2.7/pyobjus
copying pyobjus/protocols.py -> build/lib.macosx-10.9-intel-2.7/pyobjus
copying pyobjus/test.py -> build/lib.macosx-10.9-intel-2.7/pyobjus
running build_ext
cythoning pyobjus/pyobjus.pyx to pyobjus/pyobjus.c
building 'pyobjus' extension
creating build/temp.macosx-10.9-intel-2.7
creating build/temp.macosx-10.9-intel-2.7/pyobjus
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pyobjus/pyobjus.c -o build/temp.macosx-10.9-intel-2.7/pyobjus/pyobjus.o
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'cc' failed with exit status 1
I'm using Xcode 5.1 on Mac 10.9. You can visit: https://github.com/kivy/pyobjus

Error trying to upgrade Pillow on Mac

I'm trying to upgrade Pillow on my Mac. When I run sudo pip install Pillow I get
Requirement already satisfied (use --upgrade to upgrade): Pillow in ./lib/python2.7/site-packages/Pillow-2.3.0-py2.7-macosx-10.8-intel.egg
I run sudo pip install --upgrade Pillow and I get the following error:
copying PIL/OleFileIO-README.md -> build/lib.macosx-10.9-intel-2.7/PIL
running build_ext
--- using frameworks at /System/Library/Frameworks
building 'PIL._imaging' extension
creating build/temp.macosx-10.9-intel-2.7
creating build/temp.macosx-10.9-intel-2.7/libImaging
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -DHAVE_LIBTIFF -I/opt/local/include/freetype2 -I/Users/edwinzg/School/College/SeniorYear/SpringSemester/rb-master/build/Pillow/libImaging -I/Users/edwinzg/School/College/SeniorYear/SpringSemester/rb-master/include -I/opt/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.9-intel-2.7/_imaging.o
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'cc' failed with exit status 1
----------------------------------------
Rolling back uninstall of Pillow
Cleaning up...
Exception:
Traceback (most recent call last):
File "/Users/edwinzg/School/College/SeniorYear/SpringSemester/rb-master/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Users/edwinzg/School/College/SeniorYear/SpringSemester/rb-master/lib/python2.7/site-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Users/edwinzg/School/College/SeniorYear/SpringSemester/rb-master/lib/python2.7/site-packages/pip/req.py", line 1439, in install
requirement.rollback_uninstall()
File "/Users/edwinzg/School/College/SeniorYear/SpringSemester/rb-master/lib/python2.7/site-packages/pip/req.py", line 603, in rollback_uninstall
self.uninstalled.rollback()
File "/Users/edwinzg/School/College/SeniorYear/SpringSemester/rb-master/lib/python2.7/site-packages/pip/req.py", line 1855, in rollback
pth.rollback()
AttributeError: 'str' object has no attribute 'rollback'
Does anyone know how to fix this? Thanks.
This worked for me:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install --upgrade pillow

Resources