nordri/microsoft-azure

Issue while building a docker image because of "azure-storage-blob==1.4.0" in requirements.txt

Opened this issue · 1 comments

Hi,

I am new to docker containers and getting an error while trying to build a docker image. Below is the docker file and requirement.txt for that:

Docker file:

FROM joyzoursky/python-chromedriver
WORKDIR /app
COPY . /app
RUN pip install --upgrade pip
RUN pip install virtualenv --upgrade
RUN pip install --trusted-host pypi.org -r requirements.txt
EXPOSE 80
ADD SeleniumTest.py /SeleniumTest.py

requirement.txt:

azure-storage-blob==1.4.0
selenium==3.141.0
bs4==0.0.1

Now the issue that I am facing is while trying to install azure-storage-blob package I am getting errors. But If I remove it from requirement.txt I am successfully able to build the docker image.
Below is the complete stack trace of the error which I am getting. Any ideas on why I am getting errors only when I try to install "azure-storage-blob" package?

ERROR:

Sending build context to Docker daemon 24.58kB
Step 1/8 : FROM joyzoursky/python-chromedriver
---> 98ff7a8bcdd3
Step 2/8 : WORKDIR /app
---> Using cache
---> 39a8b8906a2f
Step 3/8 : COPY . /app
---> ed7fc6b79769
Step 4/8 : RUN pip install --upgrade pip
---> Running in 164cc08dba84
Collecting pip
Downloading https://files.pythonhosted.org/packages/f9/fb/863012b13912709c13cf5cfdbfb304fa6c727659d6290438e1a88df9d848/pip-19.1-py2.py3-none-any.whl (1.4MB)
Installing collected packages: pip
Found existing installation: pip 18.1
Uninstalling pip-18.1:
Successfully uninstalled pip-18.1
Successfully installed pip-19.1
Removing intermediate container 164cc08dba84
---> 1cc2ea5e41be
Step 5/8 : RUN pip install virtualenv --upgrade
---> Running in 3947cd13d1e2
Collecting virtualenv
Downloading https://files.pythonhosted.org/packages/4f/ba/6f9315180501d5ac3e707f19fcb1764c26cc6a9a31af05778f7c2383eadb/virtualenv-16.5.0-py2.py3-none-any.whl (2.0MB)
Installing collected packages: virtualenv
Successfully installed virtualenv-16.5.0
Removing intermediate container 3947cd13d1e2
---> 80cb8ef19e4b
Step 6/8 : RUN pip install --trusted-host pypi.org -r requirements.txt
---> Running in 677fa321f65b
Collecting azure-storage-blob==1.4.0 (from -r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/f7/b7/9b20c39bf411e896d110d01f2551e6e7b397fde6eb06b07293fe29705d13/azure_storage_blob-1.4.0-py2.py3-none-any.whl (75kB)
Collecting selenium==3.141.0 (from -r requirements.txt (line 2))
Downloading https://files.pythonhosted.org/packages/80/d6/4294f0b4bce4de0abf13e17190289f9d0613b0a44e5dd6a7f5ca98459853/selenium-3.141.0-py2.py3-none-any.whl (904kB)
Collecting bs4==0.0.1 (from -r requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/10/ed/7e8b97591f6f456174139ec089c769f89a94a1a4025fe967691de971f314/bs4-0.0.1.tar.gz
Collecting azure-storage-common~=1.4 (from azure-storage-blob==1.4.0->-r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/73/84/025ac436a6a1d5516d1a67887d7122b3b2ea04ba6b2d2c46fe949accb62b/azure_storage_common-1.4.0-py2.py3-none-any.whl (46kB)
Collecting azure-common>=1.1.5 (from azure-storage-blob==1.4.0->-r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/75/1a/fe36fa32ee3f7ccd150149f9742b87ae5e10e3f9f4a2ed5625c26afd6a7a/azure_common-1.1.19-py2.py3-none-any.whl
Collecting urllib3 (from selenium==3.141.0->-r requirements.txt (line 2))
Downloading https://files.pythonhosted.org/packages/39/ec/d93dfc69617a028915df914339ef66936ea976ef24fa62940fd86ba0326e/urllib3-1.25.2-py2.py3-none-any.whl (150kB)
Collecting beautifulsoup4 (from bs4==0.0.1->-r requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/1d/5d/3260694a59df0ec52f8b4883f5d23b130bc237602a1411fa670eae12351e/beautifulsoup4-4.7.1-py3-none-any.whl (94kB)
Collecting python-dateutil (from azure-storage-common~=1.4->azure-storage-blob==1.4.0->-r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl (226kB)
Collecting cryptography (from azure-storage-common~=1.4->azure-storage-blob==1.4.0->-r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/07/ca/bc827c5e55918ad223d59d299fff92f3563476c3b00d0a9157d9c0217449/cryptography-2.6.1.tar.gz (491kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
ERROR: Complete output from command /usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-wyjb6b91/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --trusted-host pypi.org -- 'setuptools>=18.5' wheel 'cffi>=1.8,!=1.11.3; python_implementation != '"'"'PyPy'"'"'':
ERROR: Collecting setuptools>=18.5
Downloading https://files.pythonhosted.org/packages/ec/51/f45cea425fd5cb0b0380f5b0f048ebc1da5b417e48d304838c02d6288a1e/setuptools-41.0.1-py2.py3-none-any.whl (575kB)
Collecting wheel
Downloading https://files.pythonhosted.org/packages/96/ba/a4702cbb6a3a485239fbe9525443446203f00771af9ac000fa3ef2788201/wheel-0.33.1-py2.py3-none-any.whl
Collecting cffi!=1.11.3,>=1.8
Downloading https://files.pythonhosted.org/packages/93/1a/ab8c62b5838722f29f3daffcc8d4bd61844aa9b5f437341cc890ceee483b/cffi-1.12.3.tar.gz (456kB)
Collecting pycparser (from cffi!=1.11.3,>=1.8)
Downloading https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz (158kB)
Building wheels for collected packages: cffi, pycparser
Building wheel for cffi (setup.py): started
Building wheel for cffi (setup.py): finished with status 'error'
ERROR: Complete output from command /usr/local/bin/python -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-r3k1tljf/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 /tmp/pip-wheel-wyi9_1tz --python-tag cp37:
ERROR: unable to execute 'gcc': No such file or directory
unable to execute 'gcc': No such file or directory

No working compiler found, or bogus compiler options passed to
the compiler from Python's standard "distutils" module.  See
the error messages above.  Likely, the problem is not related
to CFFI but generic to the setup.py of any Python package that
tries to compile C code.  (Hints: on OS/X 10.8, for errors about
-mno-fused-madd see http://stackoverflow.com/questions/22313407/
Otherwise, see https://wiki.python.org/moin/CompLangPython or
the IRC channel #python on irc.freenode.net.)

Trying to continue anyway.  If you are trying to install CFFI from
a build done in a different context, you can ignore this warning.

running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/init.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/error.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.7/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.7/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-3.7/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.7/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/c
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.7m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.7/c/_cffi_backend.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1

ERROR: Failed building wheel for cffi
Running setup.py clean for cffi
Building wheel for pycparser (setup.py): started
Building wheel for pycparser (setup.py): finished with status 'done'
Stored in directory: /root/.cache/pip/wheels/f2/9a/90/de94f8556265ddc9d9c8b271b0f63e57b26fb1d67a45564511
Successfully built pycparser
Failed to build cffi
Installing collected packages: setuptools, wheel, pycparser, cffi
Running setup.py install for cffi: started
Running setup.py install for cffi: finished with status 'error'
ERROR: Complete output from command /usr/local/bin/python -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-r3k1tljf/cffi/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-3x4va7oj/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-wyjb6b91/overlay --compile:
ERROR: unable to execute 'gcc': No such file or directory
unable to execute 'gcc': No such file or directory

  No working compiler found, or bogus compiler options passed to
  the compiler from Python's standard "distutils" module.  See
  the error messages above.  Likely, the problem is not related
  to CFFI but generic to the setup.py of any Python package that
  tries to compile C code.  (Hints: on OS/X 10.8, for errors about
  -mno-fused-madd see http://stackoverflow.com/questions/22313407/
  Otherwise, see https://wiki.python.org/moin/CompLangPython or
  the IRC channel #python on irc.freenode.net.)

  Trying to continue anyway.  If you are trying to install CFFI from
  a build done in a different context, you can ignore this warning.

running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/init.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/error.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.7/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.7/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.7/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-3.7/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.7/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/c
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.7m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.7/c/_cffi_backend.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1

ERROR: Command "/usr/local/bin/python -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-r3k1tljf/cffi/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-3x4va7oj/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-wyjb6b91/overlay --compile" failed with error code 1 in /tmp/pip-install-r3k1tljf/cffi/
ERROR: Command "/usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-wyjb6b91/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --trusted-host pypi.org -- 'setuptools>=18.5' wheel 'cffi>=1.8,!=1.11.3; python_implementation != '"'"'PyPy'"'"''" failed with error code 1 in None
The command '/bin/sh -c pip install --trusted-host pypi.org -r requirements.txt' returned a non-zero code: 1

Hi @atuljoshi1990
It looks like you don't have any compiler installed on the system where you're trying to install the Python requirements...
You can install it running:
sudo apt update && sudo apt install -y build-essential
Let me know if you need any more help.
Cheers!