I am trying to get the latest version of psycopg2 on my aws instance. I noticed that the latest version was 2.4.6 but I could only get 2.0.14 on aws. Is there a way to get the latest version? There are some features I need that are not supported in the earlier versions.
Working answer as of November 2022:
sudo yum install postgresql-devel python3-devel
pip install wheel
pip install psycopg2
If you are still using Python 2 then use python-devel
instead of python3-devel
.
The pip install wheel
is not strictly necessary, but psycopg2
prefers it and it wasn't installed yet in my environment.
This works for me in Amazon aws-cli/1.9.11 Python/2.7.10 Linux/4.1.10 and Ubuntu 14
If pip not installed in your Amazon AWS machine type:
$ sudo yum install python-pip
and then type below commands:
$ sudo yum update
$ sudo yum install libpq-dev python-dev
$ sudo pip install psycopg2
Then you will get message like below :
You are using pip version 6.1.1, however version 7.1.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. Collecting psycopg2 Downloading psycopg2-2.6.1.tar.gz (371kB) 100% |████████████████████████████████| 372kB 1.3MB/s Installing collected packages: psycopg2 Running setup.py install for psycopg2 Successfully installed psycopg2-2.6.1
If pip not installed in your Ubuntu machine type:
$ sudo apt-get install python-pip
and then type below commands:
$ sudo apt-get update
$ sudo apt-get install libpq-dev python-dev
$ sudo pip install psycopg2
Then you will get message like below :
You are using pip version 6.1.1, however version 7.1.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. Collecting psycopg2 Downloading psycopg2-2.6.1.tar.gz (371kB) 100% |████████████████████████████████| 372kB 1.3MB/s Installing collected packages: psycopg2 Running setup.py install for psycopg2 Successfully installed psycopg2-2.6.1
sudo yum install postgresql-devel
–
Vernonvernor If you need a more recent version of psycopg2 on your EC2 instance, you can install it directly with pip using: $ pip install psycopg2
You may need to first install the python-dev
and libpq-dev
libraries as explained in this StackOverflow question.
© 2022 - 2024 — McMap. All rights reserved.