Can't Get NetworkX to run in Spyder

2,020 views
Skip to first unread message

Chris

unread,
Mar 18, 2015, 5:27:17 AM3/18/15
to spyd...@googlegroups.com
Hi,

I am trying to run NetworkX in Spyder but am unable to get the module networkx recognised.

I downloaded NetworkX from  http://pypi.python.org/pypi/networkx and installed NetworkX via pip using "pip install networkx". It appeared to complete OK. When I repeat the command I get

Last login: Wed Mar 18 20:07:35 on ttys000

Fl1cker:~ cbhe$ pip install networkx

Requirement already satisfied (use --upgrade to upgrade): networkx in /Library/Python/2.7/site-packages/networkx-1.9.1-py2.7.egg

Requirement already satisfied (use --upgrade to upgrade): decorator>=3.4.0 in /Library/Python/2.7/site-packages/decorator-3.4.0-py2.7.egg (from networkx)

Fl1cker:~ cbhe$ 


which suggests to me that it is installed.

However when I try to import network in Spyder using "import networkx as nx" I get

runfile('Z:/Users/cbhe/scripts/netw0.py', wdir='Z:/Users/cbhe/scripts')
Traceback (most recent call last):

  File "<ipython-input-2-5455c9a69031>", line 1, in <module>
    runfile('Z:/Users/cbhe/scripts/netw0.py', wdir='Z:/Users/cbhe/scripts')

  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 601, in runfile
    execfile(filename, namespace)

  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 66, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)

  File "Z:/Users/cbhe/scripts/netw0.py", line 1, in <module>
    import networkx as nx

ImportError: No module named networkx

I can only think that it is a Python Path issue, but I have tried numerous paths that all produce the same result.

Any suggestions would be really welcome as I am being held up by this problem.











Adrian Klaver

unread,
Mar 18, 2015, 10:01:27 AM3/18/15
to spyd...@googlegroups.com
> ImportError: No module named http://www.postgresql.org/docs/9.3/interactive/app-pgbasebackup.html
>
> I can only think that it is a Python Path issue, but I have tried
> numerous paths that all produce the same result.
>
> Any suggestions would be really welcome as I am being held up by this
> problem.

Some information is needed I think.

1) Your pip install lines look they where done on a Unix* machine, but
the traceback looks like it comes from a Windows machine.
Could you explain your layout some?

2) What version of Spyder and how was it installed?

3) Can you open a Python interpreter and import networkx?

>
>
>


--
Adrian Klaver
adrian...@aklaver.com

Chris Edwards

unread,
Mar 18, 2015, 4:46:11 PM3/18/15
to spyd...@googlegroups.com
Adrian,

Thanks for the quick reply.

I am running OS X 10.10.2 and have a Parallels 10.1.4 Windows 7 virtual machine. I can run Spyder 2.3.2 in both OS X and Windows 7.

Both the Windows and OS X Spyder were installed from downloaded installers. I can execute Python code on both instances.

NetworkX was installed via the OS X command line using pip and I have tried to access it in both the OS X and Windows Spyder, but get the same message.

I opened a python interpreter via the command line command. The attached screenshot shows the result; which I interpret to show that networkx was imported.

I hope this helps in understanding my problem.

Chris


--
You received this message because you are subscribed to a topic in the Google Groups "spyder" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spyderlib/RxXRhb2pQOI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spyderlib+...@googlegroups.com.
To post to this group, send email to spyd...@googlegroups.com.
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout


Adrian Klaver

unread,
Mar 18, 2015, 5:42:12 PM3/18/15
to spyd...@googlegroups.com
On 03/18/2015 01:45 PM, Chris Edwards wrote:
> Adrian,
>
> Thanks for the quick reply.
>
> I am running OS X 10.10.2 and have a Parallels 10.1.4 Windows 7 virtual
> machine. I can run Spyder 2.3.2 in both OS X and Windows 7.
>
> Both the Windows and OS X Spyder were installed from downloaded
> installers. I can execute Python code on both instances.
>
> NetworkX was installed via the OS X command line using pip and I have
> tried to access it in both the OS X and Windows Spyder, but get the same
> message.
>
> I opened a python interpreter via the command line command. The attached
> screenshot shows the result; which I interpret to show that networkx was
> imported.
>
> I hope this helps in understanding my problem.

Yes, I think. For now and to keep the moving parts to a minimum lets
stay in one OS. Since the chances that a Windows VM can see libraries
installed on OS X would seem to be slim to none, lets stick with OS X.

FYI another way to see if pip has installed something is to do:

pip freeze

which can return a lot of information. So in this case on OS X:

pip freeze | grep -i networkx

The screenshot shows that networkx has been installed in OS X.

What happens if you run Spyder in OS X and in either the Python or
IPython console do?:

import networkx as nx

>
> Chris
>
>


--
Adrian Klaver
adrian...@aklaver.com

Chris Edwards

unread,
Mar 20, 2015, 5:49:47 AM3/20/15
to spyd...@googlegroups.com
Adrian,

Sorry about the delay, I’ve been on the road (again).

So I did the pip freeze and it returned

Last login: Fri Mar 20 20:31:24 on ttys000
Fl1cker:~ cbhe$ pip freeze | grep -i networkx
networkx==1.9.1
Fl1cker:~ cbhe$ exit
logout

[Process completed]

The result when I open Spyder in OS X and  run “import networkx as nx” in the IPython and Python consoles is shown in the two attached screenshots.

