MySQLdb on MAC OS 10.6.8 - python

>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.6-intel.egg/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.6-intel.egg/_mysql.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.6-intel.egg/_mysql.so: mach-o, but wrong architecture
I'm having a lot of troubles with MySQLdb installation on MAC 10.6.8 I read many guides on how to solve without success.

What's the output on:
# which python
# which pip
If pip is installed try:
# pip install mysqldb

Related

Import error (tensorflow) after installing tensorflow-macos and other packages (numpy,pandas,tensorflow)

Hi I am trying to use tensorflow on my Mac (M1) and have installed tensorflow-macos with other dependencies in a conda environment I created. However,when i tried to import tensorflow it gave me an error:
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ambroseling/Desktop/TensorFlow/mlprojs/lib/python3.9/site-packages/tensorflow/__init__.py", line 449, in <module>
_ll.load_library(_plugin_dir)
File "/Users/ambroseling/Desktop/TensorFlow/mlprojs/lib/python3.9/site-packages/tensorflow/python/framework/load_library.py", line 155, in load_library
py_tf.TF_LoadLibrary(lib)
tensorflow.python.framework.errors_impl.NotFoundError: dlopen(/Users/ambroseling/Desktop/TensorFlow/mlprojs/lib/python3.9/site-packages/tensorflow-plugins/libmetal_plugin.dylib, 6): Symbol not found: _OBJC_CLASS_$_MPSGraphCompilationDescriptor
Referenced from: /Users/ambroseling/Desktop/TensorFlow/mlprojs/lib/python3.9/site-packages/tensorflow-plugins/libmetal_plugin.dylib (which was built for Mac OS X 12.0)
Expected in: /System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Versions/A/MetalPerformanceShadersGraph
I basically followed this step by step guide,https://github.com/mrdbourke/m1-machine-learning-test
What might be the cause to the import error? I would greatly appreciate any help on this. Thank you.

Failed to import a module

I try to use ImageGrab (open-cv function)
OS: lubuntu
First, I did: sudo apt-get install python-opencv.
Installation went successfuly.
Then I tried to do: from PIL import ImageGrab. But at this point I got the following ImportError:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/user/lib/python2.7/dist-packages/PIL/ImageGrab.py", line 26, in <module> import _grabscreen
ImportError: No module named _grabscreen
Where am I wrong?
Unfortunately - ImageGrab only works with Windows
Alternative: pyscreenshot

Not being able to use turicreate

I am trying to use turicreate. I installed it on my device (sudo python2.7 -m pip install turicreate) And when I ran my code (in terminal on Mac), I got a long error message. I believe that the significant part is as follows:
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/cython/cy_unity.so, 2): Symbol not found: _syslog$DARWIN_EXTSN
Here is the integrity of it for reference:
Traceback (most recent call last):
File "classifier.py", line 1, in <module>
import turicreate as turi
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/__init__.py", line 30, in <module>
from turicreate.data_structures.sgraph import Vertex, Edge
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/data_structures/__init__.py", line 18, in <module>
from . import sframe
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/data_structures/sframe.py", line 16, in <module>
from ..connect import main as glconnect
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/connect/main.py", line 13, in <module>
from ..cython.cy_unity import UnityGlobalProxy
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/cython/cy_unity.so, 2): Symbol not found: _syslog$DARWIN_EXTSN
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/cython/../libunity_shared.dylib (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/turicreate/cython/../libunity_shared.dylib
What is the problem here?
This article provides a detailed explanation of setting up Python environment for popular ML packages on Mac - Machine Learning Compass

Can't import the py-translate 1.03 package

Is someone familiar with these package?
I tried easy install and many things I saw in imports problems solution
>>> import translate
output:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import translate
File "C:\Python27\lib\site-packages\translate\__init__.py", line 8, in <module>
from .translator import *
File "C:\Python27\lib\site-packages\translate\translator.py", line 13, in <module>
import requests
ImportError: No module named requests
Moreover, in the directory of the package there is a test file.
I tried to run it but I got this:
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\translate\tests\test_translator.py", line 10, in <module>
from ..translator import translator
ValueError: Attempted relative import in non-package
How have you installed py-translate.
It requires: requests
My advice is pip install requests (or easy_install requests)
Their latest release is 1.0.2, but also goes by 1.0.3.
Pip install the package, don't just download the archive as you will miss the dependancies

wrong architecture error mysql python

i use flask.I installed MySQL using easy_install mysql-python and then tried to run my app.py but got this lines of error.What is those mean?
Traceback (most recent call last):
File "app.py", line 7, in <module>
import MySQLdb
File "/Users/ozcan/Documents/python/venv/lib/python2.7/site-packages/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Users/ozcan/Documents/python/venv/lib/python2.7/site-packages/_mysql.so, 2): no suitable image found. Did find:
/Users/ozcan/Documents/python/venv/lib/python2.7/site-packages/_mysql.so: mach-o, but wrong architecture
I would suggest to use Flask-MySQL instead.
Here's documentation https://flask-mysql.readthedocs.org/en/latest/

Categories

Resources