pytest-dev / pytest-forked

extracted --boxed from pytest-xdist to ensure backward compat
MIT License
62 stars 21 forks source link

pytest-xdist-1.0.2 installation fails with ImportError: No module named 'setuptools' #18

Closed Lekensteyn closed 5 years ago

Lekensteyn commented 5 years ago

Since a recent pytest update, pip3 install pytest pytest-xdist fails in an Ubuntu 16.04 image on Travis (macOS and Windows images works fine).

Example log:

$ pip3 install pytest pytest-xdist
Collecting pytest
  Downloading https://files.pythonhosted.org/packages/11/e9/dc9a7269a7e1fed46de7d5864da6a86370256c791bf263dd0c7d7e8f1ff1/pytest-4.2.1-py2.py3-none-any.whl (218kB)
    100% |████████████████████████████████| 225kB 4.0MB/s 
Collecting pytest-xdist
  Downloading https://files.pythonhosted.org/packages/fb/24/b71217c2083beca1f3b1fb8b32030c68ef189a718034bafe6b5895daf6a8/pytest_xdist-1.26.1-py2.py3-none-any.whl
Collecting six>=1.10.0 (from pytest)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting atomicwrites>=1.0 (from pytest)
  Downloading https://files.pythonhosted.org/packages/52/90/6155aa926f43f2b2a22b01be7241be3bfd1ceaf7d0b3267213e8127d41f4/atomicwrites-1.3.0-py2.py3-none-any.whl
Collecting setuptools (from pytest)
  Downloading https://files.pythonhosted.org/packages/d1/6a/4b2fcefd2ea0868810e92d519dacac1ddc64a2e53ba9e3422c3b62b378a6/setuptools-40.8.0-py2.py3-none-any.whl (575kB)
    100% |████████████████████████████████| 583kB 2.3MB/s 
Collecting more-itertools>=4.0.0; python_version > "2.7" (from pytest)
  Downloading https://files.pythonhosted.org/packages/ae/d4/d6bad4844831943dd667510947712750004525c5807711982f4ec390da2b/more_itertools-6.0.0-py3-none-any.whl (52kB)
    100% |████████████████████████████████| 61kB 9.0MB/s 
Collecting pluggy>=0.7 (from pytest)
  Downloading https://files.pythonhosted.org/packages/2d/60/f58d9e8197f911f9405bf7e02227b43a2acc2c2f1a8cbb1be5ecf6bfd0b8/pluggy-0.8.1-py2.py3-none-any.whl
Collecting py>=1.5.0 (from pytest)
  Downloading https://files.pythonhosted.org/packages/3e/c7/3da685ef117d42ac8d71af525208759742dd235f8094221fdaafcd3dba8f/py-1.7.0-py2.py3-none-any.whl (83kB)
    100% |████████████████████████████████| 92kB 8.8MB/s 
Collecting pathlib2>=2.2.0; python_version < "3.6" (from pytest)
  Downloading https://files.pythonhosted.org/packages/2a/46/c696dcf1c7aad917b39b875acdc5451975e3a9b4890dca8329983201c97a/pathlib2-2.3.3-py2.py3-none-any.whl
Collecting attrs>=17.4.0 (from pytest)
  Downloading https://files.pythonhosted.org/packages/3a/e1/5f9023cc983f1a628a8c2fd051ad19e76ff7b142a0faf329336f9a62a514/attrs-18.2.0-py2.py3-none-any.whl
Collecting pytest-forked (from pytest-xdist)
  Downloading https://files.pythonhosted.org/packages/30/be/cb5dc4f0fa5ba121943305f4f235dc1a30fae53daac20094ab89f4618578/pytest-forked-1.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: No module named 'setuptools'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-pov9bhcq/pytest-forked/
You are using pip version 8.1.1, however version 19.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Indeed, installing python3-pip via apt did recommend python3-setuptools, but it did not actually install it.

The output for the last working version is:

$ pip3 install pytest pytest-xdist
Collecting pytest
  Downloading https://files.pythonhosted.org/packages/11/e9/dc9a7269a7e1fed46de7d5864da6a86370256c791bf263dd0c7d7e8f1ff1/pytest-4.2.1-py2.py3-none-any.whl (218kB)
    100% |████████████████████████████████| 225kB 4.0MB/s 
