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

Could not build wheels for pendulum which use PEP 517 #454

Closed
2 tasks done
weskerfoot opened this issue Mar 28, 2020 · 37 comments · Fixed by #488 or #489
Closed
2 tasks done

Could not build wheels for pendulum which use PEP 517 #454

weskerfoot opened this issue Mar 28, 2020 · 37 comments · Fixed by #488 or #489

Comments

@weskerfoot
Copy link

weskerfoot commented Mar 28, 2020

  • 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
@weskerfoot weskerfoot changed the title ERROR: Could not build wheels for pendulum which use PEP 517 and cannot be installed directly Could not build wheels for pendulum which use PEP 517 Mar 28, 2020
@altendky
Copy link
Contributor

altendky commented Mar 28, 2020

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.

@weskerfoot
Copy link
Author

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

@aniljaiswal
Copy link

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

@Hellowlol
Copy link

I'm having the same issue in the home assistant 107.7 (hassio)

@weskerfoot
Copy link
Author

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.

@davegallant
Copy link

davegallant commented Apr 2, 2020

❯ colordiff pendulum-2.0.5/setup.py pendulum-2.1.0/setup.py
2c2
< from distutils.core import setup
---
> from setuptools import setup

Does anyone know where this setup.py is being generated? It has changed in 2.1.0
https://files.pythonhosted.org/packages/e5/dc/d79687e49cafbdee73078b28c57d2a2555735c88d672239e4cb19a6a141a/pendulum-2.1.0.tar.gz

@altendky
Copy link
Contributor

altendky commented Apr 2, 2020

Poetry would be building it I would think. But, pyproject.toml will get hit first (for 517-compatible pips) and that specifies poetry as the build backend not setuptools. And poetry is missing an install_requires for setuptools afaict thus causing the error. So it seems to me that either that needs to be addressed or pendulum needs to build a pyproject.toml with a build-system requires including setuptools and the corresponding build-backend.

@altendky
Copy link
Contributor

altendky commented Apr 2, 2020

@davegallant, commit-wise it looks to be: python-poetry/poetry@f759876

@altendky
Copy link
Contributor

altendky commented Apr 2, 2020

I just realized we don't have a full log here. @weskerfoot, could you add that?

@weskerfoot
Copy link
Author

@altendky done
docker_build.log

@aniljaiswal
Copy link

Any update on the above issue?

@altendky
Copy link
Contributor

I think python-poetry/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.

@nathan5280
Copy link

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

@ThanhTuNguyen
Copy link

Please fix this issue, thanks

@gmr
Copy link

gmr commented May 18, 2020

Why is poetry required to install pendulum?

@altendky
Copy link
Contributor

Poetry is required to build pendulum. If you are on a system for which wheels (prebuilt packages) are not provided then it needs to be built from the source distribution. This can also happen if you tell pip not to use wheels. If you can and do use the wheels then poetry should not be required.

@enercalc
Copy link

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
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
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 "", line 1, in
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

@richieadler
Copy link

Can confirm that I get the same error @enercalc is getting.

  • Windows 7 Build 7601
  • Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)]
  • setuptools 47.1.0

Pendulum 2.0.3 installs correctly.

@ajayd2k
Copy link

ajayd2k commented Jun 10, 2020

Windows 10 :

I installed the PIP version 18.1 with the below command
C:>pip install pip==18.1

Then Install the pendulum with the command:
C:>pip install pendulum

No errors now

@weskerfoot
Copy link
Author

weskerfoot commented Jun 20, 2020

Poetry is required to build pendulum. If you are on a system for which wheels (prebuilt packages) are not provided then it needs to be built from the source distribution. This can also happen if you tell pip not to use wheels. If you can and do use the wheels then poetry should not be required.

