EzDevInfo.com

spyder

Official repository for Spyder - The Scientific PYthon Development EnviRonment

How do I run two separate instances of Spyder

I want to be able to have two instances which are completely independent in the sense that I can be working on two separate unrelated projects in different folders without any interference.


Source: (StackOverflow)

Spyder - UMD has deleted: module

I have been fooling around for about a month with python now and something is bothering me. I use the python(x,y) toolkit, which comes with the neat Spyder IDE. My question concerns the UMD (User module deleter) of Spyder.

I found this graphics module on the internet, which helps one to do some simple graphic stuff in a python script (as far as I understand).

It is not like i'm stuck, but when I execute the folowing code:

import pylab as p
import graphics as g

window = g.GraphWin("tryout", 600, 600)
window.close()
print p.sqrt(4)

The output is:

>>>runfile(r'C:\some\folders\tryout.py', wdir=r'C:\some\folders')
>>>UMD has deleted: graphics
>>>2.0

line 1 is obviously o.k. and so is line 3, but I don't get line 2. Also, the provoked window flashes in and out of the screen, as it should. Line 2 doesn't seem to do any harm, and i can perfectly rerun the file as many times as I wan't, but I want to know where it is comming from.

AFAIK UMD forces the interpreter to reload a module everytime a script is run. Does the displayed message mean that 'it' has deleted the references to the module, because it isn't used anymore, or is it something else? Or does it mean something is wrong, and will it 'hurt' my code should I add more afterwards?

Note: first question, so please comment the crap out of it to help me improve my asking skills.

EDIT: i tried shifting around the test line print p.sqrt(4), and found out that it doesn't matter where I put it. If its the first line after importing the modules, it still raisses the message before showing sqrt(4)


Source: (StackOverflow)

Advertisements

Downgrade to previous version of Spyder

I'm currently using the Anaconda package with Python 2.7.9-1

