# PyGTK for python 2.6 on freebsd 7.2



## xcristi (Oct 8, 2009)

Hello all,

I'm trying to install pygtk 2.14 for python 2.6 installed on my freebsd 7.2 (some many versions, I know  ). 

Freebsd 7.2 came with bundled python 2.5, who has pygtk already installed. But I wanna use python 2.6, so I started to install also pygtk for it.

I've downloaded tar archive from pygtk site, and done:


```
PYTHON=/usr/local/bin/python2.6
export PYTHON
./configure
```

This part went ok, configuration script correctly detected python2.6 & stuff. Then make and got the following error (after some compilation):


```
...
Making all in examples
Syntax error: redirection unexpected
Error code 2
...
```

Have anyone an idea what is wrong, or how can I alternative install pygtk?

Thanks in advance,
Cristian


----------



## DutchDaemon (Oct 8, 2009)

Don't install tarballs, use the FreeBSD ports tree or a package (lang/python26). 
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports.html


----------



## xcristi (Oct 8, 2009)

Thanks for your reply.

What I did:
- first, I uninstalled the python26 to make things a little bit cleaner


```
cd /usr/ports/lang/python26
make deinstall
```

(and manually removed the /usr/local/lib/python26)

- then, the big move


```
portupgrade -o lang/python26 lang/python25
```

This step seemed to work pretty well, and I have now python 2.6 instead of 2.5

- then, following the updating instructions


```
cd /usr/ports/lang/python
make upgrade-site-packages
```

This was intended to upgrade the third-party packages, but something was not right. It just recompiled the python 2.6, everything ok, but no sign of packages
Q: Should I move to */usr/ports/lang/python2.5* instead of the /usr/ports/lang/python and run there the _make_ command?

Anyway, I tried also with *easy_install pygtk *and got the error:


```
Searching for pygtk
Reading http://pypi.python.org/simple/pygtk/
Reading http://www.daa.com.au/~james/software/pygtk/
Reading http://www.pygtk.org/
Reading http://www.pygtk.org
Reading http://www.daa.com.au/~james/pygtk/
Best match: pygtk 2.16.0
Downloading http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.16/pygtk-2.16.0.tar.bz2
Processing pygtk-2.16.0.tar.bz2
Running pygtk-2.16.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-WWnKnk/pygtk-2.16.0/egg-dist-tmp-QsSBwU
Traceback (most recent call last):
  File "/usr/local/bin/easy_install", line 8, in <module>
    load_entry_point('setuptools==0.6c9', 'console_scripts', 'easy_install')()
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 1671, in main
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 1659, in with_ei_usage
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 1675, in <lambda>
  File "/usr/local/lib/python2.6/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/local/lib/python2.6/distutils/dist.py", line 975, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python2.6/distutils/dist.py", line 995, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 211, in run
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 446, in easy_install
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 476, in install_item
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 655, in install_eggs
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 930, in build_and_install
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/command/easy_install.py", line 919, in run_setup
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/sandbox.py", line 27, in run_setup
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/sandbox.py", line 63, in run
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg/setuptools/sandbox.py", line 29, in <lambda>
  File "setup.py", line 22, in <module>
ImportError: No module named dsextras
```

Trying now to debug the last error. Or maybe should I not use easy_install for pygtk?

Thanks,
Cristian


----------



## SirDice (Oct 8, 2009)

Use portupgrade:

`# portupgrade -r lang/python26 -x lang/pythong26`

This should upgrade everything depending on python26 (which replaced python25 with the previous portupgrade -o) except the python26 port itself.


----------



## xcristi (Oct 8, 2009)

Hey, thanks for portupgrade tip, too bad I cannot test it yet... after some struggling, I made everything work as expected (until now).

I separate installed from ports py-gtk2(x11-toolkits), pycairo (graphics), py-numeric(math). For some of these I should put make install FORCE_PKG_REGISTER=1 (because the usual way didn't work - make deinstall/make reinstall)

I also added py-sqlite3 from the ports and now it looks ok.

Definitely I missed something in the beginning, the update procedure was too painful to be a 'normal' one. But a lot of things learned along the way :stud

Thanks everone! Case closed.


----------



## SirDice (Oct 8, 2009)

xcristi said:
			
		

> For some of these I should put make install FORCE_PKG_REGISTER=1 (because the usual way didn't work - make deinstall/make reinstall)


Not the best idea 

Try to figure out why it fails. It usually does for a good reason. If it claims it's already installed (or an older version) use pkg_delete to remove that particular version. 

Make deinstall should only be used when deinstalling the exact same version as indicated by the port's Makefile. When a port is installed it registers which files are installed where. This can and will change between port versions. Pkg_delete will use the registered installation files to remove the files it installed.


----------



## xcristi (Oct 9, 2009)

Yes, SirDice, you're right, but at that moment pkg_delete didn't work (probably due the dependencies).

Anyway, I found this  Use a different Python version as default ... too late  Really helpful for me.

Well, next time I'll know.

:beer for all


----------



## SirDice (Oct 9, 2009)

xcristi said:
			
		

> Well, next time I'll know.


See my signature


----------

