ImportError: No module named fabric when run mysqlfabric command - mysql

My VM is using Ubuntu 14.04.
I followed the official manual to install MySql Fabric:
First, install Connector/Python GA
Next, install MySQL Utilities 1.5.6
However, when I tried to test the mysqlfabric help command, it threw error like:
Traceback (most recent call last):
File "/usr/bin/mysqlfabric", line 33, in <module>
from mysql.fabric import (
ImportError: No module named fabric
Based on this SO question, after upgrading Ubuntu from 15.04, the problem can be resolved, but I want to run fabric on Ubuntu 14.04.
I tried to re-installed Connector/Python, MySQL Utilities, also checked compatibility with Ubuntu version 14.04, searched on the Internet & SO for similar problems. But still cannot resolve the issue.
Thanks a lot for your help!

Not quite sure what is the problem with installing using .deb file.
But after many (painful) tries, I figured out that re-installing MySQL Utilities from source code can resolve the issue.

Related

Django MySQL throws an error, Library not loaded: /usr/local/opt/mysql#5.6/lib/libmysqlclient.18.dylib When I upgraded from 5.6 to 5.7 mysql

Yes, this seems like a common error. But something else is wrong with my environment. I have upgraded from MySQL 5.6 version to 5.7.
I can access mysql5.7 by typing mysql into the console.
I have updated the DYLD_LIBRARY_PATH to reflect new 5.7 location
git:(parent-child) ✗ echo $DYLD_LIBRARY_PATH
/usr/local/opt/mysql#5.7/lib/:
But the error for reason still says it is trying to load from 5.6 version.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/Users/vineeth/envs/automize2.0/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 16, in <module>
import MySQLdb as Database
File "/Users/vineeth/envs/automize2.0/lib/python3.7/site-packages/MySQLdb/__init__.py", line 18, in <module>
from . import _mysql
ImportError: dlopen(/Users/vineeth/envs/automize2.0/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/mysql#5.6/lib/libmysqlclient.18.dylib
Referenced from: /Users/vineeth/envs/automize2.0/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so
Reason: image not found
Notice the error says it still is trying locate /usr/local/opt/mysql#5.6/lib/libmysqlclient.18.dylib
I have reinstalled almost everything since this error came.
Tried several solutions
Python mysqldb: Library not loaded: libmysqlclient.18.dylib
rails + MySQL on OSX: Library not loaded: libmysqlclient.18.dylib
Nothing seems to change its reference.
How do I make it refer to the newer one which is in /usr/local/opt/mysql#5.7/lib/
Also reinstalled mysqlclient with pip but still no luck.
Help is welcome. Been struggling since a day.
To expand my comment as an answer:
Pip compiles source packages into wheels that get cached into your local Pip cache. However, it has no knowledge of the "ambient" dependencies that may affect how the binary package gets compiled, in this case the MySQL shared library.
Recreating the virtualenv won't directly help, since Pip will use the cached binary wheel (to save you from a recompilation).
You could:
use pip install --no-cache-dir to have Pip not use the cache at all (though the "tainted" wheel will remain in your cache)
nuke the whole Pip cache from orbit
see what comes out of https://github.com/pypa/pip/issues/2882 / https://github.com/pypa/pip/issues/4685 ...

mySQL legacy database with Django - error due to incorrect version of mysqlclient using XAMPP

I am getting the following error on trying to install mysqlclient. Note: Python version: Python 3.7.3
ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
I used the following stackoverflow q/a to help me, but got the above version error.
Error loading MySQLdb Module 'Did you install mysqlclient or MySQL-python?'
The official Django docs are very sparse on their instructions and do not even mention the need to install mysql client. I also notice that there are various different suggestions.
I have two questions:
What is the best way to connect an existing/legacy mysql database to Django (what steps should I follow before being able to type the final command: python manage.py inspectdb
What is the best way to use an existing mysql database and use it with Django.
Note: I currently have XAMPP installed and hope to be able to connect to it on a local host from there.
Fix 1: I have tried a fix that involves installing a wheel, going to this website and downloading the version that seems to correspond best to my python version and 64 bit (https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient) but again get the following error:
C:\Users\USERNAME\Desktop\djangottio\djangottio>pip install mysqlclient-1.4.2-cp37-cp37m-win_amd64.whl
RESULTANT ERROR from Fix 1:
mysqlclient-1.4.2-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform.
I have solved fix 1's error (see above) by using this very helpful post: https://stackoverflow.com/a/36158157/5074035
But....on trying the python manage.py inspectdb command it still comes up with the error:
ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required;

Installing MySQLDB for python 2.7 using pip on Windows 7 64bit

I have spent hours trying multiple approaches to install MYSQLDB module for python, and no success.
My python version: 2.7.6
Django - 1.10.3
OS: Windows 7 64-bit
MySQL connector - MySQL Connector C 6.0.2
Currently I have an error in my project, namely:
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
I have tried to install mysqldb running the following command:
pip install mysql-python
It ran successfully, but the error still persisted. Then I tried to run
pip install MySQL-python
and I am getting Cannot open include file config-win.h.
I came across this post, but I don't understand the idea of the answer, specifically, I can't figure out where I should look for the mentioned files site.cfg and setup_windows.py. There are no such files in C:\Program Files\MySQL\MySQL Connector C 6.0.2\include
Finally, I tried to install MySQLDb using wheels running
pip install mysqlclient-1.3.9-cp27-cp27m-win_amd64.whl command, I end up with
mysqlclient-1.3.9-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform error.
I have lost my hope. Help please !!!
Try to install 32 bit version mysqlclient-1.3.9-cp27-cp27m-win32.whl
If it doesn't work try to install it from (where you can find compiled windows libraries):
http://www.lfd.uci.edu/~gohlke/pythonlibs/

Package install in Octave erros - Ubuntu 12.04

ok this seems like a really silly question but for some reason I'm having issues installing a package into octave (using Ubuntu 12.04). I used the command:
pkg install signal-1.3.0.tar.gz
and got the error:
warning: file signal-1.3.0.tar.gz does not exist
But the file does exist and I have the tar file in the same folder as octave. I can't work out what the issue is... any ideas?? Thanks in advance!!

Installing MySQLdb Python Architecture Error

I am trying to install MySQLdb python and am having trouble getting it to work because I get an architecture error.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.6-x86_64/egg/MySQLdb/__init__.py", line 19, in <module>
File "build/bdist.macosx-10.6-x86_64/egg/_mysql.py", line 7, in <module>
File "build/bdist.macosx-10.6-x86_64/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/jkeesh/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-x86_64.egg-tmp/_mysql.so, 2): no suitable image found. Did find:
/Users/jkeesh/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-x86_64.egg-tmp/_mysql.so: mach-o, but wrong architecture
This has been a common question, and I have read many, many sources including:
Python MySQL wrong architecture error
http://www.mechanicalgirl.com/view/installing-django-with-mysql-on-mac-os-x/
Django + MySQL on Mac OS 10.6.2 Snow Leopard
Installing MySQLdb on Mac OS X
and many other links.
It appears that the problem is a 32-bit 64-bit mismatch, but I'm not sure what the right combination is, or what exactly the mismatch is.
I have installed from pip, from Mac ports, and built from the source. I have tried setting the ARCHFLAGS to both i386 and and x86_64.
I have tried setting VERSIONER_PYTHON_PREFER_32_BIT and VERSIONER_PYTHON_PREFER_64_BIT preferences.
I am running Mac OS X 10.6.6
I have mysql installed in /usr/local/mysql
$ file $(which ./mysql)
./mysql: Mach-O executable i386
I have mysql version 5.5.12
I have 64 bit Python 2.6.6.
My system architecture is:
>>> platform.platform()
'Darwin-10.6.0-i386-64bit'
$ file $(which python)
/opt/local/bin/python: Mach-O 64-bit executable x86_64
If there are any links you can point me to or suggestions to try I would really appreciate it. I'm kind of at a dead end and getting the same "wrong architecture" error no matter what I try.
Try to add this in your .bashrc or .bash_profile:
PATH="/usr/local/mysql/bin:${PATH}"
export PATH
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
export VERSIONER_PYTHON_PREFER_64_BIT=no
export VERSIONER_PYTHON_PREFER_32_BIT=yes
I've solved my own question, so hopefully this can be of help to people with similar issues.
I believe I had a 32-bit mysql installation.
I uninstalled all versions of mysql that I had
I went back and installed mysql 5.1 from the source, but I think a mysql 5.1 x86_64 bit dmg or binary would work also.
I used this make command from this post http://hivelogic.com/articles/compiling-mysql-on-snow-leopard/
I had permission issues and finally got it working using
sudo mysqld_safe --skip-grant-tables &
I installed MySQL-python 1.2.3c1 from here
http://pypi.python.org/pypi/MySQL-python/1.2.3c1