[Strange dependency] Installation of golang package requires python2.7

Hi all,

I’m new to Fedora and dnf so be cool with me.

I tried to install golang package and I was really surprised that it installs python2.7 as dependency.
Furthermore python2.7 is end of life …
Well it isn’t direct dependency but it sounds soo strange because golang is just one binary https://golang.org/dl/.

I’m not sure what this post should solve / it is more like rant because it is really strange :frowning:
Maybe it should be more lightweight ?

Let me know your opinions please.
Thx

Golang package has a weak dependency on git, subversion and mercurial (I guess these might be needed for dependency management in Go?) and mercurial brings in Python 2.7.

You can skip weak dependencies during installation:

sudo dnf --setopt=install_weak_deps=False install golang

2 Likes

Hi @vtrefny,

Thanks for reply.
I’m not really fan of this behavior e.g. to install all possible packages that you may not need at all :frowning:
I don’t need mercurial on my PC and golang works without it as well.
Therefore i will add this option into /etc/dnf/dnf.conf.

Unfortunately dnf proposes to install a lot of packages also with install_weak_deps set to False:

$ sudo dnf --setopt=install_weak_deps=False install golang
Last metadata expiration check: 2:35:27 ago on Mon 05 Oct 2020 12:43:23 PM CEST.
Dependencies resolved.
======================================================================================================================================================================================================================================
 Package                                                       Architecture                                    Version                                                 Repository                                                Size
======================================================================================================================================================================================================================================
Installing:
 golang                                                        x86_64                                          1.15.2-1.fc33                                           updates-testing                                          642 k
Installing dependencies:
 annobin                                                       x86_64                                          9.28-1.fc33                                             fedora                                                    99 k
 dwz                                                           x86_64                                          0.13-4.fc33                                             fedora                                                   106 k
 efi-srpm-macros                                               noarch                                          4-5.fc33                                                fedora                                                    21 k
 fonts-srpm-macros                                             noarch                                          1:2.0.5-4.fc33                                          fedora                                                    27 k
 fpc-srpm-macros                                               noarch                                          1.3-2.fc33                                              fedora                                                   7.6 k
 ghc-srpm-macros                                               noarch                                          1.5.0-3.fc33                                            fedora                                                   7.7 k
 gnat-srpm-macros                                              noarch                                          4-12.fc33                                               fedora                                                   8.2 k
 go-srpm-macros                                                noarch                                          3.0.9-1.fc33                                            fedora                                                    25 k
 golang-bin                                                    x86_64                                          1.15.2-1.fc33                                           updates-testing                                           81 M
 golang-src                                                    noarch                                          1.15.2-1.fc33                                           updates-testing                                          7.2 M
 kernel-srpm-macros                                            noarch                                          1.0-3.fc33                                              fedora                                                   7.2 k
 lua-srpm-macros                                               noarch                                          1-2.fc33                                                updates-testing                                          7.9 k
 nim-srpm-macros                                               noarch                                          3-3.fc33                                                fedora                                                   8.3 k
 ocaml-srpm-macros                                             noarch                                          6-3.fc33                                                fedora                                                   7.7 k
 openblas-srpm-macros                                          noarch                                          2-8.fc33                                                fedora                                                   7.2 k
 perl-srpm-macros                                              noarch                                          1-38.fc33                                               fedora                                                   8.3 k
 python-srpm-macros                                            noarch                                          3.9-10.fc33                                             updates-testing                                           20 k
 qt5-srpm-macros                                               noarch                                          5.15.1-1.fc33                                           updates-testing                                          8.3 k
 redhat-rpm-config                                             noarch                                          172-1.fc33                                              updates-testing                                           66 k
 rust-srpm-macros                                              noarch                                          15-2.fc33                                               fedora                                                   9.8 k

Transaction Summary
======================================================================================================================================================================================================================================
Install  21 Packages

Total download size: 89 M
Installed size: 345 M
Is this ok [y/N]:

In comparison to Debian Buster:

$ sudo apt-get install golang
[sudo] password for findmyname: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  golang-1.11 golang-1.11-doc golang-1.11-go golang-1.11-src golang-doc golang-go golang-src
Suggested packages:
  bzr | brz mercurial subversion
The following NEW packages will be installed:
  golang golang-1.11 golang-1.11-doc golang-1.11-go golang-1.11-src golang-doc golang-go golang-src

P.S.: I downloaded golang from https://golang.org/dl/ and it works without any additional packages.

Thx
BR

There was a major change between python2 and python3. You can easily have both python versions installed so it supports those packages that have not yet been updated to python3

