# Bioimage Analysis Wiki

### Sidebar

EMBL BioImage Data Analysis

EuBIAS

NEUBIAS

Popularity Ranking

 RT @KuglerElisabeth: One question I often get is "How do I assess my segmentation?" Together with Andrik Bin Rampun, .@Timchico, and Paul… About 4 hours, 4 mins ago by: Kota Miura (@cmci_) RT @clairebrown514: @cmci_ We use https://t.co/J9y0625zRl . People still need to be convinced and reminded to put the #RRID in the acknowled… About 5 hours, 3 mins ago by: Kota Miura (@cmci_) RT @Coronin: Wonderful historical perspective from Tom Pollard: Landmarks in the discovery of a role for actin in cell locomotion https://t… About 13 hours, 40 mins ago by: Kota Miura (@cmci_) RT @IAMichaelNelson: @cmci_ @CCI_liv I recommended to my old core https://t.co/mOai5Zez5b . A "how to use our core facility" protocol and ma… About 19 hours, 3 mins ago by: Kota Miura (@cmci_) RT @cmci_: @CCI_liv It’s an idea. What would you say? There are journals that allows versioning, so it can be updated every time when there… About 19 hours, 21 mins ago by: Kota Miura (@cmci_) @CCI_liv It’s an idea. What would you say? There are journals that allows versioning, so it can be updated every ti… https://t.co/xz3xKR243j About 19 hours, 30 mins ago by: Kota Miura (@cmci_)
documents:110803compilespyder

# Compiling Spyder (Python IDE)

Spyder is a matlab-like IDE for scientific computing. Following assumes that numpy and scipy is already installed in your python. I compiled spyder in both windows (32bit) and OSX machine (64bit) and both worked well. Below is compiling procedure for Windows. There are bundled packages available as well. See notes at the end of this page for the reason I set them up by myself.

## Install Qt (binary)

Download binary (“library” version) from Nokia site and install Qt. I used “Qt libraries 4.7.3 for Windows (minGW 4.4, 319 MB)”.

mingW binary was chosen since I had many troubles before with VC compiled python modules. Since compiler is better be always same, I use mingW.

Important: After installation, set Path to Qt. Path to the c:\Qt\4.3.7\bin should be at the very front of all the other application bin path. These days, there are so many applications that comes with QtCore4.dll and if these are in front of installed Qt directory, then the wrong one is recognized.

## Install SIP (source).

After installing Qt, use Qt-command prompt (you will see it under menu tree start - programs - Qt by Nokia… ) for installing SIP and PyQt. Much less problem occurs by using this Qt specific command prompt.

python config.py -p win32-g++
mingw32-make
mingw32-make install


## Install PyQt (source)

Also using Qt command prompt.

python config.py -w
mingw32-make
mingw32-make install


Check if PYQT is installed correctly: run script below.

import sys
from PyQt4.QtGui import *
app = QApplication(sys.argv)
button = QPushButton("Hello World", None)
button.show()
app.exec_()


Note: I had to clean system environmental path before making the PyQt to work. Specifically, I deleted c:\python26\lib\site-packages\pyQt\bin from the Path, which I added a year ago when I first installed PyQt. This old installation was working, but had some problems with addressing the location of PyQt binaries. In the end, I had to move all the libraries under PyQt\bin to PyQt root (many people suggested so and indeed it worked, though awkward)

## Install Optional Modules

There is a list of recommended (though optional) modules in Spyder site. I installed them all using easy_install.

• rope
• pyflakes
• pyReadline (this module is not in the list, but was recommended after installing Spyder showing up in its console)

I already had numpy, scipy, matplotlib, sphinx & Ipython installed. I only updated numpy using superpackage.

## Compile Spyder: preparation

Some changes are required for PIL module being easy-to-be namespace conflicted in some imports. Error occurred during python setup.py install of Spyder in some modules due to way PIL module is imported. For example, import Image is not specific because there are other python file with name Image.py in module other than PIL. Then import fails.

Change follwoing codes:

1. C:\Python26\Lib\site-packages\scipy\misc\pilutil.py line 10:

#import Image
from PIL import Image

2. C:\Python26\lib\site-packages\docutils-0.7-py2.6.egg\docutils\parsers\rst\directives\images.py

line 19 -

#try:
#    import Image as PIL                        # PIL
#except ImportError:
#    PIL = None
# patched according to http://d.hatena.ne.jp/kk6/20110302
try:
import PIL
except ImportError:
try:
import Image as PIL                        # PIL
except ImportError:
PIL = None


patched according to http://d.hatena.ne.jp/kk6/20110302

Note: The problem I encountered is “AccessInit: hash collision: 3 for both 1 and 1” error, related to the name space conflict coming from PIL package. For this error, refer to here or here. Afterward, I found more up-to-date fork of PIL (PIL has not been developed for pretty long time) called "Pillow". I might have tried using it if I knew before, but since current setup is working, I might try later when I encounter other problems.

## Compile Spyder

python setup.py install