14

I am using Ubuntu 16.04 with python version 3.5.2. The problem I am having is, I can't start meld. Every time I try to open it get the error message bellow:

Traceback (most recent call last):
File "/usr/bin/meld", line 73, in <module>
import meld.conf
ImportError: No module named 'meld'

Can anyone help please

Thanks

Fahim

Fahim
  • 407
  • 4
  • 11
  • It shouldn't happen unless the packages have been tampered or corrupted. Did you try doing a basic remove and install? (`sudo apt purge meld && apt install meld`) ? – Prahlad Yeri Jun 10 '18 at 15:21
  • Hi @PrahladYeri, thanks for answer. I have done the purge / remove both but still not working – Fahim Aug 06 '18 at 22:44
  • Prahlad Yeri: should be `sudo apt purge meld && sudo apt install meld` (sudo tiwce) – woodz Feb 21 '19 at 12:15

2 Answers2

26

My guess would be that you have changed your system's default Python version (Python3 instead of Python2). Two possible solutions:

  • Switch back to Python2. You might not want to do this, as there probably was a reason for switching to Python3. Switching back might result in other programs not working as expected. See command update-alternatives for switching the default Python version.

  • Force meld to use Python2. For doing so, open /usr/bin/meld with root rights in a text editor and change the very first line from

    #!/usr/bin/python

    to

    #!/usr/bin/python2

Attention: Whenever meld gets updated, you will have to do that modification again.

Guy
  • 261
  • 3
  • 4
4

Meld as handled by apt package manager in 16.04 assumes that the system python is 2.7. So the python libraries needed are installed to /usr/lib/python2.7/dist-packages/meld. If your system is python is 3.5, it's not going to find the packages it needs.

Your options are:

  1. Put together a launch script to set python to python2.7 before calling meld

  2. Download the self-contained package from the website:

    wget https://download.gnome.org/sources/meld/3.18/meld-3.18.2.tar.xz tar -xvf meld-3.18.2.tar.xz cd meld-3.18.2/bin/ ./meld

mcragun
  • 1,198
  • 3
  • 10
  • 17
  • Thanks @mcragun...I have updated my OS to 18.04 so could not try your solution...but hope somebody else will find it useful – Fahim Oct 17 '18 at 16:19