1

[Using Mac OSX 10.6.8]

i'm tryring to install networkx to python 2.7, but it keeps trying to install it to version 2.6 (which in uninstalled when i upgraded to 2.7)

i tried easy_install for an unspecified version, and it got the 2.6 version

command:

easy_install networkx

output

Searching for networkx
Best match: networkx 1.7
Processing networkx-1.7-py2.6.egg
Removing networkx 1.7 from easy-install.pth file
Adding networkx 1.7 to easy-install.pth file

Using /Library/Python/2.6/site-packages/networkx-1.7-py2.6.egg
Processing dependencies for networkx
Finished processing dependencies for networkx
smms-baldrick:20121205_coif kirstin$ 

i tried downloading the python 2.7 version and installing it directly, but it still went to the library for 2.6

command:

easy_install http://networkx.lanl.gov/download/networkx/networkx-1.7-py2.7.egg

output

Downloading http://networkx.lanl.gov/download/networkx/networkx-1.7-py2.7.egg
Processing networkx-1.7-py2.7.egg
removing '/Library/Python/2.6/site-packages/networkx-1.7-py2.7.egg' (and everything under it)
creating /Library/Python/2.6/site-packages/networkx-1.7-py2.7.egg
Extracting networkx-1.7-py2.7.egg to /Library/Python/2.6/site-packages
networkx 1.7 is already the active version in easy-install.pth

Installed /Library/Python/2.6/site-packages/networkx-1.7-py2.7.egg
Processing dependencies for networkx==1.7
Finished processing dependencies for networkx==1.7
Kirt
  • 257
  • 5
  • 15
  • Long shot, but what is your default Python version on your system? My best/only guess is that you are running `easy_install with Python 2.6, which is installing it in the way that 2.6 needs to. Have you tried calling it with 2.7 directly? – RocketDonkey Dec 05 '12 at 07:45
  • which OS you are using? check the PATH Environment variable and ensure the python27 installation exists in path instead python26 – pylover Dec 05 '12 at 07:55
  • Possible duplicate: http://stackoverflow.com/questions/6611730/how-to-run-easy-install-using-a-particular-python-version – Lennart Regebro Dec 05 '12 at 07:56
  • Thanks, i've re-installed setuptools 0.6c11 for python 2.7, but the problem seems to still be happening. – Kirt Dec 05 '12 at 08:13
  • i also tried echo $PATH and there's nothing on there that looks like python 2.6 – Kirt Dec 05 '12 at 08:14
  • What do you need from python2.7 that is not present in python2.6 and that you couldn't obtain from python3? – mouviciel Dec 05 '12 at 08:17
  • I've already uninstalled 2.6 and can't find a simple way to reinstall it. And other people from my lab write scripts (including this one that needs networx) in python 2, so python 3 won't work for me. – Kirt Dec 05 '12 at 08:32

3 Answers3

3

In Unix variants easy_install also installs a suffixed link, so there should be an easy_install-2.7 . In general, it might be a good idea for you to know where exactly you have installed your new Python, and use that knowledge to install setup-tools, and then to use easy_install. For example:

 $ cd to/my/setuptools/
 $ sudo /my/new/python2.7 setup.py install

and afterwards

  $ /my/new/easy_install-2.7 networkx

And then you can create a set of symbolic links. Also, because Mac uses python internally, it might be a good idea to not mess with the default python installation, and instead use your own with something like virtualenv (which would automate the installation of setuptools).

dsign
  • 12,340
  • 6
  • 59
  • 82
  • Python is installed in the Applications folder of my Mac, and python 2.7 is the default python, but the easy_install for 2.6 seems to still be the default (i'm regretting upgrading to 2.7) – Kirt Dec 05 '12 at 08:23
  • easy_install-2.7 wasn't recognised as a command. I managed to install this package with "python -m easy_install networkx", which called easy-install for my default python installation] but i could do with a more long term solution to change my default version of easy-install? – Kirt Dec 05 '12 at 08:30
  • 1
    @Renee: You should never try to upgrade the system python. Always install other versions of Python in separate installs. – Lennart Regebro Dec 05 '12 at 08:34
2

You install easy_install for a particular installation of Python. That easy_install will then install into the Python installation for which easy_install is installed.

If you want to use easy_install to install packages into another Python installation, the first thing you must do is to instal easy_install in that Python installation. Then you can use that easy_install to install packages.

You might also want to use pip instead.

See also: Newbie hint on installing Python and it’s modules and packages.

Lennart Regebro
  • 167,292
  • 41
  • 224
  • 251
  • Thanks, i've re-installed setuptools 0.6c11 for python 2.7, but the problem seems to still be happening. Is it still using an old version of easy_install (the instructions mentioned removing old stuff for windows, but i'm using Mac OSX and it just said to install new version for that) – Kirt Dec 05 '12 at 07:59
  • 1
    @Renee: So don't use the old version of easy_install. Use the new version. Just specify the path to the easy_install you want to use. Same thing with Python. Or pip. Or any other of these tools. – Lennart Regebro Dec 05 '12 at 08:32
1

i managed to install this package with

python -m easy_install networkx

from how to run easy_install using a particular python version

[which called easy-install for my default python installation]

but i could do with a more long term solution to change my default version of easy-install

Community
  • 1
  • 1
Kirt
  • 257
  • 5
  • 15
  • You can just locate the easy_install for version 2.7 and sym-link it. But heed the advice of people here: do not mess with the default Python, I have taken quite a few Macs to the repair-shop just because of that. – dsign Dec 05 '12 at 08:43