To me this suggests a path issue but ????

Chris


--
You received this message because you are subscribed to a topic in the Google Groups "spyder" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spyderlib/RxXRhb2pQOI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spyderlib+...@googlegroups.com.
To post to this group, send email to spyd...@googlegroups.com.
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.


Adrian Klaver

unread,
Mar 20, 2015, 9:46:25 AM3/20/15
to spyd...@googlegroups.com
On 03/20/2015 02:49 AM, Chris Edwards wrote:
> Adrian,
>
> Sorry about the delay, I’ve been on the road (again).
>
> So I did the pip freeze and it returned
>
> Last login: Fri Mar 20 20:31:24 on ttys000
> Fl1cker:~ cbhe$ pip freeze | grep -i networkx
> networkx==1.9.1
> Fl1cker:~ cbhe$ exit
> logout
>
> [Process completed]
>
> The result when I open Spyder in OS X and run “import networkx as nx”
> in the IPython and Python consoles is shown in the two attached screenshots.

But you are not doing import networkx as nx, you are doing
runfile(some_script).

In the consoles at the prompt type import networkx as nx and see if that
works?

Also could you just cut and paste the commands and the tracebacks into
the email instead of using screenshots. It just makes it easier to
follow, less context shifts. Thanks.

>
> To me this suggests a path issue but ????
>
> Chris
>



--
Adrian Klaver
adrian...@aklaver.com

Chris Edwards

unread,
Mar 20, 2015, 5:46:44 PM3/20/15
to spyd...@googlegroups.com
Adrian,

 I misunderstood your request. Here are the results:

From IPython console

In [2]: import networkx as nx
Traceback (most recent call last):

File "<ipython-input-2-6002206e7c09>", line 1, in <module>
import networkx as nx

ImportError: No module named networkx

From Python console

import networkx as nx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named networkx
>>> 

Chris


Adrian Klaver

unread,
Mar 20, 2015, 7:43:30 PM3/20/15
to spyd...@googlegroups.com
On 03/20/2015 02:46 PM, Chris Edwards wrote:
> Adrian,
>
> I misunderstood your request. Here are the results:
>
> _From IPython console_
>
> In [2]: import networkx as nx
> Traceback (most recent call last):
>
> File "<ipython-input-2-6002206e7c09>", line 1, in <module>
> import networkx as nx
>
> ImportError: No module named networkx
>
> _From Python console_
>
> import networkx as nx
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named networkx
>>>>

Hmmm.

I know you said you installed Spyder using an installer previously, so
which one was that exactly?

Do you have more than one Python version installed on OS X?

Chris Edwards

unread,
Mar 21, 2015, 2:05:51 AM3/21/15
to spyd...@googlegroups.com
Adrian,

Further to your question about more than one version of Python see the extract from my /usr/bin below:

40 -rwxr-xr-x   1 root   wheel     43760 10 Sep  2014 pwpolicy
   0 -rwxr-xr-x   5 root   wheel       925 10 Sep  2014 pydoc
   8 lrwxr-xr-x   1 root   wheel        74 22 Oct 18:20 pydoc2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pydoc2.6
   8 lrwxr-xr-x   1 root   wheel        74 22 Oct 18:20 pydoc2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc2.7
  32 -rwxr-xr-x   2 root   wheel     58432 10 Sep  2014 python
   0 -rwxr-xr-x   5 root   wheel       925 10 Sep  2014 python-config
   8 lrwxr-xr-x   1 root   wheel        75 22 Oct 18:20 python2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
   8 lrwxr-xr-x   1 root   wheel        82 22 Oct 18:20 python2.6-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config
   8 lrwxr-xr-x   1 root   wheel        75 22 Oct 18:20 python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
   8 lrwxr-xr-x   1 root   wheel        82 22 Oct 18:20 python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
  32 -rwxr-xr-x   2 root   wheel     58432 10 Sep  2014 pythonw
   8 lrwxr-xr-x   1 root   wheel        76 22 Oct 18:20 pythonw2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6
   8 lrwxr-xr-x   1 root   wheel        76 22 Oct 18:20 pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
  32 -rwxr-xr-x   1 root   wheel     45120 10 Sep  2014 qc2movie
   8 lrwxr-xr-x   1 root   wheel       100 22 Oct 18:19 qlmanage -> ../../System/Library/Frameworks/QuickLook.framework/Resources/quicklookd.app/Contents/MacOS/qlmanage
  40 -rwxr-xr-x   1 root   wheel     51040 10 Sep  2014 qtdefaults

What is the next action - what to delete? Perhaps delete the lot and start again?

Chris


On 21 Mar 2015, at 2:40 pm, Chris Edwards <cb...@ozemail.com.au> wrote:

Adrian,

I probably have two versions of Python installed as I was using Spyder in 2012 and then downloaded the current version (via spyder-2.3.2-py2.7.dmg) in January of this year. Details of the current OS X version of Spyder are below:

----------------------------------------------------------------
Spyder 2.3.2
The Scientific PYthon Development EnviRonment

Copyright © 2009-2012 Pierre Raybaut
Licensed under the terms of the MIT License

Created by Pierre Raybaut
Developed and maintained by the Spyder Development Team
Many thanks to all the Spyder beta-testers and regular users.

Most of the icons come from the Crystal Project (© 2006-2007 Everaldo Coelho). Other icons by Yusuke Kamiyamane (All rights reserved) and by The Oxygen icon theme.

