Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fastcov does not work anymore on a ubuntu 18.04 machine #58

Closed
jcelerier opened this issue Sep 1, 2020 · 8 comments
Closed

fastcov does not work anymore on a ubuntu 18.04 machine #58

jcelerier opened this issue Sep 1, 2020 · 8 comments

Comments

@jcelerier
Copy link
Contributor

jcelerier commented Sep 1, 2020

Repro:

docker run -it ubuntu:18.04

apt -y -qq update
apt -y -qq upgrade
apt -y -qq install git python3 python3-pip 
pip3 install git+https://github.com/rpgillespie6/fastcov.git

gives me:

root@822b87e435a1:/# fastcov
Traceback (most recent call last):
  File "/usr/bin/fastcov", line 10, in <module>
    from importlib.metadata import distribution
ModuleNotFoundError: No module named 'importlib.metadata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/fastcov", line 13, in <module>
    from importlib_metadata import distribution
ModuleNotFoundError: No module named 'importlib_metadata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/fastcov", line 15, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 3238, in <module>
    @_call_aside
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 3222, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 3251, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 567, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 884, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 770, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'fastcov==1.8' distribution was not found and is required by the application

It works on 20.04 though, which uses python 3.8. But some CI services don't provide it yet :/

@RPGillespie6
Copy link
Owner

Hmm, my primary linux box is Xubuntu 18.04 and it seems to be working fine:

╭─user@cobalt ~
╰─$ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
╭─user@cobalt ~
╰─$ pip3 install git+https://github.com/rpgillespie6/fastcov.git
Collecting git+https://github.com/rpgillespie6/fastcov.git
  Cloning https://github.com/rpgillespie6/fastcov.git to /tmp/pip-8z6h5itt-build
Installing collected packages: fastcov
  Running setup.py install for fastcov ... done
Successfully installed fastcov-1.8

I will try repoducing in a docker container, but my suspicion is that it might have to do with the recent setuptools issue: https://github.com/pypa/setuptools/issues/2350

@RPGillespie6
Copy link
Owner

RPGillespie6 commented Sep 1, 2020

I'm not able to reproduce with a docker container either:

root@479f637cf796:/# pip3 install git+https://github.com/rpgillespie6/fastcov.git
Collecting git+https://github.com/rpgillespie6/fastcov.git
  Cloning https://github.com/rpgillespie6/fastcov.git to /tmp/pip-8te4bpdc-build
Installing collected packages: fastcov
  Running setup.py install for fastcov ... done
Successfully installed fastcov-1.8

root@479f637cf796:/# cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

root@479f637cf796:/# fastcov
Minimum gcov version 9.0.0 required, found 7.5.0

Let's compare pip versions:

root@479f637cf796:/# pip3 list
asn1crypto (0.24.0)
cryptography (2.1.4)
fastcov (1.8)
idna (2.6)
keyring (10.6.0)
keyrings.alt (3.0)
pip (9.0.1)
pycrypto (2.6.1)
pygobject (3.26.1)
pyxdg (0.25)
SecretStorage (2.3.1)
setuptools (39.0.1)
six (1.11.0)
wheel (0.30.0)

And here's my docker image info:

I tried both:

REPOSITORY                                    TAG                 IMAGE ID
ubuntu                                        18.04               a2a15febcdf3 (image from 12 months ago)
ubuntu                                        18.04               6526a1858e5d (image from 1 September 2020)

@RPGillespie6
Copy link
Owner

Can you try again with 6526a1858e5d?

As a workaround, you can also bypass pip and just curl (or wget) the raw python script here and move it to /usr/local/bin/fastcov (of course, you'll need to chmod +x as well).

@jcelerier
Copy link
Contributor Author

Hm damn, found the issue, seems that it's an incompatibility with a more recent version of wheel / setuptools - I had removed those from my build lines sent earlier as I didn't think that was it yet it's actually what causes the problem.

Complete dockerfile that reproduces the issue (checked that my image id is indeed 6526a1858e5d):

FROM ubuntu:18.04

RUN apt update -y -qq && \
    apt upgrade -y -qq && \
    apt install -y -qq git python3 python3-pip 

# the problem seems to come from putting those at the latest version
RUN pip3 install --upgrade wheel setuptools

RUN pip3 install git+https://github.com/rpgillespie6/fastcov.git
RUN /usr/bin/fastcov

@RPGillespie6
Copy link
Owner

RPGillespie6 commented Sep 1, 2020

You're right, I see the issue now. I'll have to take a look and see if setup.cfg or setup.py need to be updated because of some breaking change in newest versions of setuptools/wheel...

@RPGillespie6
Copy link
Owner

RPGillespie6 commented Sep 1, 2020

Ok, I've confirmed the issue is due to these:
https://github.com/pypa/setuptools/issues/2350
pypa/setuptools#2232

Issue can be worked around multiple ways:

  1. Export the following environment variable before installation:
export SETUPTOOLS_USE_DISTUTILS=stdlib
  1. Use pre-built distribution:
pip3 install fastcov
  1. Wait until setuptools 51 comes out (?)

  2. Use a non-Debian-derived base image

  3. Use setuptools <= 49

It's not clear to me yet if I need to make some change on my end. Seems like the python folks are still working this out.

@jcelerier
Copy link
Contributor Author

Okay, thanks for looking into it ! Sounds like upstream / debian bugs indeed so sorry for the bother.

@RPGillespie6
Copy link
Owner

np, will reopen if there is an issue with setup.cfg that needs fixing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants