I am trying to build a django project to push it to an ECR instance but I am having trouble building the project through docker.
Running this command:
docker build -t stuffkeep-docker-app .
Results in this error and I have not found any way to resolve this yet.
Building wheels for collected packages: backports.zoneinfo, django-allauth, django-rest-framework, fcm-django, gcloud, http-ece, jws, py-vapid, pywebpush
Building wheel for backports.zoneinfo (pyproject.toml): started
Building wheel for backports.zoneinfo (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
× Building wheel for backports.zoneinfo (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [43 lines of output]
/tmp/pip-build-env-9x4p5_f7/overlay/lib/python3.10/site-packages/setuptools/config/setupcfg.py:459: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-310
creating build/lib.linux-x86_64-cpython-310/backports
copying src/backports/__init__.py -> build/lib.linux-x86_64-cpython-310/backports
creating build/lib.linux-x86_64-cpython-310/backports/zoneinfo
copying src/backports/zoneinfo/_tzpath.py -> build/lib.linux-x86_64-cpython-310/backports/zoneinfo
copying src/backports/zoneinfo/_version.py -> build/lib.linux-x86_64-cpython-310/backports/zoneinfo
copying src/backports/zoneinfo/_zoneinfo.py -> build/lib.linux-x86_64-cpython-310/backports/zoneinfo
copying src/backports/zoneinfo/_common.py -> build/lib.linux-x86_64-cpython-310/backports/zoneinfo
copying src/backports/zoneinfo/__init__.py -> build/lib.linux-x86_64-cpython-310/backports/zoneinfo
running egg_info
writing src/backports.zoneinfo.egg-info/PKG-INFO
writing dependency_links to src/backports.zoneinfo.egg-info/dependency_links.txt
writing requirements to src/backports.zoneinfo.egg-info/requires.txt
writing top-level names to src/backports.zoneinfo.egg-info/top_level.txt
reading manifest file 'src/backports.zoneinfo.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.png' under directory 'docs'
warning: no files found matching '*.svg' under directory 'docs'
no previously-included directories found matching 'docs/_build'
no previously-included directories found matching 'docs/_output'
adding license file 'LICENSE'
adding license file 'licenses/LICENSE_APACHE'
writing manifest file 'src/backports.zoneinfo.egg-info/SOURCES.txt'
copying src/backports/zoneinfo/__init__.pyi -> build/lib.linux-x86_64-cpython-310/backports/zoneinfo
copying src/backports/zoneinfo/py.typed -> build/lib.linux-x86_64-cpython-310/backports/zoneinfo
running build_ext
building 'backports.zoneinfo._czoneinfo' extension
creating build/temp.linux-x86_64-cpython-310
creating build/temp.linux-x86_64-cpython-310/lib
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.10 -c lib/zoneinfo_module.c -o build/temp.linux-x86_64-cpython-310/lib/zoneinfo_module.o -std=c99
lib/zoneinfo_module.c: In function ‘zoneinfo_fromutc’:
lib/zoneinfo_module.c:600:19: error: ‘_PyLong_One’ undeclared (first use in this function); did you mean ‘_PyLong_New’?
600 | one = _PyLong_One;
| ^~~~~~~~~~~
| _PyLong_New
lib/zoneinfo_module.c:600:19: note: each undeclared identifier is reported only once for each function it appears in
error: command '/usr/bin/gcc' 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 backports.zoneinfo
and
ERROR: Could not build wheels for backports.zoneinfo, which is required to install pyproject.toml-based projects
I am very aware of this question which has the same error but the poster of that is building for Heroku which I am not using and the solutions given are heroku focused.
I am configuring Docker to use Django, but I have a problem running Docker, which is probably a Psycopg problem, how should I fix this?
my docker error :
Uninstalling psycopg2-2.8.4:
Successfully uninstalled psycopg2-2.8.4
Running setup.py install for psycopg2: started
Running setup.py install for psycopg2: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-71k484j0/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-71k484j0/psycopg2/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-klbk9cly/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-71k484j0/psycopg2/
Complete output (72 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/psycopg1.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
creating build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_bug_gc.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_lobject.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_sql.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_quote.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/testconfig.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_dates.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_notify.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_errcodes.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_connection.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_cancel.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_replication.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_bugX000.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_fast_executemany.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_copy.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_green.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_types_basic.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_cursor.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_async_keyword.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_types_extras.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_with.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/testutils.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_module.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/dbapi20.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_transaction.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
copying tests/test_async.py -> build/lib.linux-x86_64-3.8/psycopg2/tests
Skipping optional fixer: buffer
Skipping optional fixer: idioms
Skipping optional fixer: set_literal
Skipping optional fixer: ws_comma
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psycopg
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION=2.7.7 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=110005 -DHAVE_LO64=1 -I/usr/local/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/11/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
psycopg/psycopgmodule.c: In function ‘psyco_is_main_interp’:
psycopg/psycopgmodule.c:689:18: error: dereferencing pointer to incomplete type ‘PyInterpreterState’ {aka ‘struct _is’}
while (interp->next)
^~
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
error: command 'gcc' failed with exit status 1
----------------------------------------
Dokerfile:
FROM python:3
RUN export PATH=/usr/lib/postgresql/X.Y/bin/:$PATH
RUN pip3 install psycopg2-binary
RUN pip3 install psycopg2
ENV PYTHONUNBUFFERED 0
RUN mkdir /code
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/
I tried installing Psycopg2-Binary, but it was remain
I have been having installation problems for 3 days related to Docker.
Does anybody have a good idea?
Update to psycopg2.8 or higher to support latest python
https://github.com/psycopg/psycopg2/issues/854
In your docker file please run, you need to install some additional dependencies, python development, psql contrib etc
sudo apt update
sudo apt-get install postgresql-contrib
sudo apt-get install libpq-dev gcc # this is required as psycopg2 uses pg_config
sudo apt-get install python3-dev
Of course the apt installs should come before your pip installs.
Further in your script where you run pip install .... please change it to pip3
I'm attempting transition my base docker image from centos 7 to alpine, however I receive gcc errors when trying to install pip packages.
This is a snippet of the error received:
Successfully built backports.ssl-match-hostname configobj dpkt iniparse IPy kitchen logmatic-python maxminddb NeuroTools procfs pycparser python-json-logger pyudev repoze.lru scandir scapy
Failed to build guppy kiwisolver numpy psutil pygpgme pyliblzma python-ldap pyxattr subprocess32
Installing collected packages: atomicwrites, attrs, backports.functools-lru-cache, backports.ssl-match-hostname, certifi, chardet, six, configobj, configparser, contextlib2, cycler, decorator, dnspython, dpkt, urllib3, elasticsearch, elasticsearch5, elasticsearch6, funcsigs, ipaddress, maxminddb, idna, requests, geoip2, guppy, scandir, pathlib2, more-itertools, zipp, importlib-metadata, iniparse, IPy, kafka, kafka-python, kitchen, kiwisolver, python-json-logger, logmatic-python, mock, NeuroTools, numpy, pyparsing, packaging, pbr, ptyprocess, pexpect, pluggy, ply, procfs, psutil, py, pyasn1, pyasn1-modules, pycparser, pygpgme, pyliblzma, wcwidth, pytest, python-dateutil, python-ldap, pytz, pyudev, pyxattr, redis, repoze.lru, scapy, subprocess32, xmltodict
Running setup.py install for guppy: started
Running setup.py install for guppy: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-PWr6Cn/guppy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-PWr6Cn/guppy/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-ogmKgm/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-PWr6Cn/guppy/
Complete output (117 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/guppy
copying guppy/__init__.py -> build/lib.linux-x86_64-2.7/guppy
creating build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/docexample.py -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/test_heapyc.py -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/__init__.py -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/test_guppy.py -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/test_heapy.py -> build/lib.linux-x86_64-2.7/guppy/doc
creating build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/Code.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/Cat.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/IterPermute.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/OutputHandling.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/KnuthBendix.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/KanExtension.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/Unpack.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/__init__.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/FSA.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/tkcursors.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/cmd.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/xterm.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/etc.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/ExecfileWithModuleInfo.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/Help.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/RE.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/RE_Rect.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/Glue.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/textView.py -> build/lib.linux-x86_64-2.7/guppy/etc
copying guppy/etc/Compat.py -> build/lib.linux-x86_64-2.7/guppy/etc
creating build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/Html.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/Latex.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/DottedTree.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/Main.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/FileIO.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/Filer.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/__init__.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/XHTML.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/Text.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/Document.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/Gsml.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/Help.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/Exceptions.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/Tester.py -> build/lib.linux-x86_64-2.7/guppy/gsl
copying guppy/gsl/SpecNodes.py -> build/lib.linux-x86_64-2.7/guppy/gsl
creating build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/Spec.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/OutputHandling.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/Remote.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/RefPat.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/ImpSet.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/Monitor.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/Classifiers.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/__init__.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/RM.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/UniSet.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/View.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/Target.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/Doc.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/Prof.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/Part.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/Console.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/Use.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/Path.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/AbstractAlgebra.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/RemoteConstants.py -> build/lib.linux-x86_64-2.7/guppy/heapy
copying guppy/heapy/pbhelp.py -> build/lib.linux-x86_64-2.7/guppy/heapy
creating build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_Classifiers.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_sf.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_heapyc.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_OutputHandling.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_Spec.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/__init__.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_View.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_Path.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_UniSet.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_menuleak.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_dependencies.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_RetaGraph.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_Part.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_all.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_RefPat.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/test_ER.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
copying guppy/heapy/test/support.py -> build/lib.linux-x86_64-2.7/guppy/heapy/test
creating build/lib.linux-x86_64-2.7/guppy/sets
copying guppy/sets/test.py -> build/lib.linux-x86_64-2.7/guppy/sets
copying guppy/sets/__init__.py -> build/lib.linux-x86_64-2.7/guppy/sets
copying guppy/doc/gsl.html -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/heapy_UniSet.html -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/sets.html -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/heapyc.html -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/guppy.html -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/ProfileBrowser.html -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/heapy_tutorial.html -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/index.html -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/docexample.html -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/heapy_Use.html -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/gslexample.html -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/heapy_RootState.html -> build/lib.linux-x86_64-2.7/guppy/doc
copying guppy/doc/pbscreen.jpg -> build/lib.linux-x86_64-2.7/guppy/doc
running build_ext
building 'guppy.sets.setsc' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/sets
gcc -fno-strict-aliasing -Os -fomit-frame-pointer -g -DNDEBUG -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python2.7 -c src/sets/sets.c -o build/temp.linux-x86_64-2.7/src/sets/sets.o
src/sets/sets.c:33:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-PWr6Cn/guppy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-PWr6Cn/guppy/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-ogmKgm/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
The command '/bin/sh -c pip install -r /home/admin/container_files/requirements.txt' returned a non-zero code: 1
I can only derive that gcc is not being installed (correctly?) despite being listed in my Dockerfile below. I've also attempted to run it within its own level in case that would install it correctly:
FROM alpine:latest
RUN apk update && apk upgrade
RUN apk add --no-cache bash\
python \
pkgconfig \
git \
gcc \
openldap \
libcurl \
&& rm -rf /var/cache/apk/*
RUN wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py
ADD requirements.txt /home/admin/container_files/
RUN pip install setuptools==30.1.0
RUN pip install -r /home/admin/container_files/requirements.txt
Uncommenting the pip install -r requirements.txt line results in the image being built. After ssh'ing into an instance of the image, gcc does appear to be installed, however I'm unsure why it would then error above:
$ docker run -it alpine-image bash
bash-5.0# gcc --version
gcc (Alpine 8.3.0) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
While in the docker container I can try pip installing a dependency on its own, however this gives a similar error as above:
bash-5.0# pip install pygpgme
Collecting pygpgme
Using cached https://files.pythonhosted.org/packages/dc/96/b2bcbd3a216af313bb9045c2e573aa18653876a65db471b86be7598234dd/pygpgme-0.3.tar.gz
Building wheels for collected packages: pygpgme
Building wheel for pygpgme (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ih85iq/pygpgme/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ih85iq/pygpgme/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-1HBTfc --python-tag cp27
cwd: /tmp/pip-install-ih85iq/pygpgme/
Complete output (18 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/gpgme
copying gpgme/__init__.py -> build/lib.linux-x86_64-2.7/gpgme
copying gpgme/editutil.py -> build/lib.linux-x86_64-2.7/gpgme
running build_ext
building 'gpgme._gpgme' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
gcc -fno-strict-aliasing -Os -fomit-frame-pointer -g -DNDEBUG -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python2.7 -c src/gpgme.c -o build/temp.linux-x86_64-2.7/src/gpgme.o
src/gpgme.c:21:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pygpgme
Running setup.py clean for pygpgme
Failed to build pygpgme
Installing collected packages: pygpgme
Running setup.py install for pygpgme ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ih85iq/pygpgme/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ih85iq/pygpgme/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-1HWn3q/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-ih85iq/pygpgme/
Complete output (18 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/gpgme
copying gpgme/__init__.py -> build/lib.linux-x86_64-2.7/gpgme
copying gpgme/editutil.py -> build/lib.linux-x86_64-2.7/gpgme
running build_ext
building 'gpgme._gpgme' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
gcc -fno-strict-aliasing -Os -fomit-frame-pointer -g -DNDEBUG -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python2.7 -c src/gpgme.c -o build/temp.linux-x86_64-2.7/src/gpgme.o
src/gpgme.c:21:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ih85iq/pygpgme/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ih85iq/pygpgme/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-1HWn3q/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
I'd like to understand why gcc is behaving in this way, and if there is a better way to transition to an alpine image from centos?
Additional information:
Alpine version: 3.10.3
python version: 2.7.16
pip version: 19.3.1
Missing the header file Python.h , this file is provide by python2-dev ( -dev mean package for doing development with ) .
With this https://pkgs.alpinelinux.org/contents you can search all packages that have Python.h
I was able to run pip install pygpgme by adding these 3 packages :
python2-dev
gpgme-dev
libc-dev
And the Dockerfile will be :
FROM alpine:latest
RUN apk update && apk upgrade
RUN apk add --no-cache bash\
python \
pkgconfig \
git \
gcc \
openldap \
libcurl \
python2-dev \
gpgme-dev \
libc-dev \
&& rm -rf /var/cache/apk/*
RUN wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py
RUN pip install setuptools==30.1.0
conda install -c conda-forge opencv
Collecting package metadata (repodata.json): done
Solving environment: failed
Initial quick solve with frozen env failed. Unfreezing env and trying again.
Solving environment: failed
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Package mkl-service conflicts for:
patsy -> scipy -> mkl-service[version='>=2,<3.0a0']
statsmodels -> patsy[version='>=0.4.0'] -> scipy -> mkl-service[version='>=2,<3.0a0']
scikit-image -> scipy[version='>=0.17,>=0.9'] -> mkl-service[version='>=2,<3.0a0']
scipy -> mkl-service[version='>=2,<3.0a0']
scikit-learn -> scipy -> mkl-service[version='>=2,<3.0a0']
mkl-service
seaborn -> statsmodels[version='>=0.5.0'] -> patsy[version='>=0.4.0'] -> scipy -> mkl-service[version='>=2,<3.0a0']
Package importlib_metadata conflicts for:
importlib_metadata
path.py -> importlib_metadata[version='>=0.5']
anaconda==2019.03=py37_0 -> path.py==11.5.0=py37_0 -> importlib_metadata[version='>=0.5']
I had the same issue and found this post usefull, specially the comment by merv.
Basically, there seems to be some incompatibilities between the configuration needed for the default packages of anaconda and the one for the opencv package.
In order to solve the problem you need to created a new enviroment for conda. This enviroment will contain the opencv package with the proper configuration without afecting other packages.
conda create --name env_opencv -c conda-forge opencv
This will create the "env" and install opencv in it with the configuration required by the package.
Then activate the enviroment.
conda activate env_opencv
More info about the enviroments on conda can be found here
I am trying to follow the tutorial at this link http://bost.ocks.org/mike/map/
I have followed every instruction exactly as listed so far but when I try to run the command found in the "#Converting Data" section to create the subunits.json file:
$ogr2ogr \ -f GeoJSON \ -where "ADM0_A3 IN ('GBR', 'IRL')" \ subunits.json \ ne_10m_admin_0_map_subunits.shp
I get the following error (others posted about a similar error where the existing file ne_10m_admin... could not be opened but I can't find anything on the GeoJSON issue below):
$ ogr2ogr \ -f GeoJSON \ -where "ADM0_A3 IN ('GBR', 'IRL')" \ subunits.json \ ne_10m_admin_0_map_subunits.shp
FAILURE:
Unable to open datasource `GeoJSON' with the following drivers.
-> ESRI Shapefile
-> MapInfo File
-> UK .NTF
-> SDTS
-> TIGER
-> S57
-> DGN
-> VRT
-> REC
-> Memory
-> BNA
-> CSV
-> GML
-> GPX
-> KML
-> GeoJSON
-> GMT
-> GPKG
-> SQLite
-> WAsP
-> PCIDSK
-> OpenFileGDB
-> XPlane
-> AVCBin
-> AVCE00
-> DXF
-> Geoconcept
-> GeoRSS
-> GPSTrackMaker
-> VFK
-> PGDump
-> OSM
-> GPSBabel
-> SUA
-> OpenAir
-> PDS
-> WFS
-> HTF
-> AeronavFAA
-> EDIGEO
-> GFT
-> GME
-> SVG
-> CouchDB
-> Idrisi
-> ARCGEN
-> SEGUKOOA
-> SEGY
-> XLS
-> ODS
-> XLSX
-> ElasticSearch
-> PDF
-> CartoDB
-> SXF
The instructions are a little unclear in the tutorial. You need to click the links:
Admin 0 - Details - map subunits
http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_map_subunits.zip
Populated Places
http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_populated_places.zip
Unzip those files
unzip FILE_NAME
Should produce .dbf, .prj, .shp, .shx, and .cpg files
And then run the command:
ogr2ogr -f GeoJSON -where "ADM0_A3 IN ('GBR', 'IRL')" subunits.json ne_10m_admin_0_map_subunits.shp
Solved this issue. It was a result of the topojson installation. Originally I installed with the command:
sudo npm install -g topojson
(also tried uninstalling and reinstalling with this command just incase)
Finally I uninstalled and reinstalled with the command:
sudo -H npm install -g topojson