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.
psycopg2 Python Library for AWS Lambda This is a custom compiled psycopg2 C library for Python. Due to AWS Lambda missing the required PostgreSQL libraries in the AMI image, we needed to compile psycopg2 with the PostgreSQL libpq.so library statically linked libpq library instead of the default dynamic link.
psycopg2-binary and psycopg2 both give us the same code that we interact with. The difference between the two is in how that code is installed in our computer.
Python 3 module for PostgreSQL psycopg is a PostgreSQL database adapter for the Python3 programming language (just like pygresql and popy.) This is version 2, a complete rewrite of the original code to provide new-style classes for connection and cursor objects and other sweet candies.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With