pymssql on mac os x mountain lion 10.9.2 - macos

Recently discovered pymssql and got it working on a windows machine (python 3.4). However when I try to run the script on my mac (10.9.2), I get an error when I 'import pymssql'. Note both on the windows box and on the mac, I installed via 'pip3.4 install pymssql'. Installation concluded with no errors in both cases.
This is what I get when I try to import pymssql on the mac :
Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import pymssql
Traceback (most recent call last):
File "", line 1, in
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pymssql.so, 2): Library not loaded: /usr/local/lib/libsybdb.5.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pymssql.so
Reason: image not found
Note pip3.4 search pymssql results in :
pymssql - DB-API interface to Microsoft SQL Server for
Python. (new Cython-based version)
INSTALLED: 2.1.0 (latest)
Note further that /usr/local/lib/libsybdb.5.dylib does NOT exist, but then again, I couldn't find in on the windows box either (searched the C drive for libsybdb)
How do I get around this?

You need to install freetds library to talk to Microsoft SQL Server
brew install freetds

Related

How to start Spyder in macOS?

I've installed python3.6 as below but unsure how to access Spyder. Most of what I have read is unclear, i.e. saying if should already have Spyder? I have completed my set-up using Learn Python the Hard Way on a Macbook Pro.
Install instruction: Gotohttps://www.python.org/downloads/release/python-360/anddownloadthe”macOS64-bit/32- bit installer”. Install it like you would any other software.
Terminal > Python version:
Python 3.6.0 (v3.6.0:41df79263a11, Dec 22 2016, 17:23:13)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Any help appreciated.
Steve
(Spyder maintainer here) Using Spyder is very simple, but not the way you're trying to do it.
Please remove what you've installed so far. Then simply download and install Anaconda. After that, look for an application called Anaconda Navigator with Spotlight and finally start Spyder from it.
Note: The way you're trying to install Spyder (by using pip on a Python version you downloaded from Python.org) is only recommended to very knowledgeable people because it's really hard to get all Spyder dependencies installed correctly and without problems. That's why we recommend to use Anaconda instead, which is way easier and safer.

Is there a way to use ibm_db on python 2.7 64-bit on windows?

I installed python 2.7 32-bit version and I am able to run pip install ibm_db (current version is 2.0.8), and then call import ibm_db and everything works. When I use python 2.7 64-bit, however, the install via pip works fine, but when I try and import ibm_db I get the following error:
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ibm_db
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\ibm_db.py", line 10, in <module>
__bootstrap__()
File "C:\Python27\lib\site-packages\ibm_db.py", line 9, in __bootstrap__
imp.load_dynamic(__name__,__file__)
ImportError: DLL load failed: %1 is not a valid Win32 application.
>>>
The DLL in question is <site-packages>/ibm_db_dlls/ibm_db.dll, and its there, but when I open it using Dependency Walker, it seems to be the 32 bit version.
Anybody know if there is a 64 bit compatible ibm_db.dll, or a way to make this work? I need this to run in an environment (windows server) with 64 bit python, and I don't have control over the version.
Converting previous comment to answer.
I run Python 2.7.14 (64-bit) with ibm_db (2.0.8) on 64-bit Windows 8.1 workstation, with a 64-bit Db2 V11.1 client.
I have no issues with the above combination of 64-bit components.
If the 64-bit combination runs OK on the workstation, I don't see why it would not also run on Windows-Server, if properly configured.
Could your Windows-server have some mashup of 32-bit and 64-bit artefacts for Python and/or ibm_db ? Or some incorrect PATH settings etc?
Note: I used easy_install to deliver the ibm_db (following IBM's instructions in Db2 knowledge center).

pip install cx_Freeze-5.0.2-cp36-cp36m-win_amd64.whl to my window 10 machine

Tryng to pip install cx_Freeze using:
python -m pip install c:\Users\yosief\Downloads\cx_Freeze-5.0.2-cp36-cp36m-win_amd64.whl
on Window 10 based laptop and I end up with an error
cx_Freeze-5.0.2-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform
There are several reasons why you may not be able to install cx_Freeze but luckily it is generally easy to correct.
You should just be able to install cx_Freeze with pip install cx_Freeze. No need to download the wheel.
However if you want to use the wheel file. You should know have downloaded the x64 version for Python 3.6. Your Python installation must be an x64 build and the Python version 3.6.
Check the Python version and build by opening the Python interpreter. The version will be displayed at the top as well as the build.
For example on my PC the interpreter reads:
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
So I know the version is 3.6.3 and is 32 bit (MSC v.1900 32 bit). Take no notice of on win32 it does not give you the right windows build in some cases.
If the build or version is different from what you have downloaded then you must re download the wheel to match the Python build and version.
Then install the wheel file as you did above.

xlwings 0.6.1 Import error on Mac OS X with python 3.5

When importing xlwings 0.6.1 in Python 3.5 on a Mac, I'm getting the following error message:
Python 3.5.0 (default, Nov 8 2015, 20:38:08)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import xlwings
Traceback (most recent call last):
File "", line 1, in
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/xlwings/init.py", line 22, in
from . import _xlmac as xlplatform
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/xlwings/_xlmac.py", line 5, in
from appscript import app, mactypes
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/aeosa/appscript/init.py", line 8, in
from aem.findapp import ApplicationNotFoundError
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/aeosa/aem/init.py", line 5, in
import ae, kae, findapp, mactypes, aemconnect
ImportError: No module named 'ae'
Has anyone encountered this error with the recent release of xlwings 0.6.1?
Something seems to have gone wrong with the installation of the appscript package, a dependency of xlwings. Try to reinstall that. But generally speaking, I would suggest to open an issue on GitHub for these kind of questions since there is usually something very specific going on. For ease of installation, I recommend to use the Anaconda distribution.

can't import NumPy Mac OS X Lion

I searched around and I haven't solve my questions. So plz help me. Thanks!
I want to install HTSeq, and it requires Python 2.5 (or later) and NumPy.
I have installed Xcode 4.2.1 before, my OS is Mac OS X Lion 10.7.2.
When the installations of Python(2.7.2) and NumPy(numpy-1.6.1-py2.7-python.org-macosx10.3.dmg) finished, I ran Python, and tried to import numpy, it appeared as follows:
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> import numpy
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import numpy
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so: no matching architecture in universal wrapper
I had the same problem as well: Mac OS 10.7.3, freshly downloaded Python 2.7.2 from python.org, and numpy 1.6.1 via scipy.org, specifically the version for Python 2.7. I got the exact same error message as the original poster.
I believe this has to do with "architecture" issues--that the numpy .dmg download from sourceforge is 32-bit, and python defaults to 64-bit when its run.
In any case, the solution that worked for me was to get the Scipy Superpack. Much to my surprise, it worked! The README for the Superpack says that it needs Xcode 4.2, but I don't have that installed (I do have XCode 3.0). Now when I run IDLE, it says:
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
and
>>> numpy.version.version
'1.7.0.dev-3f685a1'
>>> scipy.version.version
'0.11.0.dev-491f9db'
Since I found this thread as I was trying to find a solution, and posted my answer as soon as I got the above result, I don't know how well it works, but this does look like progress.

Resources