Spyder's community:

This project is part of a larger effort to promote and facilitate the use of Python for scientific and engineering software development. The popular Python distributions Python(x,y) and WinPython also contribute to this plan.

Python 2.7.8 64bits, Qt 4.8.6, PyQt4 (API v2) 4.11.1 on Darwin

————————————————————————————————————

Details of the Windows 2012  (Spyder 2.1.18, accessed by one Windows VM) and of the Windows 2015 (Spyder 2.3.2, accessed by the other Windows VM) are in the attached screenshots (sorry, I couldn’t seem to cut and paste them).

How do I tell if I have more than Python version installed on OS X?

Chris



--
You received this message because you are subscribed to a topic in the Google Groups "spyder" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spyderlib/RxXRhb2pQOI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spyderlib+...@googlegroups.com.
To post to this group, send email to spyd...@googlegroups.com.
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.


<Screen Shot 2015-03-21 at 12.09.08 pm.png><Screen Shot 2015-03-21 at 2.20.13 pm.png>

Adrian Klaver

unread,
Mar 21, 2015, 9:45:14 AM3/21/15
to spyd...@googlegroups.com
On 03/20/2015 11:05 PM, Chris Edwards wrote:
> Adrian,
>
I am not a OS X user so I getting into deep water here, but to me it
looks like there are three versions of Python installed. I say this
because of lines like this:

32 -rwxr-xr-x 2 root wheel 58432 10 Sep 2014 python

I do not see anything pointing at them or they pointing at anything
else, which would seem to indicate to me they are a separate instance of
Python. This would need confirmation from someone that actually
understands OS X. I would hesitate deleting everything as I pretty sure
the system probably needs Python for something. I could see uninstalling
the Spyder dmgs and then seeing what you have.


>>
>> Details of the Windows 2012 (Spyder 2.1.18, accessed by one Windows
>> VM) and of the Windows 2015 (Spyder 2.3.2, accessed by the other
>> Windows VM) are in the attached screenshots (sorry, I couldn’t seem to
>> cut and paste them).

The screenshots did not come through. In any event for the VMs you will
need networkx installed in each for Spyder to pick it up.

>>
>> How do I tell if I have more than Python version installed on OS X?

I did a Google search on this and came away more confused then
enlightened. If it where me I would look for site-packages directories.
As to finding out what is running on the command line do:

python --version

and for the symlinks above:

python2.6 --version
python2.7 --version

Chris Edwards

unread,
Mar 21, 2015, 4:17:17 PM3/21/15
to spyd...@googlegroups.com
Adrian,

I probably have two versions of Python installed as I was using Spyder in 2012 and then downloaded the current version (via spyder-2.3.2-py2.7.dmg) in January of this year. Details of the current OS X version of Spyder are below:

----------------------------------------------------------------
Spyder 2.3.2
The Scientific PYthon Development EnviRonment

Copyright © 2009-2012 Pierre Raybaut
Licensed under the terms of the MIT License

Created by Pierre Raybaut
Developed and maintained by the Spyder Development Team
Many thanks to all the Spyder beta-testers and regular users.

Most of the icons come from the Crystal Project (© 2006-2007 Everaldo Coelho). Other icons by Yusuke Kamiyamane (All rights reserved) and by The Oxygen icon theme.

Spyder's community:

This project is part of a larger effort to promote and facilitate the use of Python for scientific and engineering software development. The popular Python distributions Python(x,y) and WinPython also contribute to this plan.

Python 2.7.8 64bits, Qt 4.8.6, PyQt4 (API v2) 4.11.1 on Darwin

————————————————————————————————————

Details of the Windows 2012  (Spyder 2.1.18, accessed by one Windows VM) and of the Windows 2015 (Spyder 2.3.2, accessed by the other Windows VM) are in the attached screenshots (sorry, I couldn’t seem to cut and paste them).

How do I tell if I have more than Python version installed on OS X?

Chris



--
You received this message because you are subscribed to a topic in the Google Groups "spyder" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spyderlib/RxXRhb2pQOI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spyderlib+...@googlegroups.com.
To post to this group, send email to spyd...@googlegroups.com.
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.


Chris Edwards

unread,
Mar 22, 2015, 2:59:03 AM3/22/15
to spyd...@googlegroups.com
Adrian,

As requested:

Last login: Sun Mar 22 11:23:25 on console
Fl1cker:~ cbhe$ python --version
Python 2.7.6
Fl1cker:~ cbhe$ python2.6 --version
Python 2.6.9
Fl1cker:~ cbhe$ python2.7 --version
Python 2.7.6
Fl1cker:~ cbhe$ exit
logout

[Process completed]


In desperation I uninstalled Spyder from both Windows VMs and then downloaded the latest applicable version of Python (2.7.9rc1) and Spyder. See below:

Last login: Sun Mar 22 17:21:21 on ttys000
Fl1cker:~ cbhe$ echo $PATH
/Library/Frameworks/Python.framework/Versions/2.7/bin: /Users/cbhe/scripts: /usr/local/bin: /usr/bin: /bin: /usr/sbin: /sbin::/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Fl1cker:~ cbhe$ python --version
Python 2.7.9rc1
Fl1cker:~ cbhe$ python2.6 --version
Python 2.6.9
Fl1cker:~ cbhe$ python2.7 --version
Python 2.7.9rc1
Fl1cker:~ cbhe$ python
Python 2.7.9rc1 (v2.7.9rc1:40eada278702, Nov 25 2014, 17:25:50) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import networkx as nx
>>> ^D
Fl1cker:~ cbhe$ exit
logout

