Install using flit works on python 3.8 but fails on 3.6 and 3.7

my builds started to fail at the installation stage

on python3.8 all goes fine

$ python --version
Python 3.8.0
$ pip --version
pip 19.3 from /home/travis/virtualenv/python3.8.0/lib/python3.8/site-packages/pip (python 3.8)
$ pip install tox-travis
$ tox
.package installdeps: flit
py38 create: /home/travis/build/avaldebe/PyPMS/.tox/py38
py38 installdeps: pytest
py38 inst: /home/travis/build/avaldebe/PyPMS/.tox/.tmp/package/1/PyPMS-0.1.5.tar.gz
[...]

but on python3.6 and 3.7 the installation fails

$ python --version
Python 3.6.7
$ pip --version
pip 19.0.3 from /home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/pip (python 3.6)
$ pip install tox-travis
$ tox
.package create: /home/travis/build/avaldebe/PyPMS/.tox/.package
.package installdeps: flit
py36 create: /home/travis/build/avaldebe/PyPMS/.tox/py36
py36 installdeps: pytest, pytest-black, pytest-mypy
py36 inst: /home/travis/build/avaldebe/PyPMS/.tox/.tmp/package/1/PyPMS-0.1.5.tar.gz
ERROR: invocation failed (exit code 1), logfile: /home/travis/build/avaldebe/PyPMS/.tox/py36/log/py36-2.log
================================== log start ===================================
Processing ./.tox/.tmp/package/1/PyPMS-0.1.5.tar.gz
  Missing build time requirements in pyproject.toml for file:///home/travis/build/avaldebe/PyPMS/.tox/.tmp/package/1/PyPMS-0.1.5.tar.gz: 'setuptools' and 'wheel'.
  This version of pip does not implement PEP 517 so it cannot build a wheel without 'setuptools' and 'wheel'.
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/travis/build/avaldebe/PyPMS/.tox/py36/lib/python3.6/tokenize.py", line 452, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-req-build-8cdyu2ei/setup.py'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-8cdyu2ei/

BTW, I’m using flit to setup/install the package and tox to run my tests

The output is pretty descriptive. Did you try doing as it suggests?

I use flit so I do not need to write a setup.py my self. It used to work fine about 5 months ago when I last worked on this project. In fact the first build that failed was after adding some doc files, which should not affect the installation process.

Besides, it only fails on python 3.6 and 3.7. It works fine on python 3.8 and on my local machine…

Any number of things have changed since then – package versions in particular. Until you properly diagnose the problem, you cannot say who the culprit is. Passing on the local machine also means nothing because any number of things can be different there.

I would first check the contents of the log files referenced and of the generated PyPMS-0.1.5.tar.gz archive for any oddities and differences from 3.8 and pull the thread from there.

Thanks for the insight. It seems that flit gets confused between the travis virtual environment and the tox virtual environment.

So to install properly I needed to change the install and script entries on my .travis.yml from

install: pip install tox-travis
script: tox

to

 install:
  - pip install flit
  - flit install

script:
  - pytest

Still need to replicate the functionality tox provided using a matrix, but now I know what the problem was.

Thanks again,
Á.

1 Like