0
$\begingroup$

Has anyone been successful getting chirp to run on a Linux system that's primarily set up for Python3? I find it's complaining about not finding the serial module, but when I install it with pip (which is a python 3 version) that doesn't help. I can see that chirp is still stuck at python 2, but I'm not sure how to deal with this.

EDIT:

  • I'm trying to get this to work on Ubuntu Mate 20.04. However, I have Python 3 installed, and this seems to throw it off entirely.

  • I have tried running the flatpak version, but flatpak fails dismally on this installation

  • I have an older system still running Ubuntu 16.04, with no Python updates, and that (while entirely unable to load flatpak at all) is now working fine with the tar.gz distribution under Python 2. So, I guess for now, that old box is how I'll be programming my radio!

$\endgroup$
5
  • 2
    $\begingroup$ Hiya Toby, would you update your question to include which flavor/version of linux you are running? $\endgroup$
    – webmarc
    Jan 10 at 19:17
  • 3
    $\begingroup$ I haven't dabbled with Python very much, but surely CHIRP isn't the only software still using version 2 of Python. Isn't there a standard way for Python software to specify exactly what version it uses? I use Ubuntu 20.04, and CHIRP "just works". $\endgroup$
    – rclocher3
    Jan 10 at 21:26
  • 1
    $\begingroup$ @rclocher3 What version of Python is installed? How to check. I'm pretty sure my Linux Mint laptop has two versions of Python that coexist. $\endgroup$
    – Mike Waters
    Jan 11 at 12:34
  • $\begingroup$ yes, I have two versions of Python (2.7, and 3.10). And it seems that the 3.10 is somehow preventing pip from working properly with 2.7. $\endgroup$ Jan 11 at 16:31
  • $\begingroup$ And, yes @rclocher3, the normal way, as I understand it, is to create a virtual environment. I've done that now, but pip2 still won't load one of the libraries. I heard elsewhere that this is "a well known nightmare" with this particular library (gtk). $\endgroup$ Jan 11 at 16:32
2
$\begingroup$

a quick google of "install python 2.7 on Ubuntu Mate 20.04" gives this article as the top result, How to install Python 2.7 on Ubuntu 20.04 LTS

Here's an abbreviated list of steps from that article; if it isn't verbose enough for you, I encourage visiting the source article:

  1. Add Universe repo

sudo apt-add-repository universe ; sudo apt update

  1. Install Python2.7 on Ubuntu 20.04 LTS

sudo apt install python2-minimal

  1. Change the Default Python priority

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2

  1. Install Pip 2 on Ubuntu 20.04

sudo apt update; sudo apt install curl

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py

sudo python2 get-pip.py

And there's also info in that article on how to undo this if you care to.

$\endgroup$
6
  • $\begingroup$ I already have Python 2.7, it's built into the system as part of the distro. The problem appears to stem from the fact that I also have (and need) Python 3. That seems to be what's at the root of the confusion. $\endgroup$ Jan 11 at 16:30
  • 1
    $\begingroup$ Ah, visit that article to see about pip for 2.7. And I've updated the answer to include the python 2 pip step. $\endgroup$
    – webmarc
    Jan 11 at 16:40
  • 1
    $\begingroup$ I'm pretty sure that I had python2 pip working--initially I couldn't load the "serial" library, but subsequently succeeded. However, it still explodes on the gtk library. Others have said that gtk in a venv is a "nightmare". I gave up and went with my older Ubuntu 16.04 system which will work for me. $\endgroup$ Jan 11 at 16:45
  • $\begingroup$ Oh my. The Python 2/3 mess is compounded by how downstream providers have tried to sort out the mess. $\endgroup$
    – jdv
    Jan 11 at 17:40
  • 2
    $\begingroup$ What I've done is to use the flatpak for Chirp. A flatpak is a way to distribute Python code in a one file executable to avoid dependency issues. This is not a true answer to your question, how to use Python3 but it's a better way to run Chirp IMO. $\endgroup$
    – wbg
    Jan 13 at 16:40
0
$\begingroup$

It looks like latest ("ionic""Impish") Ubuntu side-steps most of this with the "python3-future" pseudo-package that the package maintainer has set as a requirement for chirp.

Or you can use the flatpak daily, though this depends on a deprecated 19.04 runtime environment. But it is the closest thing to running a "virtual machine" for chirp without setting up a whole new VM. You don't say what part of flatpak fails for you, but in case it is just about the deprecated runtime you can "force" the install once you also install that runtime. A recent daily worked for me this way.

For example:

  • Go to https://trac.chirp.danplanet.com/chirp_daily/LATEST/
  • Fetch name-of-chirp-daily.flatpak
  • Issue flatpack [name-of-chirp-daily.flatpak]
  • Follow the instructions for the runtimes the flatpak maintainer has declared it requires (I recall it is a standard 19.04 runtime)
$\endgroup$
4
  • 1
    $\begingroup$ What is "ionic"? The only reference I find for it is as an HTML5 framework for mobile. The letter-I release of Ubuntu is, as I understand it "Ubuntu 21.10 Impish Indri", but that's not an LTS. Can you give any more specifics on what you're referring to and how to use it? $\endgroup$ Jan 19 at 2:33
  • 1
    $\begingroup$ Oh, sorry. I confused the "I". Impish is right. I'm sorry, but I ditched LTS long time ago for these very reasons. If you want to develop and manage a variety of apps LTS is going to be harder. Impish handles this with the "python3-future" pseudo-package. $\endgroup$
    – jdv
    Jan 19 at 15:16
  • $\begingroup$ btw @jdv , that bizarre downvote was not me! I don't understand the people who do that and disappear without saying a word about how to improve something, whether question or comment. Just seems rude to me. Anyway, there'll be a new LTS fairly soon, and presumably this will be part of that. I'll take a look as I must run the latest Python versions (I work with it) and being able to make stuff coexist would be good. $\endgroup$ Jan 20 at 22:13
  • 1
    $\begingroup$ No worries. I know this doesn't answer the specific question, but I figured it would help someone else. FWIW, I am able to run chirp on Ubuntu Impish with flatpak if i "force" it after installing the runtime it needs. It also installs via apt because they finally figured out the Python stuff. $\endgroup$
    – jdv
    Jan 21 at 0:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.