Maybe you want to encourage the developers of golang to update their software to migrate from python2 to python3, as all software developers should be doing now.

Well golang doesn’t depend on python2.

Apparently something in it does (or it is mispackaged with unnecessary dependencies). Otherwise it would not try to pull in python2 when you install it.

There are a few things here to keep in mind:

  • golang and golang-bin are two different packages. golang includes lots of things that are part of the Go ecosystem, while golang-bin seems to limit itself to the “core” tools. So if the binary is all you want, try to install golang-bin. That should pull in fewer dependencies.

  • the extra packages you’re seeing dnf pull in are because of the dependency tree—the point of rpm packages in the Fedora repos is not merely to add each software in isolation. Rather, it is to make all these tools available with all the bits necessary to ensure that as much as possible of their functionality is enabled. This means users don’t have to install the golang binary and then manually install 10 other things that are optional. The rpm package pulls in all the optional bits.

Having said this, I don’t know enough about go to see why it pulls in mercurial, especially mercurial with python2. I see that the mercurial package includes both a python2 and a python3 version. It’ll be best to file a bug so that the maintainers can look at this.

You can see the sources of the rpm packages here:

2 Likes
  1. ok that’s sounds somehow reasonable but they are dependency to each other therefore it still lists the same dependencies :
$ sudo dnf --setopt=install_weak_deps=False install golang-bin
Last metadata expiration check: 2:20:19 ago on Mon 05 Oct 2020 06:49:20 PM CEST.
Dependencies resolved.
======================================================================================================================================================================================================================================
 Package                                                       Architecture                                    Version                                                 Repository                                                Size
======================================================================================================================================================================================================================================
Installing:
 golang-bin                                                    x86_64                                          1.15.2-1.fc33                                           updates-testing                                           81 M
Installing dependencies:
 annobin                                                       x86_64                                          9.28-1.fc33                                             fedora                                                    99 k
 dwz                                                           x86_64                                          0.13-4.fc33                                             fedora                                                   106 k
 efi-srpm-macros                                               noarch                                          4-5.fc33                                                fedora                                                    21 k
 fonts-srpm-macros                                             noarch                                          1:2.0.5-4.fc33                                          fedora                                                    27 k
 fpc-srpm-macros                                               noarch                                          1.3-2.fc33                                              fedora                                                   7.6 k
 ghc-srpm-macros                                               noarch                                          1.5.0-3.fc33                                            fedora                                                   7.7 k
 gnat-srpm-macros                                              noarch                                          4-12.fc33                                               fedora                                                   8.2 k
 go-srpm-macros                                                noarch                                          3.0.9-1.fc33                                            fedora                                                    25 k
 golang                                                        x86_64                                          1.15.2-1.fc33                                           updates-testing                                          642 k
 golang-src                                                    noarch                                          1.15.2-1.fc33                                           updates-testing                                          7.2 M
 kernel-srpm-macros                                            noarch                                          1.0-3.fc33                                              fedora                                                   7.2 k
 lua-srpm-macros                                               noarch                                          1-2.fc33                                                updates-testing                                          7.9 k
 nim-srpm-macros                                               noarch                                          3-3.fc33                                                fedora                                                   8.3 k
 ocaml-srpm-macros                                             noarch                                          6-3.fc33                                                fedora                                                   7.7 k
 openblas-srpm-macros                                          noarch                                          2-8.fc33                                                fedora                                                   7.2 k
 perl-srpm-macros                                              noarch                                          1-38.fc33                                               fedora                                                   8.3 k
 python-srpm-macros                                            noarch                                          3.9-10.fc33                                             updates-testing                                           20 k
 qt5-srpm-macros                                               noarch                                          5.15.1-1.fc33                                           updates-testing                                          8.3 k
 redhat-rpm-config                                             noarch                                          172-1.fc33                                              updates-testing                                           66 k
 rust-srpm-macros                                              noarch                                          15-2.fc33                                               fedora                                                   9.8 k

Transaction Summary
======================================================================================================================================================================================================================================
Install  21 Packages

Total download size: 89 M
Installed size: 345 M
Is this ok [y/N]:
Rather, it is to make all these tools available with all the bits necessary to ensure that as much as possible of their functionality is enabled.

I got it. It is great for users which aren’t really aware what is happening in their OS … but for me it just sounds awkward. I would rather keep my OS as clean as possible …

Either ways thanks a lot for input.
I think we can close this topic.

1 Like

As state above python2 dependency is there due to mercurial package != golang.

2 Likes

Yes, the srpm-macros packages are required for building RPMs. If you speak to the maintainers, they can tweak these dependencies to suit use cases.

1 Like