Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am on a django project where I want to use the python implementation of the mapserver mapscript library. I was able to install mapserver and python-mapscript from source.

However, due to the project setup I am forced to run django in a virtualenv that does not allow site-packages in my virtual environment.

Since mapscript is installed as a global site-package my django app can't see the mapscript installation. When I try to install mapscript through pip install mapscript I get an error 'mapserver.h' file not found.

So how can I install python-mapscript in my virtual environment?

I thought of copying the installed egg into my virtual environment, but not sure if that is possible.

share|improve this question
Related: github.com/mapserver/mapserver/issues/4267 –  Chad Cooper Jan 17 '14 at 14:04
You can't install site-packages in your virtualenv? That's the whole point of using a virtualenv. –  Chad Cooper Jan 17 '14 at 14:07
I am not trying to install the site-package per se in the virtualenv. I just wanted to point out that my installation works fine outside virtualenv, but I don't know how do an installation within it. –  yellowcap Jan 17 '14 at 16:12
Ohhh. So when you are doing pip install mapscript are doing it from within the activated virtualenv (source bin/activate) and getting the error that mapserver.h is not found? –  Chad Cooper Jan 17 '14 at 18:34
Yes that's exactly it, outside the virtualenv I was able to install mapscript from source, but in the virtualenv I dont konw how to do that and pip does throw that error. –  yellowcap Jan 18 '14 at 13:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.