1

I am trying to get a Django app running on Azure and I would like to use a Postgres database that we already have in place. So I need to have the psycopg2 python package installed.

Note: I am on a Mac and deploying with git.

My requirements.txt is simple:

django==1.6.2
pytz
psycopg2

However it fails when it gets to psycopyg2 while trying to find postgres binaries.

remote: Downloading/unpacking psycopg2 (from -r requirements.txt (line 3))
remote:   Running setup.py (path:D:\home\site\wwwroot\env\build\psycopg2\setup.py) egg_info for package psycopg2
remote:
remote:     Error: pg_config executable not found.
remote:
remote:     Please add the directory containing pg_config to the PATH
remote:     or specify the full executable path with the option:
remote:
remote:         python setup.py build_ext --pg-config /path/to/pg_config build ...
remote:
remote:     or with the pg_config option in 'setup.cfg'.
remote:     Complete output from command python setup.py egg_info:
remote:     running egg_info
remote:
remote: creating pip-egg-info\psycopg2.egg-info
remote:
remote: writing pip-egg-info\psycopg2.egg-info\PKG-INFO
remote:
remote: writing top-level names to pip-egg-info\psycopg2.egg-info\top_level.txt
remote:
remote: writing dependency_links to pip-egg-info\psycopg2.egg-info\dependency_links.txt
remote:
remote: writing manifest file 'pip-egg-info\psycopg2.egg-info\SOURCES.txt'
remote:
remote: warning: manifest_maker: standard file '-c' not found
remote:
remote:
remote:
remote: Error: pg_config executable not found.
remote:
remote:
remote:
remote: Please add the directory containing pg_config to the PATH
remote:
remote: or specify the full executable path with the option:
remote:
remote:
remote:
remote:     python setup.py build_ext --pg-config /path/to/pg_config build ...
remote:
remote:
remote:
remote: or with the pg_config option in 'setup.cfg'.

I have tried adding the Windows Postgres binaries to my project at /pgsql and then updating the configurations in Azure to include that folder. I was hoping to be able to append to PATH, but the configure tab is telling me that is not allowed.

Seems like I might need a startup script or some other way to get these dependencies loaded. I couldn't find too many references on how to do this from a Mac, only Visual Studio.

Do I just need to move to a VM?

4
  • Here is psycopg for Windows. stickpeople.com/projects/python/win-psycopg . Also windows Azure provides Linux machines whre you should not have such issues. Commented Dec 2, 2014 at 14:23
  • Yea, how do I get win-psycopg installed? I have been looking into updating the deployment.sh file to do it. Ideally, I don't want to use a VM. Commented Dec 3, 2014 at 15:29
  • @dds1024: did you amend your requirements.txt to do this in the end? I'm struggling with a similar problem. Commented Nov 27, 2015 at 13:50
  • Can't remember now. I tried seemingly everything and support was no help. I was going to just move to VM's but decided to just stay on AWS. Sorry I can't help. Commented Dec 1, 2015 at 16:18

1 Answer 1

3

There is a psycopg2-windows. Example for Python 2.7:

pip install git+https://github.com/nwcell/psycopg2-windows.git@win32-py27#egg=psycopg2

Also there are instruction for installation on win-psycopg ptoject home page.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.