Can't install psycopg2 with pip in virtualenv on Mac OS X 10.7

can band
can definition
can you
can bus
can synonym
can noun meaning
can (tago mago)
can ege bamyasi

I am following Heroku's tutorial to deploy a Django app: http://devcenter.heroku.com/articles/django#prerequisites.

Everything is working fine until I get to this part:

$ pip install Django psycopg2

I can install Django by itself, but the probelm is with psycopg2.

I keep getting this error:

ld: library not found for -lpq

collect2: ld returned 1 exit status

ld: library not found for -lpq

collect2: ld returned 1 exit status

lipo: can't open input file: /var/folders/_4/p6l0y0t51hd4xbq7llbyshmw0000gn/T//cc0L10mI.out (No such file or directory)

error: command 'gcc-4.2' failed with exit status 1

I've installed PostgreSQL 9.1 on my machine.

Also, in the output, there are bunch of lines like this:

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.4 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090004 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/include -I/usr/include/postgresql/server -c psycopg/typecast.c -o build/temp.macosx-10.6-intel-2.7/psycopg/typecast.o

I'm not really sure what it means, but I do notice that it has "macosx-10.6" in it so I'm wondering if that could be the issue? I'm on 10.7.

Thanks in advance for your help.

Refer to official installation guide of psycopg:

Installing on Mac OS X As a first option, please consider using a packaged version of Psycopg from Fink or MacPorts.

If you still want to build Psycopg from source, take a look at these articles.

Can (band), can definition: 1. to be able to: 2. used to say that you can and will do something: 3. to be allowed to: . Learn more. can - WordReference English dictionary, questions, discussion and forums. All Free.

Just would like to share. The following code worked for me:

env LDFLAGS='-L/usr/local/lib -L/usr/local/opt/openssl/lib
-L/usr/local/opt/readline/lib' pip install psycopg2==2.5.2

I am using macOS Sierra and psql 9.6.1.

I got the lib path from the pg_config command.

Can, Can definition is - be physically or mentally able to. How to use can in a sentence . can vs. may. Rutgers Canvas is pleased to announce the integration of Flipgraid, a free video discussion platform from Microsoft that helps educators see and hear from every student in class and foster a fun and supportive social learning environment.

First, download Postgres.app.

Then, before running pip install psycopg2, put the binary in your path:

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin

NOTICE:

9.3 stands for version and will differ over time.

CAN, Nas' official music video for 'I Can'. Click to listen to Nas on Spotify: http://smarturl Duration: 4:27 Posted: 22 Mar 2011 We would like to show you a description here but the site won’t allow us.

Install postgres with brew:

brew install postgres

Then, in your virtualenv install psycopg2 with this command:

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install psycopg2

Can, 1.4Used to indicate that something is typically the case. 'antique clocks can seem out of place in modern homes'. More example sentences. Forgot Password? Enter your Email and we'll send you a link to change your password.

The workaround is to intsall 'psycopg2-binary' package

Nas - I Can (Official Video), VerbEdit. can (third-person singular simple present can, present participle -, simple past could, past participle (obsolete except in adjectival use) couth). The Climate Action Network (CAN) is a worldwide network of over 1300 Non-Governmental Organizations (NGOs) in over 130 countries working to promote government and individual action to limit human-induced climate change to ecologically sustainable levels.

Can, Can I still go to work? Yes. People living inside or outside areas with restrictions in place can travel in and out for work. Workplaces must implement COVID-19� Can-Am offers a complete lineup of Off-Road vehicles (ATV, Side-by-Side) and 3-wheel motorcycles (Spyder or Ryker). Choose your playground now and enjoy the Can-Am World!

can, Can Trump ban TikTok? What the executive order means – explained. The move requires TikTok and WeChat to find new owners or shut down,� Access Canvas, get training, find support, look-up grades, and download apps. Students and faculty use canvas to complete and administer course materials.

FAQ on local restrictions, We would like to show you a description here but the site won’t allow us.

Comments
  • This worked for me: stackoverflow.com/questions/49025594/…
  • Ok, I just installed psycopg2 using macports in the virtualenv. I'm guessing this does the same thing that pip install does in the tutorial? As in, I would just replace this step? Reason I'm asking is because the app is still failing when I launch it. When I type Heroku Logs, this is one of the lines I get: raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
  • Using MacPorts to install won't work inside a virtualenv environment. To get your app working, you should check out those articles about building from source :)
  • Ok, I followed the instructions in one of those articles: blog.timc3.com/2010/08/20/psycopg2-os-x-_pqbackendpid, and I got psycopg2 to install on my machine. However, i'm still getting the same error within the virtualenv environment. I'm not too sure how I would build from source within a virtualenv.
  • Did you activated your virtualenv before running the last command python setup.py install ?
  • That worked! Thank you! A more explicit version for those wondering: I recreated the hellodjango directory and went through the steps, and instead of doing 'pip install psycopg2', I just downloaded psycopg2-2.4.4.tar.gz and installed it using "python setup.py install".
  • this was your first answer to SO, and it works great. Thank you for taking the time to put it here. This solution works to install psycopg2 within a virtualenv with postgres and dependencies installed with brew.
  • pg_config --ldflags will give you the specific path for your setup.
  • Works for me on macos 10.14.4 with python 3.7.2 and postgres 11.2. Thanks!
  • This solution works for me in Mojave 10.14.3. Thanks!
  • With last version of psycopg2 (2.8.4) on last version of MAC OS X (v10.15.4) env LDFLAGS='-L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib' pip install psycopg2==2.8.4
  • Thanks, I found this reply most useful, as it does not require MacPorts or any other tools.