Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Solved] tortoisehg fails to run after upgrade

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

[Solved] tortoisehg fails to run after upgrade

#1 Post by ticketman »

System:
Bullseye,

Code: Select all

5.7.0-2-amd64 #1 SMP Debian 5.7.10-1 (2020-07-26) x86_64 GNU/Linux
Tortoisehg downloaded from:
https://www.mercurial-scm.org/

error message when running thg:

Code: Select all

Traceback (most recent call last):
  File "./thg", line 52, in <module>
    from setup import build_ui
  File "~/DATA0/Software_Dev/TortoiseHg/thg new/setup.py", line 30, in <module>
    from i18n.msgfmt import Msgfmt
  File "~/DATA0/Software_Dev/TortoiseHg/thg new/i18n/msgfmt.py", line 39, in <module>
    from mercurial import (
ImportError: No module named mercurial
other config data:

Code: Select all

which python
/usr/bin/python

hg --version  gives
Mercurial Distributed SCM (version 5.4.1)

python --version  gives
Python 2.7.18

usr/bin/python  points to python2,  which points to python2.7

usr/bin/python3 points to python3.8

pyversions -i  gives
python2.7

Directories present / not present:
/usr/lib/python3/dist-packages/mercurial
/usr/lib/python2.7/dist-packages/  : no mercurial folder!
/usr/lib/python3.8/                         : no dist-packages folder!
I think the problem is that the system is running python 2.7 but the corresponding usr/lib/python2.7 folder does not have mercurial in it.
So I added this to my .bashrc:

Code: Select all

alias python='/usr/bin/python3'
But now python --version gives
Python 3.8.5
and the python 3.8 libs also don't have mercurial in them, and I get the same error.

How do I fix this?
Last edited by ticketman on 2020-09-19 17:57, edited 2 times in total.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: tortoisehg fails to run after upgrade

#2 Post by Head_on_a_Stick »

ticketman wrote:Bullseye
Why not just use the stable release instead? That has tortoisehg in the repositories.
ticketman wrote:

Code: Select all

ImportError: No module named mercurial

Code: Select all

# apt install mercurial
deadbang

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: tortoisehg fails to run after upgrade

#3 Post by ticketman »

I'm using testing (for better or worse).
tortoisehg has lost its maintainer for both testing and experimental.
Anyway, I had been using tortoisehg from the download location quite successfully until now.

I do have mercurial (hg) installed :

hg --version gives
Mercurial Distributed SCM (version 5.4.1)

It also shows up in apt.

I think it's a lib issue - mercurial lib appears to be in the wrong place.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: tortoisehg fails to run after upgrade

#4 Post by Head_on_a_Stick »

ticketman wrote:I do have mercurial (hg) installed :

hg --version gives
Mercurial Distributed SCM (version 5.4.1)

It also shows up in apt
The version of mercurial in testing is 5.5, can we see

Code: Select all

apt policy mercurial
type hg
find /usr/lib/python3 -name mercurial
deadbang

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: tortoisehg fails to run after upgrade

#5 Post by ticketman »

Hmm ... yesterday I did a sudo apt update and a sudo apt upgrade and after all was done the installed version of mercurial in apt says 5.4.1-3.
Do you think I should do a 'apt install mercurial' anyway?
Maybe the repos are still not properly up-to-date?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: tortoisehg fails to run after upgrade

#6 Post by Head_on_a_Stick »

ticketman wrote:Do you think I should do a 'apt install mercurial' anyway?
I think you should post my requested output.
deadbang

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: tortoisehg fails to run after upgrade

#7 Post by ticketman »

My apologies, I misread your last email.
I get:

Code: Select all

~$ apt policy mercurial
mercurial:
  Installed: 5.4.1-3
  Candidate: 5.4.1-3
  Version table:
 *** 5.4.1-3 500
        500 http://ftp.uk.debian.org/debian testing/main amd64 Packages
        100 /var/lib/dpkg/status

~$ type hg
hg is /usr/bin/hg

~$ find /usr/lib/python3 -name mercurial
/usr/lib/python3/dist-packages/mercurial
I then did another update cycle and noticed:

Code: Select all

Get:43 http://ftp.uk.debian.org/debian testing/main amd64 mercurial amd64 5.5-2 [351 kB]                                   
Get:44 http://ftp.uk.debian.org/debian testing/main amd64 mercurial-common all 5.5-2 [2,714 kB]   
I removed the alias in my .bashrc and tried running thg again - got the same error as before.
I re-ran your commands (no reboot), and the apt policy command now gives a different response:

Code: Select all

~$ apt policy mercurial
mercurial:
  Installed: 5.5-2
  Candidate: 5.5-2
  Version table:
 *** 5.5-2 500
        500 http://ftp.uk.debian.org/debian testing/main amd64 Packages
        100 /var/lib/dpkg/status
So I now have the correct version of mercurial installed, but still can't run thg.
The same usr/lib and usr/bin folders are present, i.e.

usr/bin/python points to python2, which points to python2.7
usr/bin/python3 points to python3.8
/usr/lib/python3/dist-packages/mercurial (there is no other file/folder under usr/lib/python3)
/usr/lib/python2.7/dist-packages/ : no mercurial folder!
/usr/lib/python3.8/ : no dist-packages folder!

Still seems to me that the usr/lib/python3/dist-packages folder should be in /usr/lib/python3.8/ ??

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: tortoisehg fails to run after upgrade

#8 Post by ticketman »

Solved : I edited the first line in the script file 'thg'
from

Code: Select all

#!/usr/bin/env python
to

Code: Select all

#!/usr/bin/env python3
Also make sure you have the following packages installed: python3-distutils, python3-pyqt5, python3-pyqt5-qsci

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 462 times

Re: [Solved] tortoisehg fails to run after upgrade

#9 Post by sunrat »

In my sid system where python 2 has been deprecated and now removed, I symlinked /usr/bin/python to /usr/bin/python3 and it solved a couple of python applications from not starting. I've been waiting for any unintended consequences to raise their ugly heads but none so far. YMMV.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

Post Reply