Collecting pytest-xdist
  Downloading https://files.pythonhosted.org/packages/fb/24/b71217c2083beca1f3b1fb8b32030c68ef189a718034bafe6b5895daf6a8/pytest_xdist-1.26.1-py2.py3-none-any.whl
Collecting more-itertools>=4.0.0; python_version > "2.7" (from pytest)
  Downloading https://files.pythonhosted.org/packages/ae/d4/d6bad4844831943dd667510947712750004525c5807711982f4ec390da2b/more_itertools-6.0.0-py3-none-any.whl (52kB)
    100% |████████████████████████████████| 61kB 10.6MB/s 
Collecting six>=1.10.0 (from pytest)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting pluggy>=0.7 (from pytest)
  Downloading https://files.pythonhosted.org/packages/2d/60/f58d9e8197f911f9405bf7e02227b43a2acc2c2f1a8cbb1be5ecf6bfd0b8/pluggy-0.8.1-py2.py3-none-any.whl
Collecting attrs>=17.4.0 (from pytest)
  Downloading https://files.pythonhosted.org/packages/3a/e1/5f9023cc983f1a628a8c2fd051ad19e76ff7b142a0faf329336f9a62a514/attrs-18.2.0-py2.py3-none-any.whl
Collecting setuptools (from pytest)
  Downloading https://files.pythonhosted.org/packages/d1/6a/4b2fcefd2ea0868810e92d519dacac1ddc64a2e53ba9e3422c3b62b378a6/setuptools-40.8.0-py2.py3-none-any.whl (575kB)
    100% |████████████████████████████████| 583kB 2.4MB/s 
Collecting atomicwrites>=1.0 (from pytest)
  Downloading https://files.pythonhosted.org/packages/52/90/6155aa926f43f2b2a22b01be7241be3bfd1ceaf7d0b3267213e8127d41f4/atomicwrites-1.3.0-py2.py3-none-any.whl
Collecting pathlib2>=2.2.0; python_version < "3.6" (from pytest)
  Downloading https://files.pythonhosted.org/packages/2a/46/c696dcf1c7aad917b39b875acdc5451975e3a9b4890dca8329983201c97a/pathlib2-2.3.3-py2.py3-none-any.whl
Collecting py>=1.5.0 (from pytest)
  Downloading https://files.pythonhosted.org/packages/3e/c7/3da685ef117d42ac8d71af525208759742dd235f8094221fdaafcd3dba8f/py-1.7.0-py2.py3-none-any.whl (83kB)
    100% |████████████████████████████████| 92kB 9.2MB/s 
Collecting pytest-forked (from pytest-xdist)
  Downloading https://files.pythonhosted.org/packages/b0/2a/99ec2a8a26c0a911f76ec2a9461ff0e0d97b5b7bd3282de57eca947f39fc/pytest_forked-1.0.1-py2.py3-none-any.whl
Collecting execnet>=1.1 (from pytest-xdist)
  Downloading https://files.pythonhosted.org/packages/f9/76/3343e69a2a1602052f587898934e5fea395d22310d39c07955596597227c/execnet-1.5.0-py2.py3-none-any.whl
Collecting apipkg>=1.4 (from execnet>=1.1->pytest-xdist)
  Downloading https://files.pythonhosted.org/packages/67/08/4815a09603fc800209431bec5b8bd2acf2f95abdfb558a44a42507fb94da/apipkg-1.5-py2.py3-none-any.whl
Installing collected packages: more-itertools, six, pluggy, attrs, setuptools, atomicwrites, pathlib2, py, pytest, pytest-forked, apipkg, execnet, pytest-xdist
Successfully installed apipkg atomicwrites attrs execnet more-itertools pathlib2 pluggy py pytest pytest-forked pytest-xdist setuptools six-1.10.0
You are using pip version 8.1.1, however version 19.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
nicoddemus commented 5 years ago

Hi @Lekensteyn,

Nothing has changed really regarding setuptools in 1.0.2. I notice though that you are using pip 8.1.1, which is quite old. Could you try to update your pip version?

Lekensteyn commented 5 years ago

I could try to upgrade pip, but not sure if it would help. I have tried to upgrade pip, but it still complains about missing setuptools.

