pendulum: Could not build wheels for pendulum which use PEP 517

  • I am on the latest Pendulum version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • Alpine 3.11 in Docker

  • Pendulum 2.1.0

Issue

I get an error about PEP 517 when trying to install Pendulum. The following Dockerfile (run with docker build .) reproduces the issue.

The error is ERROR: Could not build wheels for pendulum which use PEP 517 and cannot be installed directly

FROM python:3.7-alpine3.11
RUN apk update \
    && apk add gcc musl-dev python3-dev py3-setuptools libffi libffi-dev openssl-dev \
    && pip3 install pendulum==2.1.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 16
  • Comments: 37 (11 by maintainers)

Commits related to this issue

Most upvoted comments

This should be fixed in the latest 2.1.2 release.

Workaround (for this situation, running in Docker with Alpine)

FROM python:3.7-alpine3.11
RUN apk update \
    && apk add gcc musl-dev python3-dev py3-setuptools libffi libffi-dev openssl-dev \
    && pip3 install poetry \
    && pip3 install --no-build-isolation pendulum==2.1.0

There are multiple reasons behind this:

  1. Alpine can’t match any of the wheels released on pypi
  2. Building pendulum from source dist requires setuptools, but it is not specified in pyproject.toml’s [build-systems] requires
  3. Starting from pip 19, it creates a clean isolated environment to install PEP 517 powered libraries.

So the corresponding resolution will be:

  1. If possible, use slim images instead of alpine
  2. Downgrade pip to 18.1
  3. Otherwise, use the following commands to install:
    $ pip install poetry && pip install --no-build-isolation pendulum
    
  4. Waiting for @sdispater to release a new version of pendulum with fixed pyproject.toml

I was able to get this to work in my dockerfile by downgrading my version of pip. I didn’t keep track of all the details, but it seems that up to about version 1.0.4 it works with pip 19.x. After that we get the issue listed above.

pip install pip==18.1

I think python-poetry/core#24 (also mentioned at https://github.com/python-poetry/poetry/pull/2262/files/ad2c8d80f4f04a95769a5955e4367f1351aaca76#diff-d4e7f533c342aecaeb13b29ca6c1bf24) should resolve this. I have not tested at all, just getting the cross-references added.

Thanks @abn.

My quick looking suggests…

  1. It’s Alpine so the pendulum wheels aren’t used so that explains the issue not being as wide spread as it might be
  2. The poetry tarball doesn’t list setuptools as an install_requires and thus the isolated build env doesn’t have setuptools (the poetry .whl should be used but I know where to look in the tarball…)

Now I’m not sure of the nuances here and I haven’t tested my theory quite yet but… FWIW.

I really like pendulum, it’s baffling that this hasn’t been resolved for so long. I understand that the author wrote poetry but it’s not a glowing endorsement that people haven’t been able to install pendulum for three months because of it.

Any workarounds for people using pipenv? I’m using the same docker setup but using pipenv and lock files.

@ethanmsl Pendulum 3.0.0b1 has wheels for M1 macs and Python 3.12, but builds of Pendulum 2.* on Python 3.12+ seem like they’ll be forever broken.

I got tired of this so I built my own Python package index with wheels for Alpine Linux.

https://github.com/alpine-wheels/index

Windows: Install (python -m pip install pendulum) works on pip 18.1, doesnt work on pip 19.2.3.

Wasn’t clear if you folks had the log you needed, so…

