Skip to content

GDAL python bindings not liking virtualenv #137

evz opened this Issue Oct 21, 2011 · 1 comment

1 participant

evz commented Oct 21, 2011

Yesterday when I was trying to set up the project on a Ubuntu VM (11.04 and later I tried 10.04), I kept running into the same issue when installing the requirements via pip. Basically, it seemed that, even though I had all the GIS libraries as well as PostgreSQL installed globally (using apt-get) the GDAL python bindings did not want to compile in the virtualenv. They complained about missing header files which I'm assuming were someplace in the VM since I had libgdal-dev installed and since I could install those bindings globally without a hitch.

I realize this is one of those things that this project doesn't have much control over but I thought I'd bring it up anyways just in case someone out there had recommendations as to how I should proceed.

evz commented Oct 21, 2011

For whatever it's worth, here's what I did to get the rig running by installing everything globally within my VM:

apt-get install git-core
apt-get install python-software-properties
add-apt-repository ppa:pitti/postgresql # PPA for PostgreSQL 9.0
add-apt-repository ppa:ubuntugis/ubuntugis-unstable # PPA for current GIS libs
apt-get update
apt-get install libgdal1-dev libgeos-dev proj python-dev libpq-dev postgresql-server-dev-9.0 postgresql-contrib-9.0 python-gdal mongodb mdbtools
apt-get install git-core
git clone
cd census/censusweb/
vi requirements.txt # Comment out GDAL line
pip install -r requirements.txt 
tar -xvf postgis-1.5.3.tar.gz
cd postgis-1.5.3/
make install
su - postgres # Switch to postgres superuser
### Inside pgsql shell
postgres=# create user censusweb with password 'Xy9XKembdu'; # Create new user to match the one in
postgres=# \q
### Back to bash 
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"
psql -d template_postgis -f /usr/share/postgresql/9.0/contrib/postgis-1.5/postgis.sql
psql -d template_postgis -f /usr/share/postgresql/9.0/contrib/postgis-1.5/spatial_ref_sys.sql
psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;"
psql -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;"
psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
exit # Switch back to root
python runserver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.