[Process completed]

-----------------------------------------------------------------
Spyder 2.3.3
The Scientific PYthon Development EnviRonment

Copyright © 2009-2012 Pierre Raybaut
Copyright © 2010-2015 The Spyder Development Team

Licensed under the terms of the MIT License

Created by Pierre Raybaut
Developed and maintained by the Spyder Development Team
Many thanks to all the Spyder beta-testers and regular users.

Most of the icons come from the Crystal Project (© 2006-2007 Everaldo Coelho). Other icons by Yusuke Kamiyamane (all rights reserved) and by The Oxygen icon theme.

For bug reports and feature requests, please go to our Github website. For discussions around the project, please go to our Google Group

This project is part of a larger effort to promote and facilitate the use of Python for scientific and engineering software development. The popular Python distributions Anaconda, WinPython and Python(x,y) also contribute to this plan.

Python 2.7.8 64bits, Qt 4.8.6, PyQt4 (API v2) 4.11.1 on Darwin

---------------------------------------------------------------

There was no change in behaviour and I still can’t import NetworkX from within Spyder. I have actually successfully executed a program using NetworkX from the command line!

I think what I need to do is somehow make Spyder recognise Python 2.7.9 but feel I am in some sort of infinite loop here!

I gather from searching the web that I am not the first to have run into problems with multiple versions of Python and wonder if his has been addressed somewhere that I haven’t discovered.

Anyway thanks for the help so far.

Chris




Adrian Klaver

unread,
Mar 22, 2015, 10:32:33 AM3/22/15
to spyd...@googlegroups.com
On 03/21/2015 11:58 PM, Chris Edwards wrote:
> Adrian,
>
Sp python is pointing at the latest version.

> Python 2.7.9rc1 (v2.7.9rc1:40eada278702, Nov 25 2014, 17:25:50)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import networkx as nx
> >>> ^D


Here you should do:

>>> help(networkx)

to see where it is actually installed

So something like:
>>> import psycopg2
>>> help(psycopg2)

Help on package psycopg2:

NAME
psycopg2 - A Python driver for PostgreSQL

FILE
/usr/lib/python2.7/site-packages/psycopg2/__init__.py
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

While you are in the Python interpreter I would also do:

>>> import sys
>>> sys.path

This will show you the PYTHONPATH the system interpreter is seeing.

> Fl1cker:~ cbhe$ exit
> logout
>
> [Process completed]
>
> -----------------------------------------------------------------
> Spyder 2.3.3
> The Scientific PYthon Development EnviRonment

> Python 2.7.8 64bits, Qt 4.8.6, PyQt4 (API v2) 4.11.1 on Darwin
>
> ---------------------------------------------------------------
>
> There was no change in behaviour and I still can’t import NetworkX from
> within Spyder. I have actually successfully executed a program using
> NetworkX from the command line!
>
> I think what I need to do is somehow make Spyder recognise Python 2.7.9
> but feel I am in some sort of infinite loop here!
>
> I gather from searching the web that I am not the first to have run into
> problems with multiple versions of Python and wonder if his has been
> addressed somewhere that I haven’t discovered.
>
> Anyway thanks for the help so far.
>
> Chris
>
>
>
>



--
Adrian Klaver
adrian...@aklaver.com

Adrian Klaver

unread,
Mar 22, 2015, 3:02:56 PM3/22/15
to spyd...@googlegroups.com
On 03/21/2015 11:58 PM, Chris Edwards wrote:
> Adrian,
>

> Python 2.7.8 64bits, Qt 4.8.6, PyQt4 (API v2) 4.11.1 on Darwin
>
> ---------------------------------------------------------------
>
> There was no change in behaviour and I still can’t import NetworkX from
> within Spyder. I have actually successfully executed a program using
> NetworkX from the command line!
>
> I think what I need to do is somehow make Spyder recognise Python 2.7.9
> but feel I am in some sort of infinite loop here!

End of previous post edited:

While you are in the Python interpreter I would also do:

>>> import sys
>>> sys.path

This will show you the PYTHONPATH the system interpreter is seeing.

Repeat this in your Spyder Python/IPython consoles to determine what
PYTHONPATH they are seeing.

>
> I gather from searching the web that I am not the first to have run into
> problems with multiple versions of Python and wonder if his has been
> addressed somewhere that I haven’t discovered.
>
> Anyway thanks for the help so far.
>
> Chris
>
>
>
>

--
Adrian Klaver
adrian...@aklaver.com

Chris Edwards

unread,
Mar 23, 2015, 12:13:26 AM3/23/15
to spyd...@googlegroups.com
Adrian,

From Terminal - Python interpreter path below:

>>> import sys
>>> sys.path
['', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/spyder-1.1.3-py2.7.egg', '/Library/Python/2.7/site-packages/PyMetis-2014.1-py2.7-macosx-10.10-intel.egg', '/Library/Python/2.7/site-packages/networkx-1.9.1-py2.7.egg', '/Library/Python/2.7/site-packages/decorator-3.4.0-py2.7.egg', '/Library/Python/2.7/site-packages/metis-0.1a-py2.7.egg', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages']
>>> 

From Spyder - Python Console path below:

>>> sys.path
['', '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell', '/Library/Python/2.7/site-packages/networkx-1.9.1-py2.7.egg', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/spyder-1.1.3-py2.7.egg', '/Users/cbhe/scripts', '/Users/cbhe/Documents/Python User Files 2015/Development Code', '/Applications/Spyder-Py2.app/Contents/Resources', '/Applications/Spyder-Py2.app/Contents/Resources/lib/python27.zip', '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7', '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-darwin', '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-mac', '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-mac/lib-scriptpackages', '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-tk', '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-old', '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-dynload', '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/site-packages.zip', '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/site-packages']
>>> 

From Spyder - When I try to open an IPython Console I get:

An error ocurred while starting the kernel

I don’t understand why this error should suddenly appear. I uninstalled Spyder and then reinstalled it from the .dmg download but still got the same error.

From the above it seems clear that the two paths are different. Now, how does one (hopefully easily) correct the Spyder system path??

Chris

 

Adrian Klaver

unread,
Mar 23, 2015, 12:02:55 PM3/23/15
to spyd...@googlegroups.com
On 03/22/2015 09:13 PM, Chris Edwards wrote:
> Adrian,
>
> _From Terminal - Python interpreter path below:_
>
> >>> import sys
> >>> sys.path
> ['',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/spyder-1.1.3-py2.7.egg',
> '/Library/Python/2.7/site-packages/PyMetis-2014.1-py2.7-macosx-10.10-intel.egg',
> '/Library/Python/2.7/site-packages/networkx-1.9.1-py2.7.egg',
> '/Library/Python/2.7/site-packages/decorator-3.4.0-py2.7.egg',
> '/Library/Python/2.7/site-packages/metis-0.1a-py2.7.egg',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
> '/Library/Python/2.7/site-packages']
> >>>
>
> _From Spyder - Python Console path below:_
>
> >>> sys.path
> ['',
> '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell',
> '/Library/Python/2.7/site-packages/networkx-1.9.1-py2.7.egg',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/spyder-1.1.3-py2.7.egg',
> '/Users/cbhe/scripts', '/Users/cbhe/Documents/Python User Files
> 2015/Development Code',
> '/Applications/Spyder-Py2.app/Contents/Resources',
> '/Applications/Spyder-Py2.app/Contents/Resources/lib/python27.zip',
> '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7',
> '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-darwin',
> '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-mac', '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-mac/lib-scriptpackages',
> '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-tk',
> '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-old',
> '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-dynload',
> '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/site-packages.zip',
> '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/site-packages']
> >>>
>
> _From Spyder - When I try to open an IPython Console I get:_

Can you open IPython from the OS X command line?

>
> An error ocurred while starting the kernel
>
> I don’t understand why this error should suddenly appear. I uninstalled
> Spyder and then reinstalled it from the .dmg download but still got the
> same error.
>
> From the above it seems clear that the two paths are different. Now,
> how does one (hopefully easily) correct the Spyder system path??

There are questions to be answered before we get that point:

1) Where is:

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/spyder-1.1.3-py2.7.egg'

coming from?

2) In the Spyder console path is:

'/Library/Python/2.7/site-packages/networkx-1.9.1-py2.7.egg',

So are you sure you cannot import it into the Spyder Python console?

3) What is in ?:

'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/site-packages'

4) Again, how exactly are you installing the system Python?

Chris Edwards

unread,
Mar 24, 2015, 7:09:02 AM3/24/15
to spyd...@googlegroups.com
Adrian,

Below are my attempts to answer your questions.

Attempt to run Ipython from OS X command line

————————————————————————————
Last login: Tue Mar 24 20:52:47 on ttys000
Fl1cker:~ cbhe$ python --version
Python 2.7.9rc1
Fl1cker:~ cbhe$ python
Python 2.7.9rc1 (v2.7.9rc1:40eada278702, Nov 25 2014, 17:25:50) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import networkx as nx
>>> ^D
Fl1cker:~ cbhe$ Ipython
-bash: Ipython: command not found
Fl1cker:~ cbhe$ ipython
-bash: ipython: command not found
Fl1cker:~ cbhe$ exit
logout

[Process completed]
—————————————————————————

So it appears that I can’t run IPython from the OS X command line and (as before) networkx can be imported by the system Python.


Where is '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/spyder-1.1.3-py2.7.egg’ coming from?

——————————————————————————————
Fl1cker:python2.7 cbhe$ cd /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Fl1cker:site-packages cbhe$ ls -l
total 728
-rw-rw-r--   1 root  admin     119 26 Nov 12:28 README
drwxrwxr-x   8 root  admin     272 22 Mar 15:25 _markerlib
-rw-rw-r--   1 cbhe  admin     210 22 Mar 15:25 easy-install.pth
-rw-rw-r--   1 root  admin     126 22 Mar 15:25 easy_install.py
-rw-rw-r--   1 root  admin     360 22 Mar 15:43 easy_install.pyc
-rw-rw-r--   1 root  admin     360 22 Mar 15:43 easy_install.pyo
-rw-rw-r--   1 root  admin  101530 22 Mar 15:25 pkg_resources.py
-rw-rw-r--   1 root  admin  119766 22 Mar 15:43 pkg_resources.pyc
-rw-rw-r--   1 root  admin  119766 22 Mar 15:43 pkg_resources.pyo
drwxrwxr-x  74 root  admin    2516 22 Mar 15:25 setuptools
drwxrwxr-x  11 root  admin     374 22 Mar 15:25 setuptools-7.0.dist-info
-rw-rw-r--   1 cbhe  admin      30 28 Jul  2010 setuptools.pth
drwxrwxr-x   5 cbhe  admin     170 28 Jul  2010 spyder-1.1.3-py2.7.egg
Fl1cker:site-packages cbhe$ 
————————————————————————————