This is the delta between the above two installations:

@@ -1,13 +1,11 @@
-apipkg-1.5-py2.py3-none-any.whl
 atomicwrites-1.3.0-py2.py3-none-any.whl
 attrs-18.2.0-py2.py3-none-any.whl
-execnet-1.5.0-py2.py3-none-any.whl
 more_itertools-6.0.0-py3-none-any.whl
 pathlib2-2.3.3-py2.py3-none-any.whl
 pluggy-0.8.1-py2.py3-none-any.whl
 py-1.7.0-py2.py3-none-any.whl
 pytest-4.2.1-py2.py3-none-any.whl
-pytest_forked-1.0.1-py2.py3-none-any.whl
+pytest-forked-1.0.2.tar.gz
 pytest_xdist-1.26.1-py2.py3-none-any.whl
 setuptools-40.8.0-py2.py3-none-any.whl
 six-1.12.0-py2.py3-none-any.whl

My guess is that no wheel is available, so pip tries to install it from source (which fails due to missing build dependencies)? And sure enough, the whl file is missing here as well: https://pypi.org/project/pytest-forked/1.0.2/#files https://pypi.org/project/pytest-forked/1.0.1/#files (working, has wheel)

nicoddemus commented 5 years ago

Oh thanks for noticing that. I will upload the wheels then.

nicoddemus commented 5 years ago

wheels uploaded, thanks!

I can't reproduce your failure though, I was able to previously install pytest-forked using only the source distribution.

nicoddemus commented 5 years ago

Please check if using wheels fixes the problem for you.

gillesdouaire commented 5 years ago

In our case, we had a much different symptom, but uploading the wheel fixed it.

nicoddemus commented 5 years ago

OK, thanks for the follow up

Lekensteyn commented 5 years ago

Thanks, I can confirm that all builds are green again!

hvdklauw commented 5 years ago

For us the added wheels actually broke pipenv with using the pure lock file because the recorded hashes where missing the wheel's hash.

Installing dependencies from Pipfile.lock (4bc183)…
Ignoring appnope: markers 'sys_platform == "darwin"' don't match your environment
An error occurred while installing pytest-forked==1.0.2 --hash=sha256:d352aaced2ebd54d42a65825722cb433004b4446ab5d2044851d9cc7a00c9e38! Will try again.
Installing initially failed dependencies…
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 1874, in do_install
[pipenv.exceptions.InstallError]:       keep_outdated=keep_outdated
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 1253, in do_init
[pipenv.exceptions.InstallError]:       pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 859, in do_install_dependencies
[pipenv.exceptions.InstallError]:       retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 763, in batch_install
[pipenv.exceptions.InstallError]:       _cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry)
[pipenv.exceptions.InstallError]:   File "/usr/local/lib/python3.6/dist-packages/pipenv/core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]:       raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: ['Collecting pytest-forked==1.0.2 (from -r /tmp/pipenv-ic2vu1as-requirements/pipenv-sbxnd55b-requirement.txt (line 1))', '  Using cached https://files.pythonhosted.org/packages/3f/55/ef92c340e723495dbee91d749903d2b7950b49c501943296257246d7d880/pytest_forked-1.0.2-py2.py3-none-any.whl']
[pipenv.exceptions.InstallError]: ['THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.', '    pytest-forked==1.0.2 from https://files.pythonhosted.org/packages/3f/55/ef92c340e723495dbee91d749903d2b7950b49c501943296257246d7d880/pytest_forked-1.0.2-py2.py3-none-any.whl#sha256=5fe33fbd07d7b1302c95310803a5e5726a4ff7f19d5a542b7ce57c76fed8135f (from -r /tmp/pipenv-ic2vu1as-requirements/pipenv-sbxnd55b-requirement.txt (line 1)):', '        Expected sha256 d352aaced2ebd54d42a65825722cb433004b4446ab5d2044851d9cc7a00c9e38', '             Got        5fe33fbd07d7b1302c95310803a5e5726a4ff7f19d5a542b7ce57c76fed8135f']
ERROR: ERROR: Package installation failed...

No need to reopen, just logging it here in case someone else has the problem.

Simply do a pipenv update to fix it.