nickjj / build-a-saas-app-with-flask

Learn how to build a production ready web app with Flask and Docker.
https://buildasaasappwithflask.com
MIT License
954 stars 185 forks source link

error at installing requirements.txt #24

Closed Mirabis closed 9 years ago

Mirabis commented 9 years ago

Whenever I try to install the requirements I get:

Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-buil d-CBf1KO/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file_ _).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-M gq0ua-record/install-record.txt --single-version-externally-managed --compile" f ailed with error code 1 in /tmp/pip-build-CBf1KO/psycopg2

nickjj commented 9 years ago

Are you using a Debian based system, if so have you installed the libpq-dev package? If you're using a Mac you will need to brew install postgresql for the header files.

Mirabis commented 9 years ago

Python 2.7.9 and pip 7.1.0 on Debian 3.16.0-4-amd64

nickjj commented 9 years ago

Sorry, I edited my comment to ask for different info. Can you sudo apt-get install libpq-dev and then try running pip install?

Mirabis commented 9 years ago

E: Unable to locate package libqp-dev

nickjj commented 9 years ago

Oops, libpq-dev.

Mirabis commented 9 years ago

hehe ;p

libpq-dev is already the newest version.

nickjj commented 9 years ago

What happens if you just pip install psycopg2? Also can you paste the error it dumped?

Mirabis commented 9 years ago

Okay, will try again on fresh install

Mirabis commented 9 years ago

` root@template:~# pip install psycopg2 Collecting psycopg2 Downloading psycopg2-2.6.1.tar.gz (371kB) 100% |████████████████████████████████| 372kB 613kB/s Building wheels for collected packages: psycopg2 Running setup.py bdist_wheel for psycopg2 Complete output from command /usr/bin/python -c "import setuptools;file='/ tmp/pip-build-FVZKlH/psycopg2/setup.py';exec(compile(open(file).read().repla ce('\r\n', '\n'), file, 'exec'))" bdist_wheel -d /tmp/tmpduKOBYpip-wheel-: 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/psycopg2 copying lib/init.py -> build/lib.linux-x86_64-2.7/psycopg2 copying lib/_range.py -> build/lib.linux-x86_64-2.7/psycopg2 copying lib/psycopg1.py -> build/lib.linux-x86_64-2.7/psycopg2 copying lib/_json.py -> build/lib.linux-x86_64-2.7/psycopg2 copying lib/pool.py -> build/lib.linux-x86_64-2.7/psycopg2 copying lib/extras.py -> build/lib.linux-x86_64-2.7/psycopg2 copying lib/tz.py -> build/lib.linux-x86_64-2.7/psycopg2 copying lib/errorcodes.py -> build/lib.linux-x86_64-2.7/psycopg2 copying lib/extensions.py -> build/lib.linux-x86_64-2.7/psycopg2 creating build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_cancel.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/init.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_module.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_lobject.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_green.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_async.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/testutils.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_bug_gc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/testconfig.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_bugX000.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_transaction.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_psycopg2_dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/ tests copying tests/test_extras_dictcursor.py -> build/lib.linux-x86_64-2.7/psycopg2 /tests copying tests/test_dates.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_cursor.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_notify.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_quote.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_connection.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_types_extras.py -> build/lib.linux-x86_64-2.7/psycopg2/test s copying tests/test_types_basic.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/dbapi20.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_copy.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/test_with.py -> build/lib.linux-x86_64-2.7/psycopg2/tests copying tests/dbapi20_tpc.py -> build/lib.linux-x86_64-2.7/psycopg2/tests running build_ext building 'psycopg2._psycopg' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/psycopg x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototype s -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION=" 2.6.1 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090403 -DHAVE_LO64=1 -I/usr/incl ude/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.4/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule .o -Wdeclaration-after-statement unable to execute 'x86_64-linux-gnu-gcc': No such file or directory error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


Failed building wheel for psycopg2 Failed to build psycopg2 Installing collected packages: psycopg2 Running setup.py install for psycopg2 Complete output from command /usr/bin/python -c "import setuptools, tokenize ;file='/tmp/pip-build-FVZKlH/psycopg2/setup.py';exec(compile(getattr(tokeniz e, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" ins tall --record /tmp/pip-RJiEJB-record/install-record.txt --single-version-externa lly-managed --compile: running install running build running build_py running build_ext building 'psycopg2._psycopg' extension x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototy pes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wforma t -Werror=format-security -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION ="2.6.1 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090403 -DHAVE_LO64=1 -I/usr/in clude/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.4/serv er -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodu le.o -Wdeclaration-after-statement unable to execute 'x86_64-linux-gnu-gcc': No such file or directory error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------

Command "/usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip-buil d-FVZKlH/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(file ).read().replace('\r\n', '\n'), __file, 'exec'))" install --record /tmp/pip-R JiEJB-record/install-record.txt --single-version-externally-managed --compile" f ailed with error code 1 in /tmp/pip-build-FVZKlH/psycopg2 root@template:~# `

Threw an error on psycopg2

nickjj commented 9 years ago

You may want to ping the author of psycopg2 or post an issue in his repo because at this point this is beyond the scope of the saas app.

It hints that you might be missing GCC on your machine. Have you done a apt-get install build-essential?

Mirabis commented 9 years ago

It's a fresh vm so hmm don't think I installed build-essentials ;o will try that later

Mirabis commented 9 years ago

Gave it a few more tries, ended up needing:

sudo apt-get install python-setuptools python-dev build-essential python-psycopg2

(build-essential) alone was not enough

nickjj commented 9 years ago

Ok thanks. I don't think python-psycopg2 is needed tho. We're installing it through pip.

Also would you mind providing the exact distro of Linux you're using, Debian 3.16.0-4 is probably just the kernel version.

Mirabis commented 9 years ago

No longer have the vm, as some ghost process spawned ;S

Debian 8 / Jessie , don't remember much more :(

nickjj commented 9 years ago

Ok thanks, Jessie is enough information.