Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error pip install mariadb on ubuntu server

I try to install the mariadb module with pip install mariadb but it error like this.

Collecting mariadb
  Using cached https://files.pythonhosted.org/packages/15/73/250a30543f9987af2e3f7856f29917fa22580cd6b457b8e2df0d6d80b3f3/mariadb-1.0.1.tar.gz
    Complete output from command python setup.py egg_info:
    MariaDB Connector/Python requires MariaDB Connector/C >= 3.1.5, found version 3.0.3
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 2 in /tmp/pip-build-f3yri8cs/mariadb/

And what i have try is run pip install --upgrade setuptools then pip install mariadb but it still not working, so how can i fix the problem?

like image 585
Kaow Avatar asked Oct 23 '25 17:10

Kaow


1 Answers

I found the solution for this problem: So, to run pip install mariadb, I followed these steps:

I'm using python3.9, instead of olders versions,

Installing Python 3.9:

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.9

Installing Pip3:

sudo apt install python3-pip

Adding repo of mariadb:

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

If you receive some problens with apt-transport-https, install this:

sudo apt-get install -y apt-transport-https

Run these updates:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Now, you can install the newest Connector/c:

sudo apt-get install libmariadb3
sudo apt-get install libmariadb-dev

Finally, you can run:

sudo pip3 install mariadb

Should work just fine, sorry for the long post.

like image 121
Chico Tafarello Avatar answered Oct 26 '25 08:10

Chico Tafarello



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!