It looks as if the directory was installed when I first started experimenting with Spyder in 2010.

Access to Networkx

Networkx is referenced in the path obtained from running

>>> import sys
>>> sys.path

from the terminal OS X command line and networkx can be imported successfully. It is not referenced in the Spyder console path and can’t be found by Spyder.


What is in /Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/site-packages?

————————————————————————————
Last login: Tue Mar 24 21:16:17 on ttys000
Fl1cker:~ cbhe$ cd /Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7
Fl1cker:python2.7 cbhe$ ls -l
total 35960
drwxr-xr-x@  27 cbhe  admin       918  4 Mar 08:45 IPython
drwxr-xr-x@ 180 cbhe  admin      6120  4 Mar 08:45 PIL
drwxr-xr-x@  26 cbhe  admin       884  4 Mar 08:45 PyQt4
drwxr-xr-x@  43 cbhe  admin      1462  4 Mar 08:45 astroid
drwxr-xr-x@   8 cbhe  admin       272  4 Mar 08:45 astroid-1.3.4.dist-info
drwxr-xr-x@   2 cbhe  admin        68  4 Mar 08:45 config
drwxr-xr-x@  90 cbhe  admin      3060  4 Mar 08:45 distutils
drwxr-xr-x@  24 cbhe  admin       816  4 Mar 08:45 docutils
drwxr-xr-x@  49 cbhe  admin      1666  4 Mar 08:45 jinja2
drwxr-xr-x@ 109 cbhe  admin      3706  4 Mar 08:45 lib-dynload
drwxr-xr-x@   5 cbhe  admin       170  4 Mar 08:45 logilab
-rw-r--r--@   1 cbhe  admin       308  4 Mar 08:45 logilab_common-0.63.2-py2.7-nspkg.pth
drwxr-xr-x@   9 cbhe  admin       306  4 Mar 08:45 logilab_common-0.63.2-py2.7.egg-info
drwxr-xr-x@ 140 cbhe  admin      4760  4 Mar 08:45 matplotlib
drwxr-xr-x@   4 cbhe  admin       136  4 Mar 08:45 minimal-lib
drwxr-xr-x@  12 cbhe  admin       408  4 Mar 08:45 mpl_toolkits
drwxr-xr-x@  43 cbhe  admin      1462  4 Mar 08:45 nose
drwxr-xr-x@  35 cbhe  admin      1190  4 Mar 08:45 numpy
drwxr-xr-x@  30 cbhe  admin      1020  4 Mar 08:45 pandas
drwxr-xr-x@  62 cbhe  admin      2108  4 Mar 08:45 patsy
drwxr-xr-x@  10 cbhe  admin       340  4 Mar 08:45 pep8-1.6.2.dist-info
-rw-r--r--@   1 cbhe  admin     81919  4 Mar 08:45 pep8.py
-rw-r--r--@   1 cbhe  admin     74848  4 Mar 08:45 pep8.pyc
drwxr-xr-x@  20 cbhe  admin       680  4 Mar 08:45 psutil
drwxr-xr-x@  16 cbhe  admin       544  4 Mar 08:45 pyflakes
drwxr-xr-x@  36 cbhe  admin      1224  4 Mar 08:45 pygments
drwxr-xr-x@  26 cbhe  admin       884  4 Mar 08:45 pylint
drwxr-xr-x@   9 cbhe  admin       306  4 Mar 08:45 pylint-1.4.1.dist-info
drwxr-xr-x@   7 cbhe  admin       238  4 Mar 08:45 rope
drwxr-xr-x@  34 cbhe  admin      1156  4 Mar 08:45 scipy
drwxr-xr-x@  30 cbhe  admin      1020  4 Mar 08:45 seaborn
-rw-r--r--@   1 cbhe  admin    444886  4 Mar 08:45 setuptools-5.4.2-py2.7.egg
-rw-r--r--@   1 cbhe  admin        29  4 Mar 08:45 setuptools.pth
-rw-r--r--@   1 cbhe  admin  17791131  4 Mar 08:45 site-packages.zip
lrwxr-xr-x    1 cbhe  admin        14  4 Mar 08:45 site.pyc -> ../../site.pyc
drwxr-xr-x@  28 cbhe  admin       952  4 Mar 08:45 skimage
drwxr-xr-x@  63 cbhe  admin      2142  4 Mar 08:45 sklearn
drwxr-xr-x@  50 cbhe  admin      1700  4 Mar 08:45 sphinx
drwxr-xr-x@  38 cbhe  admin      1292  4 Mar 08:45 spyderlib
drwxr-xr-x@  14 cbhe  admin       476  4 Mar 08:45 spyderplugins
drwxr-xr-x@  32 cbhe  admin      1088  4 Mar 08:45 statsmodels
drwxr-xr-x@  45 cbhe  admin      1530  4 Mar 08:45 sympy
drwxr-xr-x@  16 cbhe  admin       544  4 Mar 08:46 zmq
Fl1cker:python2.7 cbhe$ 
———————————————————————————————————

