pqcrypto icon indicating copy to clipboard operation
pqcrypto copied to clipboard

have pyproject.toml build depend on setuptools

Open pnwamk opened this issue 3 years ago • 2 comments

I've been trying to build a poetry-based package which depends on this one and I consistently would get the following build error until I added "setuptools" explicitly to the require section in the [build-system] portion of the pyproject.toml:

   • Installing pqcrypto (0.1.3 /..../pqcrypto)
 
   EnvCommandError
 
   Command ['/home/..../.cache/pypoetry/virtualenvs/..../bin/pip', 'install', '--no-deps', '-U', '-e', '/..../pqcrypto'] errored with the following return code 1, and output: 
   Obtaining file:///..../pqcrypto
     Installing build dependencies: started
     Installing build dependencies: finished with status 'done'
     Checking if build backend supports build_editable: started
     Checking if build backend supports build_editable: finished with status 'done'
     Getting requirements to build wheel: started
     Getting requirements to build wheel: finished with status 'done'
     Preparing metadata (pyproject.toml): started
     Preparing metadata (pyproject.toml): finished with status 'done'
   Installing collected packages: pqcrypto
     Running setup.py develop for pqcrypto
       ERROR: Command errored out with exit status 1:
        command: /home/..../.cache/pypoetry/virtualenvs/..../bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/..../pqcrypto/setup.py'"'"'; __file__='"'"'/..../pqcrypto/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
            cwd: /..../pqcrypto/
       Complete output (3 lines):
       Traceback (most recent call last):
         File "<string>", line 1, in <module>
       ModuleNotFoundError: No module named 'setuptools'

I don't have any deep insights to add beyond "this seems to fix the issue I was experiencing". Not sure why I don't also see it when just trying to build the pqcrypto package itself.

pnwamk avatar Jan 20 '22 19:01 pnwamk

Actually the same error seems to be reproducible with a Dockerfile:

FROM python:3.9

RUN pip3 install pqcrypto

Running docker build . with that file yields:

[+] Building 25.2s (6/6) FINISHED                                                                                                                                           
 => [internal] load build definition from Dockerfile                                                                                                                   0.0s
 => => transferring dockerfile: 85B                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/python:3.9                                                                                                          1.3s
 => [auth] library/python:pull token for registry-1.docker.io                                                                                                          0.0s
 => CACHED [1/2] FROM docker.io/library/python:3.9@sha256:bf6f8b201ffac79a1b9fded783e7f0547ad2c2e3e48e96a7a23855c3de14df4b                                             0.0s
 => ERROR [2/2] RUN pip3 install pqcrypto                                                                                                                             23.8s
------                                                                                                                                                                      
 > [2/2] RUN pip3 install pqcrypto:                                                                                                                                         
#6 1.581 Collecting pqcrypto                                                                                                                                                
#6 1.723   Downloading pqcrypto-0.1.3.tar.gz (1.4 MB)                                                                                                                       
#6 5.811   Installing build dependencies: started                                                                                                                           
#6 21.21   Installing build dependencies: finished with status 'done'                                                                                                       
#6 21.22   Getting requirements to build wheel: started
#6 21.51   Getting requirements to build wheel: finished with status 'done'
#6 21.52     Preparing wheel metadata: started
#6 21.84     Preparing wheel metadata: finished with status 'done'
#6 22.21 Collecting cffi<2.0.0,>=1.14.2
#6 22.21   Using cached cffi-1.15.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (444 kB)
#6 22.24 Collecting pycparser
#6 22.24   Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
#6 22.25 Building wheels for collected packages: pqcrypto
#6 22.25   Building wheel for pqcrypto (PEP 517): started
#6 23.47   Building wheel for pqcrypto (PEP 517): finished with status 'error'
#6 23.47   ERROR: Command errored out with exit status 1:
#6 23.47    command: /usr/local/bin/python /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpx35idkp2
#6 23.47        cwd: /tmp/pip-install-jhph1ufu/pqcrypto_6ee9edf169884ebc9d0898c9cf1cb148
#6 23.47   Complete output (25 lines):
#6 23.47   A setup.py file already exists. Using it.
#6 23.47   Traceback (most recent call last):
#6 23.47     File "/tmp/pip-install-jhph1ufu/pqcrypto_6ee9edf169884ebc9d0898c9cf1cb148/setup.py", line 2, in <module>
#6 23.47       from setuptools import setup
#6 23.47   ModuleNotFoundError: No module named 'setuptools'
#6 23.47   Traceback (most recent call last):
#6 23.47     File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 349, in <module>
#6 23.47       main()
#6 23.47     File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 331, in main
#6 23.47       json_out['return_val'] = hook(**hook_input['kwargs'])
#6 23.47     File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 248, in build_wheel
#6 23.47       return _build_backend().build_wheel(wheel_directory, config_settings,
#6 23.47     File "/tmp/pip-build-env-pkf4dvu7/overlay/lib/python3.9/site-packages/poetry/core/masonry/api.py", line 68, in build_wheel
#6 23.47       return unicode(WheelBuilder.make_in(poetry, Path(wheel_directory)))
#6 23.47     File "/tmp/pip-build-env-pkf4dvu7/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 72, in make_in
#6 23.47       wb.build()
#6 23.47     File "/tmp/pip-build-env-pkf4dvu7/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 103, in build
#6 23.47       self._build(zip_file)
#6 23.47     File "/tmp/pip-build-env-pkf4dvu7/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 135, in _build
#6 23.47       self._run_build_command(setup)
#6 23.47     File "/tmp/pip-build-env-pkf4dvu7/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 163, in _run_build_command
#6 23.47       subprocess.check_call(
#6 23.47     File "/usr/local/lib/python3.9/subprocess.py", line 373, in check_call
#6 23.47       raise CalledProcessError(retcode, cmd)
#6 23.47   subprocess.CalledProcessError: Command '['/usr/local/bin/python', '/tmp/pip-install-jhph1ufu/pqcrypto_6ee9edf169884ebc9d0898c9cf1cb148/setup.py', 'build', '-b', '/tmp/pip-install-jhph1ufu/pqcrypto_6ee9edf169884ebc9d0898c9cf1cb148/build']' returned non-zero exit status 1.
#6 23.47   ----------------------------------------
#6 23.47   ERROR: Failed building wheel for pqcrypto
#6 23.47 Failed to build pqcrypto
#6 23.47 ERROR: Could not build wheels for pqcrypto which use PEP 517 and cannot be installed directly
#6 23.48 WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
#6 23.48 You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
------
executor failed running [/bin/sh -c pip3 install pqcrypto]: exit code: 1

pnwamk avatar Jan 21 '22 00:01 pnwamk

please pull this. I'm not sure why you haven't.

HourGlss avatar Jul 22 '22 14:07 HourGlss