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

Cannot pip install Poetry + Cython project from Github repository as build file name is autopopulated #1695

Closed
3 tasks done
darkvariantdivine opened this issue Dec 9, 2019 · 3 comments
Labels
kind/bug Something isn't working as expected

Comments

@darkvariantdivine
Copy link

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

I am working on a project that includes Cython files and utilised the workaround recommended in #11 . When I tried to install the project via pip from github via bash pip install git+https, I encountered the following error:

Building wheels for collected packages: genisys
  Created temporary directory: /tmp/pip-wheel-7Htvru
  Destination directory: /tmp/pip-wheel-7Htvru
  Running command /home/davidlee/open_source/anaconda3/bin/python /home/davidlee/open_source/anaconda3/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpHJknwd
  Building wheel for genisys (PEP 517) ...   Traceback (most recent call last):
    File "/home/davidlee/open_source/anaconda3/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 257, in <module>
      main()
    File "/home/davidlee/open_source/anaconda3/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 240, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/davidlee/open_source/anaconda3/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 182, in build_wheel
      metadata_directory)
    File "/tmp/pip-build-env-oCpvHD/overlay/lib/python2.7/site-packages/poetry/masonry/api.py", line 60, in build_wheel
      poetry, SystemEnv(Path(sys.prefix)), NullIO(), Path(wheel_directory)
    File "/tmp/pip-build-env-oCpvHD/overlay/lib/python2.7/site-packages/poetry/masonry/builders/wheel.py", line 50, in make_in
      wb.build()
    File "/tmp/pip-build-env-oCpvHD/overlay/lib/python2.7/site-packages/poetry/masonry/builders/wheel.py", line 76, in build
      self._build(zip_file)
    File "/tmp/pip-build-env-oCpvHD/overlay/lib/python2.7/site-packages/poetry/masonry/builders/wheel.py", line 97, in _build
      "python", str(setup), "build", "-b", str(self._path / "build")
    File "/tmp/pip-build-env-oCpvHD/overlay/lib/python2.7/site-packages/poetry/utils/env.py", line 388, in run
      raise EnvCommandError(e, input=input_)
  poetry.utils.env.EnvCommandError: Command ['/home/davidlee/open_source/anaconda3/bin/python', 'setup.py', u'build', u'-b', 'build'] errored with the following return code 2, and output:
  /home/davidlee/open_source/anaconda3/bin/python: can't open file 'setup.py': [Errno 2] No such file or directory

error
  ERROR: Failed building wheel for genisys
  Running setup.py clean for genisys
  Running command /home/davidlee/open_source/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-6SOpuN/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-6SOpuN/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
  IOError: [Errno 2] No such file or directory: '/tmp/pip-req-build-6SOpuN/setup.py'
  ERROR: Failed cleaning build dir for genisys
Failed to build genisys
Cleaning up...
  Removing source in /tmp/pip-req-build-6SOpuN
Removed build tracker '/tmp/pip-req-tracker-xGv9iP'
ERROR: Could not build wheels for genisys which use PEP 517 and cannot be installed directly
Exception information:
Traceback (most recent call last):
  File "/home/davidlee/open_source/anaconda3/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 153, in _main
    status = self.run(options, args)
  File "/home/davidlee/open_source/anaconda3/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 426, in run
    ", ".join(r.name for r in build_failures)))
InstallationError: Could not build wheels for genisys which use PEP 517 and cannot be installed directly

Upon further investigation, I noticed that the WheelBuilder in poetry.masonry.builders.wheel in the python _build function automatically populates the external build file reference provided in the tools.poetry section of the pyproject.toml with python "setup.py" instead of the external build file reference (see the code fragment containing the issue below).

    def _build(self, wheel):
        if self._package.build:
            setup = self._path / "setup.py"

When I renamed my external build file to setup.py and changed the reference in my pyproject.toml, pip was able to build and install the project along with the Cython files.

@darkvariantdivine darkvariantdivine added the kind/bug Something isn't working as expected label Dec 9, 2019
@vsriram11
Copy link

Any resolution coming for this? Facing the same issue, I can work around by creating a wheel and pip installing the wheel, but this is not ideal with chained dependencies..

@finswimmer
Copy link
Member

Hello @darkvariantdivine,

you haven't come back to this issue for a long while. So I assume this is solved in the meantime and I can close this ticket.

Feel free to leave a comment if you disagree.

fin swimmer

@finswimmer finswimmer closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2022
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

3 participants