3

I'm using Cygwin 64 on Windows 10; just updated. Some relevant package versions:

  • meld: 3.18.0-1
  • python3: 3.8.6-1
  • python2: 2.7.18-4

I'm also using MobaXTerm's X server (and it works - I can run xclock for example.)

When I run meld in a Cygwin bash session (within mintty), I get:

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

Why is this happening, and how can I get meld to properly run?

Notes:

6
  • As you have both python2 and python3 installed it might be a problem that /usr/bin/meld is invoking the wrong one. Does it work if you run python3 /usr/bin/meld or with python2? If so you could edit /usr/bin/meld to put the correct version of python in the first line
    – icarus
    Sep 20, 2021 at 15:45
  • @icarus: /usr/bin/meld says python3 explicitly. I tried changing it to python2 - didn't help, same error message.
    – einpoklum
    Sep 20, 2021 at 15:49
  • Are there any environment variables set in your shell related to python? try running set | grep PYTHON
    – icarus
    Sep 20, 2021 at 15:56
  • @icarus: Nope, no such variables.
    – einpoklum
    Sep 20, 2021 at 15:56
  • 1
    Can't imagine why this question got downvoted. +1 from me - just stumbled across the same problem.
    – Binarus
    Dec 20, 2021 at 11:27

4 Answers 4

4

meld seems hardcoded to python3.6

https://cygwin.com/packages/x86_64/meld/meld-3.18.0-1

But the default is pointing to 3.8

$ alternatives --display python3
python3 - status is auto.
 link currently points to /usr/bin/python3.8
/usr/bin/python3.8 - priority 38
/usr/bin/python3.6 - priority 36
/usr/bin/python3.7 - priority 37
Current `best' version is /usr/bin/python3.8.

Try setting to 3.6

$ alternatives --config python3

There are 3 programs which provide 'python3'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/bin/python3.8
   2           /usr/bin/python3.6
   3           /usr/bin/python3.7

Enter to keep the current selection[+], or type selection number: 2

and test again meld

1
  • So, this helps, although - I now get a different error. I think I'll start a new question for it though.
    – einpoklum
    Sep 21, 2021 at 17:41
3

As @matzeri points out, it seems meld is hard-coded to python 3.6 - while Cygwin64, as of September 2021, has Python 3.8 as the default alternative for python3.

Now, I don't want to change the default for all apps, but - we can still oblige meld itself, manually:

  1. Copy /usr/bin/meld to /usr/local/bin/meld
  2. In /usr/local/bin/meld, replace:
#!/usr/bin/python3

with:

#!/usr/bin/python3.6

this will at least resolve the missing module problem - although you may encounter other issues.

Remember you have a local version to delete/update when you next update meld itself!


Edit: If you encounter this issue on another Linux distribution, the direct problem is that the meld subdirectory is not found in python's package search path. So, supposing meld is being run by python version N.M, you are likely missing

/usr/lib/pythonN.M/site-packages/meld/

or a meld subdirectory in wherever python stores its "site-packages". This can sometimes be resolved by hard-coding meld to use another python version - but only if that version has an appropriate meld site-packages folder. Otherwise, you'll need to reinstall or manually install meld, making sure that subdirectory is put in place.

0
1

Alternative solution to the problem explained by @einpoklum.

Add location where meld/conf.py is to path via e.g.

export PYTHONPATH=/usr/lib/pythonN.M/site-packages

The path can be found via e.g.

locate meld conf.py

export can be added to startup files, e.g. .bashrc (that part is for Unix with bash, I think PYTHONPATH works on Windows too).

0

I recently updated my Cygwin packages, resulting in the "ModuleNotFoundError: No module named 'meld'" failure. In my case it helped to downgrade meld to version 3.16.4.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .