I'm getting the following error message while running my Django REST project with MySQL database in pipenv.
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
This seems like a very common problem (please don't mark as duplication), but after trying all the possible solutions I'm still getting the same issue..
A few things I tried:
pip3 install mysqlclient
pip3 install python3.6-dev
pip3 install mysql-client
pip3 install libsqlclient-dev
pip3 install libssl-dev
What could still be the problem?
It's a Linux Ubuntu 18.04 server with Plesk. Python version 3.8.
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.
another way
install the follwing packages.
sudo apt-get install python3.8-dev
sudo apt-get install mysql-client
sudo apt-get install libsqlclient-dev
sudo apt-get install libssl-dev
other method
pip install pymysql
Then, edit the init.py file in your project origin dir(the same as settings.py)
add:
import pymysql
pymysql.install_as_MySQLdb()
You should install libmysqlclient-dev: sudo apt-get install libmysqlclient-dev
I had to install this.
sudo apt install libpython3.8-dev
Now it works.
Error:
raise AttributeError("Could not find PyAudio; check installation")
AttributeError: Could not find PyAudio; check installation
I tried all of these commands:
sudo pip install pyaudio,
sudo apt-get install python-pyaudio ,
sudo pip install pyaudio ,
sudo pip install --upgrade pyaudio.
First, undo what you have done.
Then try to install it following their documentation for Debian based versions:
$ sudo apt install portaudio19-dev python-all-dev
followed by
$ sudo apt install python-pyaudio for python 2 version
OR
$ sudo apt install python-pyaudio for python 3 version.
I am new at using raspberry pi.
I have a python 3.4 program that connects to a database on hostinger server.
I want to install mysql connector in raspberry pi.I searched a lot but I was not able to find answers . any help would be appreciated
Before you install, it is important to run update and upgrade;
sudo apt-get update
sudo apt-get upgrade
Either install connector for Python 2;
sudo apt-get -y install python-mysql.connector
Or install connector for Python 3;
sudo apt-get -y install python3-mysql.connector
I found no way to install mysql-connector-python that I used with windows.
for python 3.4 I used the command
sudo python3 -m pip install pymysql
for python 2.7 you can use following commands
sudo apt-get install python-mysqldb
or
sudo apt-get install python-pip
pip install pymysql
Just use $sudo apt-get install python3-mysqldb and it works on pi-3.
After upgrading to Ubuntu 14.04 Mysql 5.5.9 is incompatible with some of my scripts. I need to re-install Mysql 5.1. I tried research online but no luck
When I do
apt-get install mysql-server-5.1 mysql-client-5.1
Package mysql-server-5.1 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
mysql-server-core-5.5:i386 mysql-server-5.5:i386 mysql-server-core-5.5
mysql-server-5.5
E: Package 'mysql-server-5.1' has no installation candidate
E: Package 'mysql-client-5.1' has no installation candidate
Tried to find multiverse source but no luck,
Anyone?
Uninstall existing mysql
sudo apt-get remove mysql-server
Download the MySQL APT repository config tool (as root)
wget http://dev.mysql.com/get/mysql-apt-config_0.3.5-1debian8_all.deb
Install the MySQL APT repository config tool
dpkg -i mysql-apt-config_0.3.5-1debian8_all.deb
Update APT
apt-get update
Install the server
apt-get install mysql-community-server
Thereby you can select the server you need and install
I am using Fedora 14 and I have MySQL and MySQL server 5.1.42 installed and running.
Now I tried to do this as root user:
gem install mysql
But I get this error:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
What's wrong here? In installed ruby 1.8.7. and the latest rubygems 1.3.7.
For those who may be confused by the accepted answer, as I was, you also need to have the ruby headers installed [ruby-devel].
The article that saved my hide is here.
And this is the revised solution (note that I'm on Fedora 13):
yum -y install gcc mysql-devel ruby-devel rubygems
gem install -y mysql -- --with-mysql-config=/usr/bin/mysql_config
For Debian, and other distributions using Debian style packaging the ruby development headers are installed by:
sudo apt-get install ruby-dev
For Ubuntu the ruby development headers are installed by:
sudo apt-get install ruby-all-dev
If you are using a earlier version of ruby (such as 2.2), then you will need to run:
sudo apt-get install ruby2.2-dev
(where 2.2 is your desired Ruby version)
Red Hat, Fedora:
yum -y install gcc mysql-devel ruby-devel rubygems
gem install -y mysql -- --with-mysql-config=/usr/bin/mysql_config
Debian, Ubuntu:
apt-get install libmysqlclient-dev ruby-dev
gem install mysql
Arch Linux:
pacman -S libmariadbclient
gem install mysql
For anyone reading this in 2015: if you happened to install the package ruby2.0, you need to install the matching ruby2.0-dev to get the appropriate Ruby headers. The same goes for ruby2.1 and ruby2.2, etc. For example:
$ sudo apt-get install ruby2.2-dev
it seems that the
yum install ruby-devel
was enough for me to perform
gem install datamapper
afterwards.
It's possible that you will need to install another packages:
yum install gcc gcc-c++
to be able to build native extensions
MAC users may face this issue when xcode tools are not installed properly.
Below is the command to get rid of the issue.
xcode-select --install
I found the solution here.
# yum install mysql-devel gcc make
# gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
This post helped me. Thanks a lot.
On Linux (Ubuntu 12.10) I needed to run
sudo apt-get install ruby
sudo apt-get install rubygems
sudo apt-get install ruby-dev
before I could succesfully run
sudo gem install jekyll
If you have gem installed and ruby and not able to install rails, then install ruby dev lib.
sudo apt-get install ruby-dev
It works for me. I have tried the different solution.
Red Hat, Fedora:
sudo dnf -y install gcc-c++ redhat-rpm-config ruby-devel gcc mysql-devel rubygems
For those that are still experiencing problems, like I have(I am using Ubuntu 16.04), I had to put in the following commands in order to get some gems like bcrypt, pg, and others installed. They are all similar to the ones above except for one.
sudo apt-get install ruby-dev -y
sudo apt-get install libpq-dev -y
sudo apt-get install libmysqlclient-dev
sudo apt-get install build-essential patch -y
This allowed me to install gems like, PG, bcrypt, and recaptcha.
My initial solution was to resolve the above errors by installing ruby-devel, patch and rubygems.
My issue was a bit different as bcrypt 3.1.11 still had issues compiling and installing on Fedora 23. I needed additional packages. So after ensuring I had the above installed, I was still having issues:
gcc: error: conftest.c: No such file or directory
gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
From here I had to do the following:
I ensured that I wasn't lacking any C compiler tools sudo dnf group install "C Development Tools and Libraries"
Then I ran sudo dnf install redhat-rpm-config to resolve the gcc issue listed above.
You can find a write up here on Fedore Project. You may also find answers to other needs as well.
sudo apt-get install ruby-dev
This command solved the problem for me!
You need following packages instaled:
ruby-dev
gcc
libffi-dev
make
Here's the command for debian distro:
sudo apt install gcc ruby-dev rubygems libgmp-dev libgmp3-dev make
in openSUSE:
zypper in ruby-devel
Works to me :)
It's necessary to install redhat-rpm-config to. I guess it solve your problem!
This worked for me:
yum -y install gcc mysql-devel ruby-devel rubygems
You might have messed up with the RVM.
Try to do:
\curl -sSL https://get.rvm.io | bash -s stable --rails
Just to add path to ruby.h file in my PATH
for example:
export PATH=$PATH:/usr/src/ruby-xxxxxx