0

I am trying to deploy a django project, which makes use of MSSQL Server. I am trying to deploy it using AWS Elastic Beanstalk. If anyone could help me out I would really appreciate it.

I have GCC and G++ working on my computer, so I am not sure why that is causing any problems here. I searched around and wasnt able to find any solution that is directly related to mine, and I am not sure where to move forward from here.

Here is the requirements.txt

astroid==1.6.5
awsebcli==3.14.6
botocore==1.12.9
cement==2.8.2
colorama==0.3.9
Django==2.0.6
django-mssql==1.8
django-pyodbc-azure==2.0.6.1
django-sendgrid-v5==0.6.893
docutils==0.14
future==0.16.0
isort==4.3.4
jmespath==0.9.3
lazy-object-proxy==1.3.1
mccabe==0.6.1
mysql-connector-python-rf==2.2.2
pathspec==0.5.5
pylint==1.9.2
PyMySQL==0.8.1
pyodbc==4.0.23
pypyodbc==1.3.3.1
python-dateutil==2.7.3
python-http-client==3.1.0
pytz==2018.5
PyYAML==3.13
semantic-version==2.5.0
sendgrid==5.4.1
six==1.11.0
style==1.1.0
termcolor==1.1.0
update==0.0.1
urllib3==1.22
wrapt==1.10.11

This is my log, specifically the eb-activity section


/var/log/eb-activity.log

    Running setup.py bdist_wheel for pyodbc: started
    Running setup.py bdist_wheel for pyodbc: finished with status 'error'
    Complete output from command /opt/python/run/venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-1cdwy0uv/pyodbc/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/tmpxf7u3lwwpip-wheel- --python-tag cp36:
    running bdist_wheel
    running build
    running build_ext
    building 'pyodbc' extension
    creating build
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/src
    gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYODBC_VERSION=4.0.23 -I/usr/include/python3.6m -c src/pyodbcmodule.cpp -o build/temp.linux-x86_64-3.6/src/pyodbcmodule.o -Wno-write-strings
    gcc: error trying to exec 'cc1plus': execvp: No such file or directory
    error: command 'gcc' failed with exit status 
 Failed building wheel for pyodbc
    Running setup.py clean for pyodbc
  Failed to build pyodbc
  Installing collected packages: pyodbc, django-pyodbc-azure, future, python-http-client, sendgrid, django-sendgrid-v5, isort, mccabe, mysql-connector-python-rf, pylint, PyMySQL, pypyodbc, style, update
    Running setup.py install for pyodbc: started
      Running setup.py install for pyodbc: finished with status 'error'
      Complete output from command /opt/python/run/venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-1cdwy0uv/pyodbc/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-wpg4l1dm-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python3.6/pyodbc:
      running install
      running build
      running build_ext
      building 'pyodbc' extension
      creating build
      creating build/temp.linux-x86_64-3.6
      creating build/temp.linux-x86_64-3.6/src
      gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPYODBC_VERSION=4.0.23 -I/usr/include/python3.6m -c src/pyodbcmodule.cpp -o build/temp.linux-x86_64-3.6/src/pyodbcmodule.o -Wno-write-strings
      gcc: error trying to exec 'cc1plus': execvp: No such file or directory
      error: command 'gcc' failed with exit status 1
John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • This is a `pyodbc` problem. Looks like it has a C++ interface, the compilation of which is failing. The EC2 machine you are running this on potentially lacks a necessary linkage library. – progfan Sep 24 '18 at 15:09
  • 1
    There are some suggestions in [this Stack Overflow question](https://stackoverflow.com/questions/11912878/gcc-error-gcc-error-trying-to-exec-cc1-execvp-no-such-file-or-directory). As you are a new contributor, for future reference, it is considered best-practice to determine whether the question you are trying to answer has already been answered. – progfan Sep 24 '18 at 16:51

1 Answers1

1

If you do not already have a .ebextensions directory, then create one, and add a file named 01_packages.config to it with the following content:

packages:
  yum:
    gcc-c++: []
    unixODBC-devel: []

When you run eb deploy at your console, then the config files in the .ebextensions directory will be processed before AWS runs pip install on your requirements.txt file, and you should have the right packages installed for your pypyodbc==1.3.3.1 requirement.

cjohnson318
  • 3,154
  • 30
  • 33