Python MySQL installing wrongly on Mac OS X 10.6 i386 - python

When trying to install MySQL's python bindings, MySQLdb, I followed the instructions to build and install on my MacBook running Mac OS X 10.6 i386, and after entering the following line into the terminal:
user-152-3-158-79:MySQL-python-1.2.3c1 jianweigan$ sudo python setup.py build
I get the following errors:
running build
running build_py
creating build/lib.macosx-10.3-i386-2.6
copying _mysql_exceptions.py -> build/lib.macosx-10.3-i386-2.6
creating build/lib.macosx-10.3-i386-2.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb
creating build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.3-i386-2.6/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.3-i386-2.6
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.4u.sdk
Please check your Xcode installation
It looks like the setup.py build script is recognizing my OS as Mac OS X 10.3 instead of 10.6 so it tries to locate an older version of XCode which I don't have.
Does anyone know how to get around this problem? Perhaps manually configuring the script to recognize my os as 10.6?

It appears you have installed and are using a python.org python2.6. Because that installer is designed to work for a range of systems, to build extensions with that python on 10.6, you need to install the optional 10.4 SDK which is part of the Xcode package on the Snow Leopard installation DVD or machine restore DVD; the 10.4 SDK is not installed by default. That's what the message is trying to tell you.

Installing the latest version of Python from python.org, fixed this problem for me.

Well the error is pretty clear, do you have xcode installed? http://developer.apple.com/tools/Xcode/
You can look at a more detailed solution to this in http://blog.some-abstract-type.com/2009/09/mysql-python-and-mac-os-x-106-snow.html which includes downloading the latest xcode. Hope it helps.

Related

Manually installing python packages

I have run into a problem while installing pychopg2 into my work computer (windows btw). Using pip wasn't an option, due to network restrictions, so I have learned how to install packages manually, and after some attempts, it seems to be working and installation runs without error:
running install
running bdist_egg
running egg_info
writing psycopg2.egg-info\PKG-INFO
writing dependency_links to psycopg2.egg-info\dependency_links.txt
writing top-level names to psycopg2.egg-info\top_level.txt
reading manifest file 'psycopg2.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'psycopg2.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
creating build\bdist.win-amd64\egg
creating build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\compat.py -> build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\errorcodes.py -> build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\errors.py -> build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\extensions.py -> build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\extras.py -> build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\pool.py -> build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\sql.py -> build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\tz.py -> build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\_ipaddress.py -> build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\_json.py -> build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\_lru_cache.py -> build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\_psycopg.cp37-win_amd64.pyd -> build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\_range.py -> build\bdist.win-amd64\egg\psycopg2
copying build\lib.win-amd64-3.7\psycopg2\__init__.py -> build\bdist.win-amd64\egg\psycopg2
byte-compiling build\bdist.win-amd64\egg\psycopg2\compat.py to compat.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\psycopg2\errorcodes.py to errorcodes.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\psycopg2\errors.py to errors.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\psycopg2\extensions.py to extensions.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\psycopg2\extras.py to extras.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\psycopg2\pool.py to pool.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\psycopg2\sql.py to sql.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\psycopg2\tz.py to tz.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\psycopg2\_ipaddress.py to _ipaddress.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\psycopg2\_json.py to _json.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\psycopg2\_lru_cache.py to _lru_cache.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\psycopg2\_range.py to _range.cpython-37.pyc
byte-compiling build\bdist.win-amd64\egg\psycopg2\__init__.py to __init__.cpython-37.pyc
creating stub loader for psycopg2\_psycopg.cp37-win_amd64.pyd
byte-compiling build\bdist.win-amd64\egg\psycopg2\_psycopg.py to _psycopg.cpython-37.pyc
creating build\bdist.win-amd64\egg\EGG-INFO
copying psycopg2.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
copying psycopg2.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying psycopg2.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
copying psycopg2.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
writing build\bdist.win-amd64\egg\EGG-INFO\native_libs.txt
zip_safe flag not set; analyzing archive contents...
psycopg2.__pycache__._psycopg.cpython-37: module references __file__
creating 'dist\psycopg2-2.8.4-py3.7-win-amd64.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing psycopg2-2.8.4-py3.7-win-amd64.egg
removing 'c:\users\user\anaconda\lib\site-packages\psycopg2-2.8.4-py3.7-win-amd64.egg' (and everything under it)
creating c:\users\user\anaconda\lib\site-packages\psycopg2-2.8.4-py3.7-win-amd64.egg
Extracting psycopg2-2.8.4-py3.7-win-amd64.egg to c:\users\user\anaconda\lib\site-packages
psycopg2 2.8.4 is already the active version in easy-install.pth
Installed c:\users\user\anaconda\lib\site-packages\psycopg2-2.8.4-py3.7-win-amd64.egg
Processing dependencies for psycopg2==2.8.4
Finished processing dependencies for psycopg2==2.8.4
But my code editor still complains about 'No module named psychopg2'. I am using anaconda3, added to path during installation. It seems that it could cause problems but I don't know if it is what is causing the package not to be recognized. Also, when I run python from cmd, it says:
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
But when I go to the folder where the environment is supposed to be, it is empty. So I tried to create one, and I get another network error. I'm getting out of ideas.
You are running the Anaconda interpreter without activating the environment.
Run conda activate env_name where env_name is the environment you created or base for the default environment. Then, install your package from within the environment using either conda (preferred) or pip and run Python while the environment is active.

Microsoft Visual C++ 14.0 is required - installing mysqldb for python

