Q:

opencv installation on ubuntu 11.10

I'm trying to install OpenCV on Ubuntu11.10 using the terminal. But it gives me the following error. I've not been able to resolve it. Notice the last four lines.
$sudo apt-get install opencv  
Reading package lists... Done  
Building dependency tree         
Reading state information... Done  
The following extra packages will be installed:  
 libopencv2.3  
The following NEW packages will be installed:  
 libopencv2.3 opencv  
0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.  
Need to get 11.8 MB of archives.  
After this operation, 88.7 MB of additional disk space will be used.  
Do you want to continue [Y/n]? Y  
 Get:1 http://ppa.launchpad.net/gijzelaar/opencv2.3/ubuntu/ oneiric/main libopencv2.3 i386    2.3.1-3 [11.5 MB]  
Get:2 http://ppa.launchpad.net/gijzelaar/opencv2.3/ubuntu/ oneiric/main opencv i386 2.3.1-3 [264 kB]  
Fetched 11.8 MB in 22s (528 kB/s)                                                          
(Reading database ... 240623 files and directories currently installed.)  
Unpacking libopencv2.3 (from .../libopencv2.3_2.3.1-3_i386.deb) ...    
dpkg: error processing /var/cache/apt/archives/libopencv2.3_2.3.1-3_i386.deb (--unpack):
trying to overwrite '/usr/lib/libopencv_highgui.so.2.3.1', which is also in package libopencv-highgui2.3 2.3.1-4ppa1    
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)  
Unpacking opencv (from .../opencv_2.3.1-3_i386.deb) ...  
dpkg: error processing /var/cache/apt/archives/opencv_2.3.1-3_i386.deb (--unpack):
trying to overwrite '/usr/bin/opencv_createsamples', which is also in package libopencv-core-dev 2.3.1-4ppa1  
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)  
Errors were encountered while processing:  
 /var/cache/apt/archives/libopencv2.3_2.3.1-3_i386.deb  
 /var/cache/apt/archives/opencv_2.3.1-3_i386.deb  
E: Sub-process /usr/bin/dpkg returned an error code (1)  
$ 

A:

For an error like this:
dpkg: error processing /var/cache/apt/archives/AAA (--unpack):
trying to overwrite `/usr/lib/BBB', which is also in package CCC
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
AAA
E: Sub-process /usr/bin/dpkg returned an error code (1)

(where AAA,BBB,CCC are placeholder names, in case it wasn’t clear)
do
sudo dpkg -i --force-overwrite AAA

(give full path of AAA), and then run
sudo apt-get -f install

again.
And also, try googling before posting a question cause there are tons of links explaining how to fix this error!

