update PostgreSQL client library to 9.1 - python

I am installing psycopg2 using this command:
pip3 install psycopg2
But the output is:
./psycopg/psycopg.h:30:2: error: #error "Psycopg requires PostgreSQL
client library (libpq) >= 9.1"
My pg_config version: pg_config --version is PostgreSQL 8.4.20. How to upgrade PostgreSQL client library? I am searching from Google, but no method to guide me. Python version: 3.5.0.

I guess you need to install it according to these instructions - https://www.postgresql.org/download/linux/redhat/.

Upgrade pip version 7.1.2 to version 18.1 solve this problem:
pip3 install --upgrade pip
Execute this command to install psycopg2:
pip3 install psycopg2

Related

Error trying to install python package Box2D

I'm trying to install version 2.3.10 of package Box2D via pip. However pip returns the following error message:
ERROR: Could not find a version that satisfies the requirement Box2D==2.3.10 (from versions: 2.0.2b1, 2.3b0, 2.3.2)
It looks as though pip does not know about the existence of any version more recent than 2.3.2. However, from this link it seems clear that it should. Any ideas?
Box2D 2.3.10 provides wheels for Python 2.7 and 3.5 up to 3.8. No wheels for 3.9 or 3.10 and no source code.
Version 2.3.2 has only source code.
So either you use version 2.3.2 or downgrade to Python 3.8 or install using conda or install from Github:
pip install "git+https://github.com/pybox2d/pybox2d.git#2.3.10#egg=Box2D-2.3.10"
Or install from Github release:
pip install https://github.com/pybox2d/pybox2d/archive/refs/tags/2.3.10.tar.gz
Upd It also requires swig so I tried
sudo apt install swig &&
pip install "git+https://github.com/pybox2d/pybox2d.git#2.3.10#egg=Box2D"
and it worked for me.

Problem installing MariaDB Python bindings on Raspberry Pi OS--how to get the latest Connector/C?

I am trying to use MariaDB with Python on a Raspberry Pi 4 with the 64 bit OS. After much trial and error I cannot solve the issue of a newer Connector/C version being required. The steps I took so far:
sudo apt update
sudo apt upgrade
sudo apt install mariadb-server
This installed MariaDB just fine and I can use it in a terminal. In order to install Python bindings I first installed
sudo apt install libmariadbclient-dev
but then when I try to install the Python module with
pip3 install mariadb
There is an error:
Collecting mariadb
Using cached https://files.pythonhosted.org/packages/71/a4/2d73d007571a5df9369eed9166150c7e067eb883cbd9ec3f97c7a48be660/mariadb-1.1.0.tar.gz
Complete output from command python setup.py egg_info:
MariaDB Connector/Python requires MariaDB Connector/C >= 3.2.4, found version 3.1.13
I wonder why version 3.2.4 is required in the first place. According to the documentation, it was just released 10 days ago: https://mariadb.com/kb/en/about-mariadb-connector-c/
There is no repository for Raspberry Pi OS. How can I install the newest Connector/C?
The answer for me was not to get the newest Connector/C, but to install an older version of the mariadb module. In my case going back to 1.0.7 was sufficient. It can be installed with
pip3 install -Iv mariadb==1.0.7
However, it seems like the newest pip version automatically falls back to the latest compatible module, so try upgrading pip first:
python3 -m pip install --user --upgrade pip
And then run the simpler command (without specific version number):
python3 -m pip install mariadb

Connect mysql database with django

I am a begginer in django, i try to connect mysql database with django but when i write python manage.py migrate in cmd i see this error: mysqlclient 1.3.13 or newer is required yo have 0.9.3
so i decide to upgrade mysql client using this command:pip install mysqlclient --upgrade and i get this output:
https://i.stack.imgur.com/bq7Jn.jpg
https://i.stack.imgur.com/nYGSQ.jpg
https://i.stack.imgur.com/u8wzN.jpg
How to fix it?
Try to install using wheel
pip install wheel
Download the mysqlclient from
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
for python 3.X
pip install mysqlclient-1.3.8-cp36-cp36m-win_amd64.whl
for python 2.x
pip install mysqlclient-1.3.8-cp27-cp27m-win_amd64.whl
this error commonly occurs in windows if not install visual studio and other tools.if you work in Django + windows then install visual studio latest version.

error to import MySQLdb in python

I have error to connect existing mysql database in python and i unable to do
pip install mysql command
import MySQLdb
db = MySQLdb.connect(host='10.10', port=3306, user='system', passwd='xyz' db='Reporting')
print(db)
I want to retrieve the data from mysql database in python.
Use pip install MySQL-python instead
You need to install the dependencies before installation with pip.
apt-get install python-dev libmysqlclient-dev
And than, the installation with pip like the answer of Zart should work.
pip install MySQL-python
The above answer is only for Linux System.
For Windows you can download the .whl file from here mysqlclient and install it. Please download the right version. win32 for 32 bit. amd64 for 64 bit. cp27 for python 2.7, cp34 for python 3.4, cp35 for python 3.5

pyodbc 3.0.10 fails to install OS X 10.10

I'm trying to install the latest version of pyodbc on os x yosemite.
I can get 3.0.7 to install (but on python3 this reports as 3.0.0 unsupported)
I am getting the following errors when running:
sudo python3 setup.py build install
ld: library not found for -lodbc
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang++' failed with exit status 1
I have got an ODBC driver install and can use this with python2 and python2 reports 3.0.7 is the version used (same download!)
It looks like something has changed on the compilation (previously I've had to copy all the .h files to my /usr/include from the Iodbc download.
I'm now a bit stuck
Any help please ? I'm not getting any answers on the github project.
I believe you may need to do a pip install of the ZIP file directly. This works for me:
pip install https://pyodbc.googlecode.com/files/pyodbc-3.0.7.zip
That should install 3.0.7 directly. Here's an example, using a virtualenv with virtualenvwrapper:
[vagrant#vagrant test]$ mkvirtualenv myvenv
(myvenv)[vagrant#vagrant test]$ pip install https://pyodbc.googlecode.com/files/pyodbc-3.0.7.zip
Collecting https://pyodbc.googlecode.com/files/pyodbc-3.0.7.zip
Using cached https://pyodbc.googlecode.com/files/pyodbc-3.0.7.zip
Installing collected packages: pyodbc
Running setup.py install for pyodbc
Successfully installed pyodbc-3.0.7
(myvenv)[vagrant#vagrant test]$ pip freeze
pyodbc==3.0.7
Since that works, you could try to install the newer 3.0.10 (replace pip with pip3 in your case; most people will be using pip):
pip uninstall pyodbc
pip install pyodbc==3.0.10
Give that a try. If it doesn't work, I'd stick with 3.0.7 for now. There is no install ZIP for 3.0.10 (yet), as the pyodbc project is being moved to GitHub from Google Code (which is closing).

Categories