The only site-packages file is a .zip file that I assume came along with a download.


Installation of Python 2.7.9

I installed Python (hopefully correctly) by using the Launcher (icon looks like a V2 rocket) that accompanied the download.I don’t understand the relationship between the /Library and the /Applications file references but they appear to me to be the main difference between the system Python path and the Spyder Python path

I suspect these answers may not really address what you want to know but hope they help in some way.

Chris


Adrian Klaver

unread,
Mar 24, 2015, 9:57:07 AM3/24/15
to spyd...@googlegroups.com
On 03/24/2015 04:08 AM, Chris Edwards wrote:
> Adrian,
>
> Below are my attempts to answer your questions.
>
> _Attempt to run Ipython from OS X command line_
>

So IPython is not installed in the system Python.

>
> So it appears that I can’t run IPython from the OS X command line and
> (as before) networkx can be imported by the system Python.
>
>
> _Where is
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/spyder-1.1.3-py2.7.egg’ coming
> from?_

> It looks as if the directory was installed when I first started
> experimenting with Spyder in 2010.
>

Get rid of it.

> _Access to Networkx_
> _
> _
> Networkx is referenced in the path obtained from running
>
>>> >>> import sys
>>> >>> sys.path
>
> from the terminal OS X command line and networkx can be imported
> successfully. It is not referenced in the Spyder console path and can’t
> be found by Spyder.

That is not what you showed in your previous post. Go back to it and
take a look and confirm whether the paths you show are correct.

>
>
> _What is in
> /Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/site-packages?_
>

So the stuff that is packaged with Spyder.

> ———————————————————————————————————
>
> The only site-packages file is a .zip file that I assume came along with
> a download.
>
>
> _Installation of Python 2.7.9_
> _
> _
> I installed Python (hopefully correctly) by using the Launcher (icon
> looks like a V2 rocket) that accompanied the download.I don’t understand
> the relationship between the /Library and the /Applications file
> references but they appear to me to be the main difference between the
> system Python path and the Spyder Python path

Where did you get the Python package to begin with?

>
> I suspect these answers may not really address what you want to know but
> hope they help in some way.

I am thinking the only way to solve this is to go to square one and
start over from scratch. The only caveat is how deeply your system
depends on Python.

Chris Edwards

unread,
Mar 25, 2015, 3:20:15 AM3/25/15
to spyd...@googlegroups.com
Adrian,

Get rid of '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/spyder-1.1.3-py2.7.egg’

I moved the directory to the .old directory (below)

Fl1cker:site-packages cbhe$ mv spyder-1.1.3-py2.7.egg spyder-1.1.3-py2.7.egg.old
Fl1cker:site-packages cbhe$ ls -l
total 728
-rw-rw-r--   1 root  admin     119 26 Nov 12:28 README
drwxrwxr-x   8 root  admin     272 22 Mar 15:25 _markerlib
-rw-rw-r--   1 cbhe  admin     210 22 Mar 15:25 easy-install.pth
-rw-rw-r--   1 root  admin     126 22 Mar 15:25 easy_install.py
-rw-rw-r--   1 root  admin     360 22 Mar 15:43 easy_install.pyc
-rw-rw-r--   1 root  admin     360 22 Mar 15:43 easy_install.pyo
-rw-rw-r--   1 root  admin  101530 22 Mar 15:25 pkg_resources.py
-rw-rw-r--   1 root  admin  119766 22 Mar 15:43 pkg_resources.pyc
-rw-rw-r--   1 root  admin  119766 22 Mar 15:43 pkg_resources.pyo
drwxrwxr-x  74 root  admin    2516 22 Mar 15:25 setuptools
drwxrwxr-x  11 root  admin     374 22 Mar 15:25 setuptools-7.0.dist-info
-rw-rw-r--   1 cbhe  admin      30 28 Jul  2010 setuptools.pth
drwxrwxr-x   5 cbhe  admin     170 28 Jul  2010 spyder-1.1.3-py2.7.egg.old
Fl1cker:site-packages cbhe$ 


Check paths for presence of Networkx


a. From the OS X Terminal the path below shows reference to Pymetis, Networkx and Metis. I thought that is what I had sent previously but apologise for any misunderstanding that I may have caused.

Fl1cker:site-packages cbhe$ python
Python 2.7.9rc1 (v2.7.9rc1:40eada278702, Nov 25 2014, 17:25:50) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/Library/Python/2.7/site-packages/PyMetis-2014.1-py2.7-macosx-10.10-intel.egg', '/Library/Python/2.7/site-packages/networkx-1.9.1-py2.7.egg', '/Library/Python/2.7/site-packages/decorator-3.4.0-py2.7.egg', '/Library/Python/2.7/site-packages/metis-0.1a-py2.7.egg', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages']
>>> 


b. From the Spyder Python console the following path was shown. There does not appear to be any reference to Pymetis, Networkx or Metis

—————————————————————————————
Python 2.7.8 (default, Aug 15 2014, 13:43:01) 
[GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.61)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/utils/external’,
'/Users/cbhe/scripts’,
'/Users/cbhe/Documents/Python User Files 2015/Development Code’,
'/Applications/Spyder-Py2.app/Contents/Resources’,
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python27.zip’,
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7’,
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-darwin’,
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-mac’,
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-mac/lib-scriptpackages’,
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-tk’,
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-old’,
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-dynload’,
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/site-packages.zip’,
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/site-packages']
>>> 
——————————————————————————————


