I was trying to create a Python Virtual Environment for some initial GIS development. I installed pip and virtualenv and then tried the following commands from the Linux-Terminal to accomplish the task

$ cd Test/virtualenvs_for_test
$ virtualenv --no-site-packages postgis-cb-env
$ source postgis-cb-env/bin/activate
$ pip install gdal

But found the following error message:

error: command 'gcc' failed with exit status 1

Cleaning up... Command /home/gislinux/Test/virtualenvs/postgis-cb-env/bin/python -c "import setuptools, tokenize;file='/home/gislinux/Test/virtualenvs/postgis-cb-env/build/gdal/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-h8eZSu-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/gislinux/Test/virtualenvs/postgis-cb-env/include/site/python2.7 failed with error code 1 in /home/gislinux/Test/virtualenvs/postgis-cb-env/build/gdal Traceback (most recent call last): File "/home/gislinux/Test/virtualenvs/postgis-cb-env/bin/pip", line 11, in sys.exit(main()) File "/home/gislinux/Test/virtualenvs/postgis-cb-env/local/lib/python2.7/site-packages/pip/init.py", line 185, in main return command.main(cmd_args) File "/home/gislinux/Test/virtualenvs/postgis-cb-env/local/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main text = '\n'.join(complete_log) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)

I have no sure idea what this error is exactly. Although initial web-hunting suggested a need to change encoding from ascii to utf8, but how?

1 Answer 1


You must install libgdal-dev and then install gdal with paths:

export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
  • Thx. I have installed libgdal-dev but now this new error is coming up Storing debug log for failure in /home/zia/.pip/pip.log. Any clue?
    – Zia
    Commented Sep 1, 2014 at 14:59
  • That "error" is not The error. It is just telling you about "some error" ocurred and details about that error can be inspected inside the /home/zia/.pip/pip.logfile.
    – jgomo3
    Commented Jan 27, 2015 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.