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

'BinOp' object has no attribute 's' when trying to add a git dependency with poetry #1900

Closed
3 tasks done
Herokal opened this issue Jan 16, 2020 · 3 comments · Fixed by #2632
Closed
3 tasks done

'BinOp' object has no attribute 's' when trying to add a git dependency with poetry #1900

Herokal opened this issue Jan 16, 2020 · 3 comments · Fixed by #2632
Labels
kind/bug Something isn't working as expected

Comments

@Herokal
Copy link

Herokal commented Jan 16, 2020

  • 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).
  • OS version and name: Archlinux with Kernel Linux 5.4.11-arch1-1 & CentOS7 with Kernel Linux 3.10.0-1062.9.1.el7.x86_64
  • Poetry version: 1.0.2
  • Link of a Gist with the contents of your pyproject.toml file: pyproject.toml Gist

Issue

When trying to add statsmodels in dev version to the project on either of the two systems using

poetry add git+https://github.com/statsmodels/statsmodels.git -vvv

(and without -vvv), I get 'BinOp' object has no attribute 's' (full output with -vvv)
pip install git+https://github.com/statsmodels/statsmodels.git works fine though.

@Herokal Herokal added the kind/bug Something isn't working as expected label Jan 16, 2020
@abn
Copy link
Member

abn commented Mar 30, 2020

The reason why the add is failing is because the fallback setup.py reader does not like complex setup files very much. Same with the original issue - ast evaluation craps out.

The extras_requires extracted from this line is assumed to be a List[str] in the fallback reader.

https://github.com/statsmodels/statsmodels/blob/9bf1d0734dbb45abcfc6db7fab4564db851babeb/setup.py#L348-L348

Unfortunately for us, it is a binary operation in the AST and hence the failure.

https://github.com/statsmodels/statsmodels/blob/9bf1d0734dbb45abcfc6db7fab4564db851babeb/setup.py#L73-L77

The fallback itself is triggered when the python setup.y egg_info command fails when determining package information of the fresh clone. There are various reasons why this might happen. Most common in these scenarios is that the build envrionment (a clean venv as used by poetry) does not contain build time dependencies (which may include platform deps too).

Workaround for local development, would be to build a wheel and add it to the dependencies section.

statsmodels = { file = "/path/to/wheel" }

@jayvdb
Copy link

jayvdb commented Jul 12, 2020

I have a similar case, where there is a named variable in extra_requires.

I was hoping that using the old #egg= suffix might work.

poetry add "https://github.com/jayvdb/django-oscar/archive/release_2_0.zip#egg=django-oscar-2.0.5dev1"
An error occurred when reading setup.py or setup.cfg: 'Name' object has no attribute 's'

  RuntimeError

  Unable to determine the package name of /tmp/tmpi9nnq23l/release_2_0.zip

  at ~/projects/python/poetry/poetry/puzzle/provider.py:267 in get_package_from_file
      263│     @classmethod
      264def get_package_from_file(cls, file_path):  # type: (Path) -> Package
      265info = Inspector().inspect(file_path)
      266if not info["name"]:
    → 267raise RuntimeError(
      268"Unable to determine the package name of {}".format(file_path)
      269│             )
      270271package = Package(info["name"], info["version"])

Copy link

github-actions bot commented Mar 3, 2024

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 Mar 3, 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

Successfully merging a pull request may close this issue.

3 participants