MySQL with Django - Python - python

I'm integrating MySQL as backend with my Django application. At the time of installation i'm running following command (using mac os)
export PATH=$PATH:/usr/local/mysql/bin
start server from settings (i'm on mac os)
brew install mysql-connector-c
sudo pip install MySQL-python
while running last command i'm getting following error,
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-build-wd69ia4g/MySQL-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/private/tmp/pip-build-wd69ia4g/MySQL-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-wd69ia4g/MySQL-python/
I google the error and got the solutions as run following command
export PATH=$PATH:/usr/local/mysql/bin
But it doesn't solve my error.
Can any body help me to get out of it or let me know the steps for the initial MySQL setup.
Can not getting the solution than i'm ready for the fresh installation. Post the exact steps here

Related

ImportError: No module named build_lib

I'm trying to run the pip install command in this way: pip install pyverdict --upgrade, but I get the following error: ImportError: No module named build_lib. How can I resolve this?
More detailed error:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting pyverdict
Using cached https://files.pythonhosted.org/packages/81/be/c7f5803f599fa74b26ac9b2be385f19f14ce573540371f1f2c1c59a51a80/pyverdict-0.1.3.1.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-hBPHyv/pyverdict/setup.py", line 21, in <module>
from build_lib import build_and_copy
ImportError: No module named build_lib
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-hBPHyv/pyverdict/

Spyder IDE inside Anaconda3 installation of opticspy-0.2.1 module error

After many times I've tried installing opticspy as what the instructions written on its documentation page, this pops up Command
"python setup.py egg_info" failed with error code 1 in
C:\Users\[PC Name]\AppData\Local\Temp\pip-build-3xlemy6i\unwrap\ .
Also, when I downloaded the wheel file of the opticspy(opticspy-0.2.1-py2.py3-none-any.whl) , it successfully installed (as what the anaconda prompt says), but when I tried to import it on Spyder, it says..
Traceback (most recent call last):
File "<ipython-input-3-824cab08504e>", line 1, in <module>
import opticspy
File "C:\Users\[PC Name]\Anaconda3\lib\site-packages\opticspy\__init__.py", line 12, in
<module>
from . import aperture, interferometer_seidel,interferometer_zenike
File "C:\Users\[PC Name]\Anaconda3\lib\site-packages\opticspy\aperture.py", line 3, in
<module>
import diffraction as __diffraction__
ModuleNotFoundError: No module named 'diffraction'
Can someone help me? I really need this package for our Project Study. Thanks in advance!
The eggs/source code at PyPI seems to be buggy. The code at Github repository seems to be better but lacks setup.py. A broken and abandoned package.
You can try to clone https://github.com/Sterncat/opticspy and put it into site-packages/ directory manually. If you apply PR 21 yourself you get missed setup.py so you can run pip install . or python setup.py install.

MySQL-python installation not working within virtualenv

I am trying to connect a MySQL database to my Django project, but when I try to install MySQL-python, it gives me the following error:
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/fr/3k1nrq490dzdz9s48k49m9640000gn/T/pip-build-4dsuxwwv/mysql-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/private/var/folders/fr/3k1nrq490dzdz9s48k49m9640000gn/T/pip-build-4dsuxwwv/mysql-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/fr/3k1nrq490dzdz9s48k49m9640000gn/T/pip-build-4dsuxwwv/mysql-python/
I have tried pip3 install ConfigParser, but while it gets installed, the error still occurs.
When I try to run my Django server, it prints out a long error log, and at the end:
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
and when I looked at the following link, it said that I should install MySQL-python: Django mysqlclient install
May seem like a newbie question, but I can't seem to find similar errors elsewhere online.
EDIT:: Ok, looks like MySQL-python is not for python-3.6
While I did pip3 install mysqlclient, the virtualenv is saying that I have already installed it when I run the command again. But when I try to python3 manage.py runserver, I get the above error, asking if I had installed it. When I try to give an answer, I am unable to. Everytime I press ENTER, it just creates a new line and the prompt is still active.
The above error is preceded by the following text:
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x1059d9048>
Traceback (most recent call last):
File "/Users/karthikpullela/Desktop/Django-projects/QB-test/QB/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 15, in <module>
import MySQLdb as Database
File "/Users/karthikpullela/Desktop/Django-projects/QB-test/QB/lib/python3.6/site-packages/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Users/karthikpullela/Desktop/Django-projects/QB-test/QB/lib/python3.6/site-packages/_mysql.cpython-36m-darwin.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/karthikpullela/Desktop/Django-projects/QB-test/QB/lib/python3.6/site-packages/_mysql.cpython-36m-darwin.so
Reason: image not found
The above exception was the direct cause of the following exception:
Python 3 does not include ConfigParser
only has configparser
>>> import ConfigParser
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'ConfigParser'
>>> import configparser
Try Python 2.7 which still works if we use import ConfigParser
Try to install with different package, it has support for python 3.
pip install mysqlclient
If there is error while installing in virtualenv, do install this first.
sudo apt-get -y install python3-dev libmysqlclient-dev

ImportError: cannot import name sslhandling

I've got this while working with Cassandra https://github.com/marionleborgne/cloudbrain/wiki/1.-Setup
~/Downloads/cloudbrain/cloudbrain/datastore$ cqlsh -f /home/user/Downloads/cloudbrain/cloudbrain/datastore/cassandra_schema.cql
Traceback (most recent call last):
File "/usr/bin/cqlsh.py", line 157, in <module>
from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling, copy
ImportError: cannot import name sslhandling
Such error may occur when you have installed Cassandra using installator and it haven't installed required python libs. Download tar.gz archive from cassandra.apache.org/download/, extract it, go to pylib folder in it and run command in terminal
python setup.py install --user
It is possible that you'll need to reboot your system after that.

Django - MySQL doens't work with python 3.4.3 on osx 10.9.5

I'm building a web application that needs to use a mySql database. I created a database in mysql workbench. When i try to run the command for django :
'python manager.py runserver'
i get the following error:
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'
When i try to install MySQLdb (for python 3.4.3) via 'pip install mysql-python' i get following error :
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/private/var/folders/cg/_w0sc5ms4hj3k5rcrf2mfm500000gn/T/pip-build-5qbm_4en/mysql-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/private/var/folders/cg/_w0sc5ms4hj3k5rcrf2mfm500000gn/T/pip-build-5qbm_4en/mysql-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/cg/_w0sc5ms4hj3k5rcrf2mfm500000gn/T/pip-build-5qbm_4en/mysql-python
Read about MySQL-python on PyPI:
MySQL-3.23 through 5.5 and Python-2.4 through 2.7 are currently supported. Python-3.0 will be supported in a future release. PyPy is supported.
If you want to stick to Python 3.x you'll need to use mysqlclient

Categories