To add to that, the reason it's an issue on Alpine is because Alpine doesn't have prebuilt wheels available (because it's using musl libc, so it needs to get recompiled for that), so you have to build them from source every time you install it.

@alertedsnake
Copy link

To add to that, the reason it's an issue on Alpine is because Alpine doesn't have prebuilt wheels available (because it's using musl libc, so it needs to get recompiled for that), so you have to build them from source every time you install it.

We build wheels for Alpine and serve them via devpi so we don't have to have build tools in containers and such. And we still have problems building a wheel for Pendulum :)

@ThanhTuNguyen
Copy link

Someone should fix this bug, it's been a couple months. i can not downgrade my pip, it will effect to other libraries. Right now i just mess up to my docker file in order to install poetry and pendulum directly into container. Its a bizarre solution :(

@joshourisman
Copy link

For pipenv users, this got my Pipfile with a pendulum dependency installing on Alpine:

FROM python:3.8-alpine

RUN apk update \
    && apk add --no-cache build-base postgresql-dev openssl-dev libffi-dev \
    && pip3 install -U pipenv poetry

WORKDIR /app
ENV WORKON_HOME /app/.venvs
COPY Pipfile Pipfile.lock ./
RUN pipenv install --deploy --site-packages

The important parts are installing poetry with the system pip, and then adding the --site-packages flag when invoking pipenv install.

@frostming
Copy link

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

@williamjacksn
Copy link

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

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

@RazerM
Copy link

RazerM commented Jul 23, 2020

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.

@richieadler
Copy link

I really like pendulum, it's baffling that this hasn't been resolved for so long.

I was able to solve it in Windows 7, Python 3.8 32 bits following @frostming advice, above.

@sdispater
Copy link
Owner

This should be fixed in the latest 2.1.2 release.

@ThanhTuNguyen
Copy link

It work like normal. Just tested .Thanks

@ritumishra9
Copy link

i am getting the same error while installing mysqlclient

DEPRECATION: Could not build wheels for mysqlclient which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above.

wheel issue is-
Building wheel for mysql (setup.py) ... done
Created wheel for mysql: filename=mysql-0.0.2-py3-none-any.whl size=1252 sha256=ca801d4e9888754369abcdfb5791654e3a43361475a58726257b7954c7c4d735
Stored in directory: c:\users\admin\appdata\local\pip\cache\wheels\3e\4a\d0\506edab38d1bdf574b02c24805fcf7348a327297fcc285431d
Building wheel for client (setup.py) ... done
Created wheel for client: filename=client-0.0.1-py3-none-any.whl size=1441 sha256=cf97824f8b63db528014243e69082705c78c4397ca5891bfb2b7217a107e943c
Stored in directory: c:\users\admin\appdata\local\pip\cache\wheels\1e\d6\d3\2084ee3b4ac9adaab2bf853307b140575c5fe9160821ab8e07
Building wheel for mysqlclient (setup.py) ... error
ERROR: Command errored out with exit status 1:

@altendky
Copy link
Contributor

@ritumishra9, I would suggest reporting this to mysqlclient. Though the references to mysql 0.0.1 and client 0.0.2 seem odd.

@spacemanspiff2007
Copy link

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.

I'm still supporting people (with more or less success) that are getting this exact same issue at the end of 2021. 👎

@altendky
Copy link
Contributor

It usually works best to create a new ticket with complete details of your case and a link to the existing ticket that you think is related. It's hard to help when the issue appears to be solved and no new information is provided.

To be clear, I'm not particularly involved with this project. Just offering some guidance on a path forward that's more likely to result in fixing your issues.

@spacemanspiff2007
Copy link

spacemanspiff2007 commented Dec 13, 2021

It usually works best to create a new ticket with complete details of your case

It's difficult because I use pendulum as a dependency for an application and the users try to get support from me and often don't provide all the required information.
That would be much appreciated since I am far from an expert! I just try to get them to do things that I found in the issues here.
So far it seems that pendulum 2.1.0 will install on most the machines without issues.

Ideally we would consolidate these infos e.g. pendulum requires poetry or otherwise it won't install properly with pip.

@altendky
Copy link
Contributor

The new issue bug report template provides a starting point. Generally speaking you want the OS including version and architecture, Python version, Pendulum version, full terminal session (prompt, command, and output), and maybe also other cases where the same thing does work to help isolate what differences might show the issue. If the command you are running has a verbose option the full output as above could also be provided with the extra verbosity.

@ethanmsl
Copy link

ethanmsl commented Dec 8, 2023

  at ~/Library/Application Support/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/chef.py:164 in _prepare
      160│
      161│                 error = ChefBuildError("\n\n".join(message_parts))
      162│
      163│             if error is not None:
    → 164│                 raise error from None
      165│
      166│             return path
      167│
      168│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with pendulum (2.1.2) not supporting PEP 517 builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "pendulum (==2.1.2)"'.

I'm also getting errors on attempting to install Pendulum, with nominal "pendulum (2.1.2) not supporting PEP 517 builds".

macOS 13.6.2, M1_chip

@edgarrmondragon
Copy link
Contributor

@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.

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