c. From the Spyder IPython console (this time there was no error message) the following path was shown. Again no reference to the three external packages that I want to use.

———————————————————————————————
IPython 3.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.
%guiref   -> A brief reference about the graphical user interface.

In [1]: import sys

In [2]: sys.path
Out[2]: 
['',
 '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/utils/external',
 '/Users/cbhe/scripts',
 '/Users/cbhe/Documents/Python User Files 2015/Development Code',
 '/Applications/Spyder-Py2.app/Contents/Resources',
 '/Applications/Spyder-Py2.app/Contents/Resources/lib/python27.zip',
 '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7',
 '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-darwin',
 '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-mac',
 '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-tk',
 '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-old',
 '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-dynload',
 '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/site-packages.zip',
 '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/site-packages',
 '/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/IPython/extensions',
 '/Users/cbhe/.ipython']
In [3]: 
———————————————————————————————

Source of Python package

I downloaded the Python package from


Starting again from scratch

If you recommend that I do this would you be able to outline the steps required.

Summary

What I find odd is the fact that I can execute a python program that imports Networkx from the OS X Terminal, but that package is not recognised by Spyder. I can’t help wondering if the problem could be solved by adding to the Spyder system path (if that is possible).

Thanks for your patience.

Chris


Adrian Klaver

unread,
Mar 25, 2015, 10:00:21 AM3/25/15
to spyd...@googlegroups.com
On 03/25/2015 12:20 AM, Chris Edwards wrote:
> Adrian,
>

>
> _Check paths for presence of Networkx_
> _
> _
>
> a. From the OS X Terminal the path below shows reference to Pymetis,
> Networkx and Metis. I thought that is what I had sent previously but
> apologise for any misunderstanding that I may have caused.
>
> Fl1cker:site-packages cbhe$ python
> Python 2.7.9rc1 (v2.7.9rc1:40eada278702, Nov 25 2014, 17:25:50)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sys
> >>> sys.path
> ['',
> '/Library/Python/2.7/site-packages/PyMetis-2014.1-py2.7-macosx-10.10-intel.egg',
> '/Library/Python/2.7/site-packages/networkx-1.9.1-py2.7.egg',
> '/Library/Python/2.7/site-packages/decorator-3.4.0-py2.7.egg',
> '/Library/Python/2.7/site-packages/metis-0.1a-py2.7.egg',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
> '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
> '/Library/Python/2.7/site-packages']
> >>>
>
>

>
> _Source of Python package_
>
> I downloaded the Python package from
>
> https://www.python.org/downloads/source/
>
> _Starting again from scratch_
> _
> _
> If you recommend that I do this would you be able to outline the steps
> required.

Now that IPython seems to work and the paths are clearer I would hold off.

>
> _Summary_
>
> What I find odd is the fact that I can execute a python program that
> imports Networkx from the OS X Terminal, but that package is not
> recognised by Spyder. I can’t help wondering if the problem could be
> solved by adding to the Spyder system path (if that is possible).

It is possible. In Spyder go to Tools-->PYTHONPATH manager and add the
system path for packages. From the looks of it, that is:

/Library/Python/2.7/site-packages/

if that does not work, you could get specific:

/Library/Python/2.7/site-packages/networkx-1.9.1-py2.7.egg

>
> Thanks for your patience.
>
> Chris
>



--
Adrian Klaver
adrian...@aklaver.com

Chris Edwards

unread,
Mar 26, 2015, 8:17:40 AM3/26/15
to spyd...@googlegroups.com
Adrian,

Success! I have managed to execute Networkx programs from Spyder.

The sys.path from the Spyder IPython console is currently

Out[2]:
['',
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/utils/external',
'/Library/Python/2.7',
'/Library/Python/2.7/site-packages/networkx-1.9.1-py2.7.egg',
'/Library/Python/2.7/site-packages/decorator-3.4.0-py2.7.egg',
'/Library/Python/2.7/site-packages',
'/Library/Python/2.7/site-packages/pyvtk',
'/Library/Python/2.7/site-packages/graphviz',
'/Library/Python/2.7/site-packages/py-1.4.26-py2.7.egg-info',
'/Library/Python/2.7/site-packages/pytools-2014.3.5-py2.7.egg-info',
'/Library/Python/2.7/site-packages/pytest-2.6.4-py2.7.egg-info',
'/Library/Python/2.7/site-packages/MeshPy-2014.1-py2.7.egg-info',
'/Library/Python/2.7/site-packages/PyVTK-0.4.85-py2.7.egg-info',
'/Library/Python/2.7/site-packages/PyMetis-2014.1-py2.7.egg-info',
'/Library/Python/2.7/site-packages/networkx-1.9.1-py2.7.egg/networkx',
'/Users/cbhe/scripts',
'/Users/cbhe/Documents/Python User Files 2015/Development Code',
'/Applications/Spyder-Py2.app/Contents/Resources',
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python27.zip',
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7',
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-darwin',
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-mac',
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/plat-mac/lib-scriptpackages',
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-tk',
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-old',
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/lib-dynload',
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/site-packages.zip',
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/site-packages',
'/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/IPython/extensions',
'/Users/cbhe/.ipython']

In [3]:

Any comments on the above are welcome.

I am having some difficulty in installing Graphviz and Pygraph but that is for another day.

Thank you for your help. It has been a learning experience for me.

Chris
Reply all
Reply to author
Forward
0 new messages