can't import NumPy Mac OS X Lion - macos

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.

Related

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).

Python 2.7.11 on OSX 10.11.3 gives Segmentation fault: 11 with package gspread

I'm using the package gspread to interact with google spreadsheets on python 2.7 and OSX 10.11, and I get segmentation fault: 11. However, I'm able to download the google spreadsheet content despite this error showing up.
Here's an example of the error.
bash-3.2$ ipython
fPython 2.7.11 (default, Dec 26 2015, 17:47:53)
Type "copyright", "credits" or "license" for more information.
IPython 4.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: from etl.spread import gspread, credentials
In [2]: gs = gspread.authorize(credentials)
In [3]:
Do you really want to exit ([y]/n)? y
Segmentation fault: 11
It takes several seconds between typing y to exit, and actually exiting. I'm not sure if that indicates something
Here's the full crash report

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.

What is needed for curses in Python 3.4 on Windows7?

I have a running Python 2.7/3.4 installation on my Windows 7 (x64) machine. I would like to test curses on Windows.
Curses is installed but not working:
>>> import curses
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Tools\Python3.4.2\lib\curses\__init__.py", line 13, in <module>
from _curses import *
ImportError: No module named '_curses'
The documentation says:
The Windows version of Python doesn’t include the curses module. A ported version called UniCurses is available.
So, the Windows installer of Python 3.4 installed curses with unresolved dependencies. One could name this a bug...
OK, I looked into UniCurses. It's a wrapper for PDCurses:
UniCurses is a wrapper for Python 2.x/3.x that provides a unified set of Curses functions on all platforms (MS Windows, Linux, and Mac OS X) with syntax close to that of the original NCurses. To provide the Curses functionality on Microsoft Windows systems it wraps PDCurses.
Installing UniCurses via pip3 results in an error:
C:\Users\Paebbels>pip3 install UniCurses
Downloading/unpacking UniCurses
Could not find any downloads that satisfy the requirement UniCurses
Some externally hosted files were ignored (use --allow-external UniCurses to allow).
Cleaning up...
No distributions at all found for UniCurses
Storing debug log for failure in C:\Users\Paebbels\pip\pip.log
The link to SourceForge on Python's UniCurses site is dead. A manual search an SourceForge helped to find UniCurses for Python again.
But, the UniCurses 1.2 installer can not find any Python installation in my Windows registry. (Python 2.7.9 and Python 3.4.2 are available).
I also looked into Public Domain Curses (PDCurses). PD Cureses 3.4 is from late 2008. So it's 7 years old. I don't believe it will work either with Windows 7 nor Windows 8.1 or Windows 10.
Is there any way to get curses running on Windows with Python.
(The Windows Python, not the CygWin Python!)
You can use curses cross-platform (Windows, MacOS, GNU/Linux) if you install manually for Windows or like other package in others.
Install wheel package. If you need more info about wheel click here.
Go to this repository.
Download a package with your python version, in example for python 3.4:
curses-2.2-cp34-none-win_amd64.whl
Install it (this command if for windows, in GNU/Linux install like other package)
python -m pip install curses-2.2-cp34-none-win32.whl
Just include in your python script:
import curses
You can use curses wrapper for python. Works in Fedora 25 in all terminals, and Windows 10 using git bash, powershell, or cmd.
Update:
An alternative to curses in Windows here.
Console user interface in Windows here.
An interesting tutorial here.
Now we can easy install on python 3.7 using pip install windows-curses
You can try my mirror of unicurses, which includes pdcurses dlls. I have it currently up and running on windows 7 with python 3.5.0.
To quickly test if it works for you, just clone the repository and create and run a python script within its toplevel directory containing something like
from unicurses import *
stdscr = initscr()
addstr("hello world")
getch()

pymssql on mac os x mountain lion 10.9.2

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

Resources