I have just created a virtual environment on my machine (I am running on ubuntu 18.04 LTS). I have the python version of 3.6.7 and now I want to install mysqlclient into my virtual environment.
After I do pip install mysqlclient it didn't work, instead it gave me errors saying;
Command "python.py egg_info" failed with error code 1 in /tmp/pip-install-zd21vfb3/mysqlclient/', and that the msql_config file is not found.
My setup tools are all up to date.
mysqlclient has a dependency on the mysql client & dev packages being installed. In order to fix this on ubuntu, you have to use apt-get to install a couple of mysql packages.
In your case, it looks like the missing mysql_config might be missing on your system. You can fix that by installing libmysqlclient-dev on ubuntu bionic.
In order to correctly install MySQLClient on a fresh Ubuntu 18.04 LTS you need to install each of the following:
# Replace python3.6 with which ever version of Python3 you are using
sudo apt-get install python3.6-dev
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
sudo apt-get install libssl-dev
The last one is often missed on answers but is required now.
Only then can you install it via pip. Also make sure to update pip so you are not using version 9 if that installs into your vevn.
I was getting the same error when building my docker container. I tried installing the following in sequence but did not work.
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
sudo apt-get install libssl-dev
Then this 👇 solved the problem.
sudo apt-get install default-libmysqlclient-dev
Check if you have already installed setuptools.
After that
in terminal
sudo apt-get install libmysqlclient-dev
Then(Keeping in mind to activate the virtual enviroment)
sudo pip3 install mysqlclient
Related
I've installed Python3.7 on Ubuntu using sudo apt-get install python3.7. Python3.7 installs, but the dist-packages folder is empty and pip and other packages cannot be installed.
Is there a way to build out the dist-packages folder?
You should install pip3 through apt too!
sudo apt install python3-pip
You could try and start again following the guide given by python or see if there's anything you've missed.
https://docs.python-guide.org/starting/install3/linux/
Also I'm not sure if this will work, but try sudo apt-get install python.
I am clueless here. I need to upgrade to python 3.8.0. So, I run this:
sudo apt-get install python3 3.8.0
But I get the following message:
As you can see. It writes "python3 is already the newest version". It is not.
Also, I get the "held broken packages" error after that. I am not sure if they are related.
you might have the newest version of tthat particular's repository.
try here:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.8
sudo apt install python3.8-distutils
python3.8 -m pip install --upgrade pip setuptools wheel
Problem
I am attempting to install mysqlclient via:
$ pip install mysqlclient
I receive the following error:
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-_kwgf7vk/mysqlclient/
Background
Python version: 3.6.6
OS: Ubuntu 18.04.1 LTS
Virtualenv: I receive the same error both inside and outside of my virtual environment
Question
How can I successfully install mysql?
I saw a similar post somewhere else. The solution was:
sudo apt-get install python3.6-dev libmysqlclient-dev
activate the virtual environment and execute command
pip install mysqlclient
I don't know if it's gonna help but i hope it will.
As the official PyPi documentation suggests you need to have the following dependent libraries preinstalled
sudo apt-get install python-dev default-libmysqlclient-dev python3-dev
after that you could do a pip install mysqlclient
for linux mint : python3.7
$ sudo apt-get install python3.7-dev libmysqlclient-dev
$ sudo apt-get install libssl-dev
and then
$ pip install mysqlclient
https://github.com/openai/gym/issues/757
I am very new to Ubuntu OS and Python as well. I want to install Django. But i dont have easy_install and I tried below command to install pip
sudo apt-get install python-pip
I got an error as below
Unable to locate package python-pip
I tried below command as well
sudo apt-get install python-pip
and i got error as below
E: Package 'python-setuptools' has no installation candidate
I am very confused in installing django, How to successfully install django
First update repositories
sudo apt-get update
then try
sudo apt-get install python-pip python-dev build-essential python-setuptools
if nothing, you can install pip and setuptools packages manually. Download them from PyPI.
Install pip
To install or upgrade pip, securely download get-pip.py.
Then run the following (which may require administrator access):
sudo python get-pip.py
If setuptools (or distribute) is not already installed, get-pip.py will install setuptools for you.
To upgrade an existing setuptools (or distribute), run pip install -U setuptools
Upgrade pip
On Linux or OS X:
sudo pip install -U pip
Then you can download django using pip,
sudo pip install django
Install
First you need make sure you have Python install, here I take 2.7.6 as example. For how to install Python, you can go check this link:
https://askubuntu.com/questions/443048/python-2-7-6-on-ubuntu-12-04-how-to
Then you can start install Django and setup database as follow:
sudo apt-get install python-django
sudo apt-get install mysql-server
sudo apt-get install python-mysqldb
You can find more configuration detail in this link
http://yuwenqing.org/?p=108
Also, for less pain in future develop, you should deploy your Django application in python virtualEnv, here are some detail of why you need virtualEnv.
http://yuwenqing.org/?p=126
After I installed Mariadb 10 the Mysql workbench and JPDB client both connect and work fine so next step was get programming with Python (using SQLAlchemy) which seems to require MySQL-python so I went to update that and got:
"mysql_config not found" I looked in the "usual places" and did not see a file...
So I followed some ideas from an earlier question on SO
and tried to install: apt-get install libmysqlclient-dev
which got me to:
The following packages have unmet dependencies:
libmysqlclient-dev : Depends: libmysqlclient18 (= 5.5.35-0ubuntu0.13.10.2) but 10.0.10+maria-1~saucy is to be installed
which kind of hits a brick wall for me
For Centos 7.0 install the following:
yum install mariadb-devel
For Fedora 23+:
dnf install mariadb-devel
Found it! The case is that mariadb has a compatible package, if you have the ppa setup as in http://downloads.mariadb.org/. Just
sudo apt-get install libmariadbclient-dev
Thanks to http://data-matters.blogspot.com/2013/08/install-mysql-python-with-mariadb.html
After this the mysql-python installs correctly
There's NO solution on Ubuntu 16.04
Doing:
sudo ln -s /usr/bin/mariadb_config /usr/bin/mysql_config
Worked for me.
Install the following library:
sudo apt-get install libmariadb-client-lgpl-dev
And create a symbolic link named mysql_config:
ln -s /usr/bin/mariadb_config /usr/bin/mysql_config
For Debian/Ubuntu PPA from https://downloads.mariadb.org/mariadb/repositories/
for MariaDB 10.1: apt-get install libmariadbclient-dev
for MariaDB 10.2: apt-get install libmariadb-dev
for MariaDB 10.3: apt-get install libmariadb-dev-compat
On Ubuntu 17.04 the following worked for me
sudo apt-get install default-libmysqlclient-dev
For Debian Jessie:
sudo apt-get install libmariadb-client-lgpl-dev
sudo ln -s /usr/bin/mariadb_config /usr/bin/mysql_config