C:\python>python -m pip install pendulum Collecting pendulum Using cached https://files.pythonhosted.org/packages/e5/dc/d79687e49cafbdee73078b28c57d2a2555735c88d672239e4cb19a6a141a/pendulum-2.1.0.tar.gz Installing build dependencies … done Getting requirements to build wheel … done Preparing wheel metadata … done Collecting pytzdata>=2018.3 (from pendulum) Using cached https://files.pythonhosted.org/packages/7f/f9/cdd39831b0465285c02ed90cfbf0db25bb951cb2a35ded0e69222375bea3/pytzdata-2019.3-py2.py3-none-any.whl Requirement already satisfied: python-dateutil<3.0,>=2.6 in c:\python\lib\site-packages (from pendulum) (2.8.1) Requirement already satisfied: six>=1.5 in c:\python\lib\site-packages (from python-dateutil<3.0,>=2.6->pendulum) (1.15.0) Building wheels for collected packages: pendulum Building wheel for pendulum (PEP 517) … error ERROR: Command errored out with exit status 1: command: ‘C:\python\python.exe’ ‘C:\python\lib\site-packages\pip_vendor\pep517_in_process.py’ build_wheel ‘C:\Users\Frame\AppData\Local\Temp\1\tmpo6145lzs’ cwd: C:\Users\Frame\AppData\Local\Temp\1\pip-install-nkecq6bf\pendulum Complete output (24 lines): Traceback (most recent call last): File “setup.py”, line 2, in <module> from setuptools import setup ModuleNotFoundError: No module named ‘setuptools’ Traceback (most recent call last): File “C:\python\lib\site-packages\pip_vendor\pep517_in_process.py”, line 207, in <module> main() File “C:\python\lib\site-packages\pip_vendor\pep517_in_process.py”, line 197, in main json_out[‘return_val’] = hook(**hook_input[‘kwargs’]) File “C:\python\lib\site-packages\pip_vendor\pep517_in_process.py”, line 140, in build_wheel return _build_backend().build_wheel(wheel_directory, config_settings, File “C:\Users\Frame\AppData\Local\Temp\1\pip-build-env-h1_o3poz\overlay\Lib\site-packages\poetry\core\masonry\api.py”, line 57, in build_wheel return unicode(WheelBuilder.make_in(poetry, Path(wheel_directory))) File “C:\Users\Frame\AppData\Local\Temp\1\pip-build-env-h1_o3poz\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py”, line 56, in make_in wb.build() File “C:\Users\Frame\AppData\Local\Temp\1\pip-build-env-h1_o3poz\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py”, line 82, in build self._build(zip_file) File “C:\Users\Frame\AppData\Local\Temp\1\pip-build-env-h1_o3poz\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py”, line 101, in _build self._run_build_command(setup) File “C:\Users\Frame\AppData\Local\Temp\1\pip-build-env-h1_o3poz\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py”, line 129, in _run_build_command subprocess.check_call( File “C:\python\lib\subprocess.py”, line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command ‘[‘C:\python\python.exe’, ‘setup.py’, ‘build’, ‘-b’, ‘build’]’ returned non-zero exit status 1.

ERROR: Failed building wheel for pendulum Running setup.py clean for pendulum ERROR: Command errored out with exit status 1: command: ‘C:\python\python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’“‘C:\Users\Frame\AppData\Local\Temp\1\pip-install-nkecq6bf\pendulum\setup.py’”’“‘; file=’”‘“‘C:\Users\Frame\AppData\Local\Temp\1\pip-install-nkecq6bf\pendulum\setup.py’”’“';f=getattr(tokenize, '”‘“‘open’”’“‘, open)(file);code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ clean --all cwd: C:\Users\Frame\AppData\Local\Temp\1\pip-install-nkecq6bf\pendulum Complete output (3 lines): Traceback (most recent call last): File “<string>”, line 1, in <module> ModuleNotFoundError: No module named ‘setuptools’

ERROR: Failed cleaning build dir for pendulum Failed to build pendulum ERROR: Could not build wheels for pendulum which use PEP 517 and cannot be installed directly

Why is poetry required to install pendulum?

Please fix this issue, thanks

Any workarounds for people using pipenv? I’m using the same docker setup but using pipenv and lock files.

Does pipenv have a similar option to disable build isolation? That would most likely work, though I’m not really familiar with how pipenv does things.