Hi,

What version of spyder are you using, and from what source did you install
it?

It seems Spyder is not aware of the location of several python modules: I
can see from your spyder traceback that pylab also fails to load, have you
installed matplotlib, or can you import pylab from the normal python
console? In Spyder, can you import any other modules you have installed?

In theory your issue should be fixed by adding the directories of your
modules to your PYTONPATH environment variable.
In Spyder you can use the PYTHONPATH manager for this: Tool > PYTHONPATH
Manager and add the path to your nltk module. Note that this shouldn't be
necessary, so their is either something wrong with your Spyder
installation, PYTHONPATH or nltk install.

You could check which paths are set in your PYTHONPATH environment
variable, from a Python/Spyder console:
import sys
for p in sys.path: print k
I don't know how it is on Mac exactly, but I think you should see some
entries that contain python/site-packages.

There have been some issues on Mac that got solved in the latest beta's
recently. If you are not running the latest beta, you could try to install
that one.

Regards,
David


On 28 March 2013 09:08, Måns Magnusson <[email protected]> wrote:

> Hi all!
>
> I have a problem when i try to use nltk in Spyder. I've installed the nltk
> package in Python so when I use python in the console (see the debug code 3
> below) it works just fine. But When I try to use it in Spyder it doesn't
> work. Ive tried both with default values of python path (in
> Spyder-Preferences-Console-Advanced-Python executable) and with
> /usr/bin/python but it does not work. See the output below.
> Im quite new to Python.
>
> When I start Spyder (in the ordinary way) -
> /Applications/Spyder.app/Contents/MacOS/python
> Python 2.7.3 (default, Jul 24 2012, 20:20:13)
> [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)] on
> darwin
> Type "help", "copyright", "credits" or "license" for more information.
>
> Imported NumPy 1.6.2, SciPy 0.11.0, Matplotlib 1.2.0
> Type "scientific" for more details.
>
> >>> import nltk
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named nltk
>
>
> When I start Spyder (in the other suggested path) - /usr/bin/python
>
> Python 2.7.2 (default, Jun 20 2012, 16:23:33)
> [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on
> darwin
> Type "help", "copyright", "credits" or "license" for more information.
> Traceback (most recent call last):
>   File
> "/Applications/Spyder.app/Contents/Resources/lib/python2.7/spyderlib/scientific_startup.py",
> line 16, in <module>
>     from pylab import *  #analysis:ignore
> ImportError: No module named pylab
> >>> import nltk
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named nltk
> >>>
>
>
> And if I run python in the terminal - it works!?
>
> Manss-MacBook-Pro-2:~ mansmagnusson$ python
> Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import nltk
> >>>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "spyder" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/spyderlib?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to