Yesterday I upgraded the Spyder-app via the Anaconda Launcher and all of my scripts now crash. (Some bugs are already reported in the issues page https://github.com/spyder-ide/spyder/issues). How can I downgrade to the previous Spyder version meanwhile those bugs are fixed?

Thanks

Gabriel


Source: (StackOverflow)

Spyder/Python install on MacOS - very frustrating

I have read through various posts here on the pros/cons of a wide array of Python environments. That being said, I am even more confused than prior to engaging in this due diligence.

My application is algorithmic trading, backtesting and analytical tool development and so I know I want the following functionality:

-numpy

-scipy

-Matplotlib

-spyder IDE

It seems like the installation of spyder on macos is non-trivial based on comments posted by users here http://code.google.com/p/spyderlib/wiki/Installation and so before I go down a rabbit hole I was wondering if someone could better guide me on the process and pre-requisites.

I came across the following post on stackoverflow, which seemed to indicate that I could just install the EPD-7.1 distribution and then install spyder separately but I'm not sure if the EPD distribution comes with all of the pre-requisites necessary for spyder.

Python distributions and environments for scientific computing

The following seems to be a guide on how to install spyder on macos but I'm not sure if this is current and whether installation of EPD makes some of the steps unnecessary.

http://works13.com/blog/mac/howto-install-spyder-1-x-on-mac-os-x-with-64bit-python.htm

Lastly, if I were to install EPD - is it better to go with 32-bit or 64-bit.

Thank you very much for your guidance.


Source: (StackOverflow)

Python: How to tell Spyder's style analysis PEP8 to read from a setup.cfg or increase max. line length?

I am using Spyder 2.3.1 and python(x, y).

In the preferences of Spyder you can activate "Style analysis". This is quite nice, but I want to increase the max. tolerable line length. The standard setting for PEP8 is 79 characters. This can be changed through a setup.cfg with the content:

[pep8] max-line-length = 99

This can be read here: http://pep8.readthedocs.org/en/latest/intro.html#related-tools

Where do I put a setup.cfg so Spyder/PEP8 will recognize my new limit? Or is there an other way to set this limit or to ignore E501 (line to long)? Just setting "Show vertical line after 99 characters" in Spyder does not help


Source: (StackOverflow)

pylint can't find QtCore in PyQt4

I recently installed Python(x,y) for spyder and the PyQt4 support. I selected pylint during the install process, and loaded up a script from the code resources for 'Rapid GUI Development with Python & Qt4'... specifically the first simple 'alert.pyw' from chapter 4.

Pylint is saying that this is an error:

from PyQt4.QtCore import (QTime, QTimer, Qt, SIGNAL)

...and here is the error message:

[E0611]19: No name 'QtCore' in module 'PyQt4'

...but in both the regular Python interpreter (2.7.3) and the ipython interpreter (0.13) I can type in:

from PyQt<tab>4.QtC<tab>ore

and the auto-complete seems to find it just fine.

Is there some way to get pylint set up so it sees things that are obviously there, or am I better off disabling pylint and going back to pyflakes or something else?


Source: (StackOverflow)

Basics of setting up a Spyder workspace and projects

I have searched for a basic tutorial regarding workspaces and projects in the Spyder IDE. What I want to understand is the basic concepts of how to use the workspace and projects to organize my code. It seems that this is perhaps basic programming skills and that is the reason why I have issues finding any kind of overview. This page seems to be related, but is actually about Eclipse and rather sparse. The Pythonxy tutorial and the documentation for Spyder does not go into any detail. Neither does the Anaconda documentation.

The questions I have are:

When should I set up a new workspace (if ever)?

When do I create a new project?

How does the PYTHONPATH depend on my workspace and project settings? Is it the same in all cases or can I customize it per workspace/project?

Are there other settings apart from the PYTHONPATH that I should configure?

How specific are the answers above to Spyder? Would it be the same for other IDEs, like Eclipse?

I am running Spyder on 64-bit Windows 7, as part of the Anaconda package.


Source: (StackOverflow)

Ways to invoke python and Spyder on OSX

I recently bought a MacBook and install Python on it via Anaconda. Here's the version information:

Python 2.7.6 |Anaconda 1.8.0 (x86_64)| (default, Nov 11 2013, 10:49:09) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin

I'd like to be able do all of the following:

  1. Launch Spyder without having to go through the Launcher application (say, by typing things into Spotlight and Quicksilver)
  2. Run Python code from the Finder, presumably by double-clicking on my .py file or by selecting and and pressing Cmd-O
  3. Run Python code by typing a Python script's name into Quicksilver (as if it was a regular program)

Here's what I've tried:

  1. (nothing; no ideas here)
  2. I've associated .py files with /Users/kuzzooroo/anaconda/python.app/Contents/MacOS/python and made them executable (chmod u+x). When I try to run the application never launches and I don't get an error message (don't know where to look)
  3. Made the files executable and tried to run them from Spotlight. Same result as #2.

Here's what I can do:

  • Run my code from a Terminal window, if I have the right shebang on top and have made the file executable
  • Generate an application using py2app. Unfortunately, this method suffers the following drawbacks:
    • I frequently modify my scripts and would prefer not to have to run py2app every time I do
    • Even for a trivial script the resulting app is 7 MB
    • To run the application in some contexts I have to dig around in the bundle to find the actual "Unix Executable File" and run that instead

Once I have this working, I'm interested in doing the following:
A. Controlling which scripts create a console window when they run and which do not
B. Controlling whether the resulting console window disappears when the script completes or waits around for the user (me) to close it
However, I suspect it may be easy to figure out how to do these (or whether it's possible) once I've figured out how I'm going to invoke my scripts in the first place.


Source: (StackOverflow)

Spyder does not autocomplete local variables

I'm having a problem getting my local variables autocompleted. This is a very basic functionality which I'm sure it should support. When I'm starting to write a variable name which was already declared, and press TAB (this is the default shortcut), I get nothing. Is this a bug?


Source: (StackOverflow)

if __name__ == '__main__' not working ipython

I'm having trouble getting the if __name == '__main__' trick to work in an IPython, Spyder environment. I've tried every approach given in this thread: if __name__ == '__main__' in IPython

Here are my super simplified modules

Module1.py

Class UnitTest():
    print 'Mod1 UnitTest!'

if __name__ == '__main__':
    UnitTest()

Module2.py

import Module1

Class UnitTest():
    print 'Mod2 UnitTest!'

if __name__ == '__main__':
    UnitTest()

So I run Module2.py and I always am seeing both Mod2 UnitTest and Mod1 UnitTest printed. These are executing in an IPython kernel. I want only the Mod2 UnitTest message to display.

Any idea what's up?


Source: (StackOverflow)

Running Cython code within the interpreter

I'm a Matlab and C++ user, and have recently discovered python (spyder) as a possible replacement for both. One of the main benefits I thought python had was the ability to work in interpreter mode, and then seamlessly translate it into fast compiled code once I'm satisfied with the result. The interpreted environment is great for prototyping, analyzing data while stopped at a breakpoint, throwing plots and images all around, etc.

I started looking into Cython, and I don't fully understand the programming flow. Lets say you have a .py code you'd like to speed up - Do you have to write a .pyx file from scratch? Can you run a .pyx file in interpreted mode as if it were a regular .py file (before compiling)? How do you debug the code in a .pyx file?


Source: (StackOverflow)

Anaconda Spyder Qt library error on launch

When launching Spyder from the Anaconda python installation on Linux Mint 13 I get the following error:

Cannot mix incompatible Qt library (version 0x40801) with this library (version 0x40805)
Aborted

$PATH is

   /home/ron/anaconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

Has anyone found a work around?

Anaconda web-site indicates that Spyder may not launch correctly on Linux machines.

http://docs.continuum.io/anaconda/

*** Resolved I am a little sheepish. Discovered that I installed Anaconda as sudo. Reinstalled as indicated in documentation and everything works fine. Thanks everyone for the help.


Source: (StackOverflow)

Can't get ipython console in spyder

I'm having trouble getting an ipython console in Spyder. It only offers a python interpreter under the "interpreters" menu.

I've seen this issue for a couple of others in Stackoverflow, but didn't have much joy with the proffered solutions.

I'm running linux Mint 16 and have installed both ipython (v 1.1.0) and Spyder (v 2.2.1) the easy way via the Mint Software Manager. I made sure that I also installed ipython-qtconsole and verified that I could run it from a terminal (i.e. ipython qtconsole).

I can activate an ipython console using the following commands in a Spyder python console:

import IPython
IPython.start_ipython()

though the font coloring is strange and doesn't work well on a white background (e.g. error messages in yellow and light green). It would be nice anyway to be able to start ipython the normal way from the Spyder menu.


Source: (StackOverflow)

how to get spyder's python recognize external packages on MacOS X?

I have spyderlib installed on my MacOS X (10.6.8) using the official dmg file. In parallel, I have installed packages using both pip and homebrew from the terminal (i.e. opencv, gdal...). As Spyder is using its own python version, I cannot access my external packages within Spyder.

When Homebrew install a package, it instals it in the /usr/local/lib... directory, which is not avalaible to add using the Python Path manager of Spyder.The entire directory /usr/... is hidden.

The only relevant similar case I found online was the following: Adding a module (Specifically pymorph) to Spyder (Python IDE)

I have tried unsuccessfuly their recommendations. So two related questions to tackle the problem:

1- would it be possible to actually use in Spyder the same python as the one accessed in the terminal?

2- otherwise, how to add external packages to the Spyder's original python, when the packages are installed in the folder /usr/local... ?

Thanks


Source: (StackOverflow)

Python Spyder reset

I was using python(x,y), which came with Spyder. Yesterday, Spyder crashed I can't figure it out how to fix it. I uninstalled python(x,y) and reinstalled, still the same problem.

If I try to open Spyder I get this message:

Spyder crashed during last session

If Spyder does not start at all and before submitting a bug report, please try to reset setting to defaults by running Spyder with the command line option '--reset:

python spyder --reset

Of course, I tried to do the above, but it doesn't seem like I have Spyder in my path. When I try to put

python spyder --reset

in my command prompt window, I get this error message:

python: can't open file 'spyder': [Errno 2] No such file or directory

I made some attempts of trying to add spyder to path, but they all failed. How should I go about adding Spyder to path?

I am using Windows Vista on a 32 bit system.

My Spyder Crash report looks like this:

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\spyderlib\spyder.py", line 1547, in main
    mainwindow = run_spyder(app, options)
  File "C:\Python27\lib\site-packages\spyderlib\spyder.py", line 1472, in run_spyder
    main.setup()
  File "C:\Python27\lib\site-packages\spyderlib\spyder.py", line 555, in setup
    multithreaded=self.multithreaded)
  File "C:\Python27\lib\site-packages\spyderlib\plugins\console.py", line 54, in __init__
    light_background=light_background)
  File "C:\Python27\lib\site-packages\spyderlib\widgets\internalshell.py", line 101, in __init__
    debug, profile)
  File "C:\Python27\lib\site-packages\spyderlib\widgets\shell.py", line 698, in __init__
    ShellBaseWidget.__init__(self, parent, history_filename, debug, profile)
  File "C:\Python27\lib\site-packages\spyderlib\widgets\shell.py", line 61, in __init__
    self.history = self.load_history()
  File "C:\Python27\lib\site-packages\spyderlib\widgets\shell.py", line 500, in load_history
    if rawhistory[1] != self.INITHISTORY[1]:
IndexError: list index out of range

I am terrible with this stuff, so I might be missing something completely obvious or doing something really stupid.

I am wondering if anyone else ran into a similar problem, or can just give suggestions on what to do, and how to do this "reset" thing, or maybe other advice.

Thank You in Advance


Source: (StackOverflow)