Failing build with python - ERROR:root:ImportError

We are experiencing recent failing build on Python and Tox testing with following error message which is not easy to trace back ERROR:root:ImportError: cannot import name ensure_text since we do not call any ensure_text in our code…
Moreover, it related to recent changes in env because the commit which was passing on Friday I have re-build today and it is failing environmental requirements are fixed (eg in min requirements build)
See build https://travis-ci.org/Borda/pytorch-lightning/builds/648792651 or https://travis-ci.org/PyTorchLightning/pytorch-lightning/builds/648731468

If the re-run of your previously passing job now fails, I strongly suspect changes in your underlying dependencies. Comparing https://travis-ci.org/PyTorchLightning/pytorch-lightning/jobs/648161313 and https://travis-ci.org/PyTorchLightning/pytorch-lightning/jobs/648731469, for example, you see that many of the modules changed: virtualenv updated, new dependencies appdirs and import-resources appear, and so on.

You should eliminate examine these changes carefully, and find the source of the problem.

@BanzaiMan thx for so fast reply… Where can I check the changed virtenv?
I see just list of installed package where the versions are equal:

  • Failing: Successfully installed absl-py-0.9.0 future-0.17.1 grpcio-1.27.1 markdown-3.2 numpy-1.16.4 protobuf-3.11.3 scikit-learn-0.20.2 scipy-1.4.1 setuptools-45.2.0 tensorboard-1.14.0 torch-1.1.0 tqdm-4.35.0 werkzeug-1.0.0
  • Succesfull: Successfully installed absl-py-0.9.0 future-0.17.1 grpcio-1.27.1 markdown-3.2 numpy-1.16.4 pillow-7.0.0 protobuf-3.11.3 scikit-learn-0.20.2 scipy-1.4.1 setuptools-45.2.0 tensorboard-1.14.0 torch-1.1.0 torchvision-0.4.0 tqdm-4.35.0 werkzeug-1.0.0

It appears something (tox, maybe?) is hiding some crucial text with its fancy text handling. Go to the “Raw log” https://api.travis-ci.org/v3/job/648731469/log.txt to see the entire logs.

1 Like

Now it is failling on calling check-manifest on osX

Traceback (most recent call last):
  File "/Users/travis/build/Borda/pytorch-lightning/.tox/py37/bin/check-manifest", line 5, in <module>
    from check_manifest import main
ModuleNotFoundError: No module named 'check_manifest'

which I have not seen yet, https://travis-ci.org/Borda/pytorch-lightning/jobs/648932100

https://travis-ci.org/Borda/pytorch-lightning/jobs/648932100#L211

pip install tests/requirements.txt

If this is indeed an install command, it logically belongs to the install phase, not before_script.
Then, a nonzero exit status of this command will halt the job execution, and will not give you the wrong impression that it was check-manifest that failed; the failure happened long time before that.

it is crashing in Tox, which is installing all requirements to own virtual env…

@Borda this is a known bug that appears with the newest virtualenv>=20. The problem is actually with the Pip dependency resolver that doesn’t get the latest six on the system (that new virtualenv depends on).

The workaround is to do:

pip install -U six

before invoking tox (or anything else that tries to use virtualenv).

@BanzaiMan on the Travis CI side you could patch this in a similar way: by providing VMs with the newest six next to the newest virtualenv on board.

1 Like