I am trying, in Windows 10, to install using pip MySQL-python as seen below. I am being told I need Microsoft Visual C++ 14 but I have installed Microsoft Visual Studio 11, 12, and 2017. 2017 should be providing me the required components if my research is accurate. I, also, installed Microsoft Build Tools. I am at a loss what is wrong. I am trying to migrate from my Ubuntu VM to native Windows with PyCharm. I have seen lots of other questions but none seem to have the answer I need.
C:\Environment\Python27>pip install MySQL-python
Collecting MySQL-python
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python ... error
Complete output from command c:\users\efultz\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\efultz\\AppData\\Local\\Temp\\pip-build-3d7yo7lf\\MySQL-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\efultz\AppData\Local\Temp\pip-wcici6ff-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
copying _mysql_exceptions.py -> build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win-amd64-3.7\MySQLdb
creating build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.7\MySQLdb\constants
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
I never figured out the problem but I believe it was related to having both Python2 and Python3 installed on my machine. I uninstalled Python3 and was able, with a little more effort, to get things working. Hopefully when we do our migration to Python3 I won't return to having this problem.
If you want to install database i would go to Microsoft webpage (https://dev.mysql.com/doc/refman/8.0/en/windows-installation.html) and install it from there.
As far as i know, you can't install database via python's pip.

pip install myclient error - on Windows 7 using Python 3.7.0

I'm currently working through a Django tutorial and after trying to install mysqlclient I have had the following error message on my CMD.
Many thanks in advance
Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command c:\users\o\envs\py1\scripts\python.exe -u
-c "import setuptools,
tokenize;__file__='C:\\Users\\O\\AppData\\Local\\T
emp\\pip-install-kej8gk5_\\mysqlclient\\setup.py';f=getattr(tokenize,
'open', op
en)(__file__);code=f.read().replace('\r\n',
'\n');f.close();exec(compile(code, _
_file__, 'exec'))" install --record
C:\Users\O\AppData\Local\Temp\pip-reco
rd-_27hw8hl\install-record.txt --single-version-externally-managed --
compile --install-headers
c:\users\o\envs\py1\include\site\python3.7\mysqlclient:
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
copying _mysql_exceptions.py -> build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-
3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-
3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-
3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32 3.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
i will recommend use python 64-bit.
This problem occured when mysql is of 64-bit and python is of 32-bit and when we forcefully install mysqlclient via this websitePython Extension Package
Or you can install both of 32-bit
pip install mysqlclient
or use this:pip install --only-binary :all: mysqlclient
Using 64-bit python you can easily install it.

Trying to pip install mysqlclient but getting error

I am new to python. I am trying to set up the environment to build a picture sharing app. The setup was going well until I had to install mysqlclient which is one of the requirements according to the tutorial I was using.
The error I get in the windows Powershell is this:
--compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
copying _mysql_exceptions.py -> build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win-amd64-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win-amd64-3.7\MySQLdb
creating build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.7\MySQLdb\constants
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
I already have Microsoft Visual C++ 14.0 installed in my machine
I even tried upgrading setup tools like suggested in another post but with no luck
I have python 3.7 installed
Try this
pip install --only-binary :all: mysqlclient
Hope it helped.

Python 3.4 Installing psutil on Windows 7 x64

I'm trying to install from source psutil 2.1.0 for Python 3.4. My OS is Windows 7 x64. I receive the error:
c:\Python34\psutil-2.1.0>python setup.py install --verbose
running install
running bdist_egg
running egg_info
writing top-level names to psutil.egg-info\top_level.txt
writing psutil.egg-info\PKG-INFO
writing dependency_links to psutil.egg-info\dependency_links.txt
reading manifest file 'psutil.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*' found under directory 'docs
build'
writing manifest file 'psutil.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build
creating build\lib.win32-3.4
creating build\lib.win32-3.4\psutil
copying psutil\_common.py -> build\lib.win32-3.4\psutil
copying psutil\_compat.py -> build\lib.win32-3.4\psutil
copying psutil\_psbsd.py -> build\lib.win32-3.4\psutil
copying psutil\_pslinux.py -> build\lib.win32-3.4\psutil
copying psutil\_psosx.py -> build\lib.win32-3.4\psutil
copying psutil\_psposix.py -> build\lib.win32-3.4\psutil
copying psutil\_pssunos.py -> build\lib.win32-3.4\psutil
copying psutil\_pswindows.py -> build\lib.win32-3.4\psutil
copying psutil\__init__.py -> build\lib.win32-3.4\psutil
running build_ext
building '_psutil_windows' extension
error: Unable to find vcvarsall.bat
Can you help me please? Thanks in advance
vcvarsall.bat looks like a dependency for Microsoft Visual Studio.
See: Python issue:Unable to find vcvarsall.bat
You could try to install it manually. Get the amd64 py3.4 build from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#psutil
And install it. If that fails as well, use 7-Zip to open the .exe and unpack the contained folder to your site-packages.
try my experience. I hope it will be helpful
I have Ptython 3.4 installed. I was trying to install 'paramiko' modul and I've recieved an error message (vcvarsall.bat)
So after that I did folowing:
1. install MinGW (refer to page- http://docs.cython.org/src/tutorial/appendix.html)
2. install pycrypto2.6.1 (I've found it here - https://github.com/axper/python3-pycrypto-windows-installer) for others python version please refer this page -- www.voidspace.org.uk/python/modules.shtml#pycrypto
3. check

Categories