Error whie install psycopg2 on ubuntu server 16.04 - django

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
---------------------------------------- ERROR: Command errored out with exit status 1: /home/mosi/venv/bin/python3.6 -u -c 'import
sys, setuptools, tokenize; sys.argv[0] =
'"'"'/tmp/pip-install-im9_x6c8/psycopg2/setup.py'"'"';
file='"'"'/tmp/pip-install-im9_x6c8/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-jyz3lis6/install-record.txt
--single-version-externally-managed --compile --install-headers /home/mosi/venv/include/site/python3.6/psycopg2 Check the logs for
full command output.

I had similar problems with psycopg2 some time too. Resolved it just by replacing psycopg2 with appropriate version of psycopg2-binary.

It may occur due to missing Postgres and/or Python libraries. Make sure you have essentials:
$ sudo apt-get install libpq-dev
$ sudo apt-get install python-dev

Related

When trying to install JWT package for Django getting error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I was working on django project where i had received an error
ImproperlyConfigured: Error importing middleware erp.middleware: "No module named jwt"
So that i tried to install jwt package by typing
pip install jwt
which leads to an error
build/temp.linux-x86_64-2.7/_openssl.c:3551:13: warning: ‘_ssl_thread_locking_function’ defined but not used [-Wunused-function]
static void _ssl_thread_locking_function(int mode, int n, const char *file,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of cryptography
Command "/home/charles/.virtualenvs/virtualenvpython/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-hU6Fxe/cryptography/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-h5K4aB/install-record.txt --single-version-externally-managed --compile --install-headers /home/charles/.virtualenvs/virtualenvpython/include/site/python2.7/cryptography" failed with error code 1 in /tmp/pip-install-hU6Fxe/cryptography/
i dont what issue is going on please help me to solve this issue
i am using ubuntu 18.04 LTS
python 2.7.15rc1
django 1.3.7
Try these commands
sudo apt-get install python-dev
sudo apt-get install libffi-dev
I will suggest that use the latest version of python and Django.

issues with: pip install fiona

I have some issues to install fiona on ubuntu 14.04
I always get the error
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-b4ng2wm0/fiona/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-uj6y8dyt-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-b4ng2wm0/fiona/
I already tried: sudo -H pip install fiona as well as sudo pip install -U setuptools, python -m pip install fiona, sudo apt-get install python-software-properties, sudo add-apt-repository ppa:ubuntugis/ppa
Any other idea what could be tried out?
Many thanks in advance.

Installing scrapy in Lubuntu using pip install scrapy (or sudo ) and getting the following error

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-nExfhn/cryptography/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-dpob_w-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-nExfhn/cryptography/
So I have tried :
1) pip install scrapy (with pip 9.0.1 so no need to update)
2) sudo pip install scrapy (still getting the same error)
I have setup the scrapy framework in Windows environment but in Linux seems different and I also get this Cryptography error.

Python - pip install markupsafe

So i want to install markupsafe and get this following error:
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\
\users\\appdata\\local\\temp\\pip-build-yb_vy0\\markupsafe\\setup.py';ex
ec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'
), __file__, 'exec'))" install --record c:\users\appdata\local\temp\pip-h
xgnlp-record\install-record.txt --single-version-externally-managed --compile" f
ailed with error code 1 in c:\users\appdata\local\temp\pip-build-yb_vy0\m
arkupsafe\
anyone got an idea how to fix it?
you need install Microsoft Visual C++ Compiler for Python 2.7 if you are using windows else sudo apt-get install gcc gcc-c++ if is not OS windows

pip install python-novaclient is failing due to netifaces.c

I'm trying to install OpenStack python novaclient using pip install python-novaclient
This task fails: netifaces.c:185:6 #error You need to add code for your platform
I have no idea what code it wants.
Does anyone understand this?
I also had this problem, and resolved by
sudo yum install python-devel python-pip
sudo yum -y install gcc
Same issue in awx_task container in AWX project (Centos 7), trying to execute
pip install python-openstackclient
Error was:
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-LTchWP/netifaces/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-86uBIZ-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-LTchWP/netifaces/
Solved with:
yum install python-devel python-pip gcc
Hope it will help someone!
This has to do with the order that libraries are imported in the netifaces setup.py and is fixed in version 10.3+ (which you need to install from source). Here's how to install 10.4 (current latest release):
mkdir -p /tmp/install/netifaces/
cd /tmp/install/netifaces && wget -O "netifaces-0.10.4.tar.gz" "https://pypi.python.org/packages/source/n/netifaces/netifaces-0.10.4.tar.gz#md5=36da76e2cfadd24cc7510c2c0012eb1e"
tar xvzf netifaces-0.10.4.tar.gz
cd netifaces-0.10.4 && python setup.py install
I landed on this question while doing something similar:
pip install rackspace-novaclient
And this is what my error looked like:
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-G5GwYu/netifaces/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Jugr2a-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-G5GwYu/netifaces
After reading the entire output logs, I realized I was missing "gcc" and just needed to install it.
On CentOS 7, my fix was:
yum -y install gcc && pip install rackspace-novaclient