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

InvalidRequirement when installing apache airflow with gcp_api extra #804

Closed
3 tasks done
Paikan opened this issue Jan 17, 2019 · 20 comments
Closed
3 tasks done

InvalidRequirement when installing apache airflow with gcp_api extra #804

Paikan opened this issue Jan 17, 2019 · 20 comments
Labels
area/solver Related to the dependency resolver kind/bug Something isn't working as expected

Comments

@Paikan
Copy link

Paikan commented Jan 17, 2019

  • 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).
Poetry
Version: 1.0.0a2
Python:  3.6.6

Virtualenv
Python:         3.6.6
Implementation: CPython
Path:           /Users/benjamin/.pyenv/versions/3.6.6/envs/poetry
Valid:          True

System
Platform: darwin
OS:       posix
Python:   /Users/benjamin/.pyenv/versions/3.6.6

Issue

# On a clean virtualenv
$ poetry add apache-airflow --extras gcp_api -v
Using virtualenv: /Users/benjamin/.pyenv/versions/3.6.6/envs/poetry
Using version ^1.10 for apache-airflow

Updating dependencies
Resolving dependencies... (1.3s)

[InvalidRequirement]
Invalid requirement, parse error at "'; <empty'"

Traceback (most recent call last):
  File "/Users/benjamin/.poetry/lib/poetry/_vendor/py3.6/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/Users/benjamin/.poetry/lib/poetry/_vendor/py3.6/clikit/api/command/command.py", line 112, in handle
    status_code = self._do_handle(args, io)
  File "/Users/benjamin/.poetry/lib/poetry/_vendor/py3.6/clikit/api/command/command.py", line 160, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/Users/benjamin/.poetry/lib/poetry/_vendor/py3.6/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/Users/benjamin/.poetry/lib/poetry/console/commands/add.py", line 135, in handle
    status = installer.run()
  File "/Users/benjamin/.poetry/lib/poetry/installation/installer.py", line 74, in run
    self._do_install(local_repo)
  File "/Users/benjamin/.poetry/lib/poetry/installation/installer.py", line 214, in _do_install
    ops = solver.solve(use_latest=whitelist)
  File "/Users/benjamin/.poetry/lib/poetry/puzzle/solver.py", line 38, in solve
    packages, depths = self._solve(use_latest=use_latest)
  File "/Users/benjamin/.poetry/lib/poetry/puzzle/solver.py", line 171, in _solve
    self._package, self._provider, locked=locked, use_latest=use_latest
  File "/Users/benjamin/.poetry/lib/poetry/mixology/__init__.py", line 7, in resolve_version
    return solver.solve()
  File "/Users/benjamin/.poetry/lib/poetry/mixology/version_solver.py", line 79, in solve
    next = self._choose_package_version()
  File "/Users/benjamin/.poetry/lib/poetry/mixology/version_solver.py", line 380, in _choose_package_version
    for incompatibility in self._provider.incompatibilities_for(version):
  File "/Users/benjamin/.poetry/lib/poetry/puzzle/provider.py", line 435, in incompatibilities_for
    for dep in dependencies
  File "/Users/benjamin/.poetry/lib/poetry/puzzle/provider.py", line 435, in <listcomp>
    for dep in dependencies
  File "/Users/benjamin/.poetry/lib/poetry/packages/package.py", line 346, in to_dependency
    return dependency_from_pep_508(name)
  File "/Users/benjamin/.poetry/lib/poetry/packages/__init__.py", line 34, in dependency_from_pep_508
    req = Requirement(name)
  File "/Users/benjamin/.poetry/lib/poetry/version/requirements.py", line 202, in __init__
    requirement_string[e.loc : e.loc + 8]
@Paikan
Copy link
Author

Paikan commented Jan 20, 2019

I forgot to add that with the same virtualenv the following command works properly

pip install 'apache-airflow[gcp_api]'

@sdispater sdispater added kind/bug Something isn't working as expected area/solver Related to the dependency resolver labels Jan 20, 2019
@sdispater
Copy link
Member

I can definitely reproduce and I think I know where the issue is coming from. I will investigate and keep you posted.

@LavaToaster
Copy link

Seeing as this looks related, I'm also seeing this when trying to run poetry add keyboard. Stack trace is the same as the one given.

@Pluckerpluck
Copy link

Pluckerpluck commented Feb 17, 2019

keyboard is the one I've ran into the problem with. Has the dependency:
pyobjc; sys_platform=='darwin'

Guessing it's a failure to fully implement PEP 508. Or maybe the whitespace?

Non line-breaking whitespace is mostly optional with no semantic meaning. The sole exception is detecting the end of a URL requirement.

Either way, it should be supported given the spec.

@deepio
Copy link

deepio commented Feb 19, 2019

I saw the same error when trying to add poetry add pyobjc to my project, as @Pluckerpluck also pointed out. For now I installed it using pip, but I would appreciate an update whenever it is convenient for you @sdispater.

@sdispater
Copy link
Member

This should be fixed in the latest 0.12.12 release

@Paikan
Copy link
Author

Paikan commented Apr 12, 2019

@sdispater sadly I still seem to have the bug using 0.12.12.

poetry debug:info
Poetry
======

 * Version: 0.12.12
 * Python:  3.6.6


Virtualenv
==========

 * Python:         3.6.6
 * Implementation: CPython
 * Path:           /Users/benjamin/Dev/playground/test/.venv
 * Valid:          True


System
======

 * Platform: darwin
 * OS:       posix
 * Python:   /Users/benjamin/.pyenv/versions/3.6.6
poetry add apache-airflow --extras gcp_api -v --dev
Using virtualenv: /Users/benjamin/Dev/playground/test/.venv
Using version ^1.10 for apache-airflow

Updating dependencies
Resolving dependencies... (0.0s)

[InvalidRequirement]
Invalid requirement, parse error at "'; <empty'"

Exception trace:
 /Users/benjamin/.poetry/lib/poetry/_vendor/py3.6/cleo/application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 /Users/benjamin/.poetry/lib/poetry/console/application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 /Users/benjamin/.poetry/lib/poetry/_vendor/py3.6/cleo/application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 /Users/benjamin/.poetry/lib/poetry/console/commands/command.py in run() at line 77
   return super(BaseCommand, self).run(i, o)
 /Users/benjamin/.poetry/lib/poetry/_vendor/py3.6/cleo/commands/base_command.py in run() at line 146
   status_code = self.execute(input_, output_)
 /Users/benjamin/.poetry/lib/poetry/_vendor/py3.6/cleo/commands/command.py in execute() at line 107
   return self.handle()
 /Users/benjamin/.poetry/lib/poetry/console/commands/add.py in handle() at line 139
   status = installer.run()
 /Users/benjamin/.poetry/lib/poetry/installation/installer.py in run() at line 73
   self._do_install(local_repo)
 /Users/benjamin/.poetry/lib/poetry/installation/installer.py in _do_install() at line 165
   ops = solver.solve(use_latest=self._whitelist)
 /Users/benjamin/.poetry/lib/poetry/puzzle/solver.py in solve() at line 38
   packages, depths = self._solve(use_latest=use_latest)
 /Users/benjamin/.poetry/lib/poetry/puzzle/solver.py in _solve() at line 167
   locked[package.name] = DependencyPackage(package.to_dependency(), package)
 /Users/benjamin/.poetry/lib/poetry/packages/package.py in to_dependency() at line 346
   return dependency_from_pep_508(name)
 /Users/benjamin/.poetry/lib/poetry/packages/__init__.py in dependency_from_pep_508() at line 35
   req = Requirement(name)
 /Users/benjamin/.poetry/lib/poetry/version/requirements.py in __init__() at line 202
   requirement_string[e.loc : e.loc + 8]

@halfnhalf
Copy link

Hitting same issue here when installing pyobjc

[InvalidRequirement]                 
Invalid requirement, parse error at "'; <empty'"  
                                                    
Exception trace:
 /Users/zach/.poetry/lib/poetry/_vendor/py3.6/cleo/application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 /Users/zach/.poetry/lib/poetry/console/application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 /Users/zach/.poetry/lib/poetry/_vendor/py3.6/cleo/application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 /Users/zach/.poetry/lib/poetry/console/commands/command.py in run() at line 77
   return super(BaseCommand, self).run(i, o)
 /Users/zach/.poetry/lib/poetry/_vendor/py3.6/cleo/commands/base_command.py in run() at line 146
   status_code = self.execute(input_, output_)
 /Users/zach/.poetry/lib/poetry/_vendor/py3.6/cleo/commands/command.py in execute() at line 107
   return self.handle()
 /Users/zach/.poetry/lib/poetry/console/commands/add.py in handle() at line 139
   status = installer.run()
 /Users/zach/.poetry/lib/poetry/installation/installer.py in run() at line 76
   self._do_install(local_repo)
 /Users/zach/.poetry/lib/poetry/installation/installer.py in _do_install() at line 216
   ops = solver.solve(use_latest=whitelist)
 /Users/zach/.poetry/lib/poetry/puzzle/solver.py in solve() at line 38
   packages, depths = self._solve(use_latest=use_latest)
 /Users/zach/.poetry/lib/poetry/puzzle/solver.py in _solve() at line 171
   self._package, self._provider, locked=locked, use_latest=use_latest
 /Users/zach/.poetry/lib/poetry/mixology/__init__.py in resolve_version() at line 7
   return solver.solve()
 /Users/zach/.poetry/lib/poetry/mixology/version_solver.py in solve() at line 79
   next = self._choose_package_version()
 /Users/zach/.poetry/lib/poetry/mixology/version_solver.py in _choose_package_version() at line 380
   for incompatibility in self._provider.incompatibilities_for(version):
 /Users/zach/.poetry/lib/poetry/puzzle/provider.py in incompatibilities_for() at line 447
   for dep in dependencies
 /Users/zach/.poetry/lib/poetry/puzzle/provider.py in <listcomp>() at line 447
   for dep in dependencies
 /Users/zach/.poetry/lib/poetry/packages/package.py in to_dependency() at line 346
   return dependency_from_pep_508(name)
 /Users/zach/.poetry/lib/poetry/packages/__init__.py in dependency_from_pep_508() at line 34
   req = Requirement(name)
 /Users/zach/.poetry/lib/poetry/version/requirements.py in __init__() at line 202
   requirement_string[e.loc : e.loc + 8]

@Paikan
Copy link
Author

Paikan commented May 3, 2019

@sdispater would you mind reopening this issue as it does not seem to be fixed?

@sdispater sdispater reopened this May 3, 2019
@sdispater
Copy link
Member

Just to make sure: could anyone of you try again after clearing the cache poetry cache:clear pypi --all to see if this is not due to a cache problem?

@Paikan
Copy link
Author

Paikan commented May 5, 2019

I confirm that the problem persists.

poetry debug:info
Poetry
======

 * Version: 0.12.15
 * Python:  3.6.6


Virtualenv
==========

 * Python:         3.6.6
 * Implementation: CPython
 * Path:           /Users/benjamin/Dev/playground/test2/.venv
 * Valid:          True


System
======

 * Platform: darwin
 * OS:       posix
 * Python:   /Users/benjamin/.pyenv/versions/3.6.6
poetry cache:clear pypi --all
Delete 2 entries? (yes/no) [no] yes
poetry add apache-airflow --extras gcp_api -v --dev
Using virtualenv: /Users/benjamin/Dev/playground/test2/.venv
Using version ^1.10 for apache-airflow

Updating dependencies
Resolving dependencies... (0.0s)

[InvalidRequirement]
Invalid requirement, parse error at "'; <empty'"

Exception trace:
 /Users/benjamin/.poetry/lib/poetry/_vendor/py3.6/cleo/application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 /Users/benjamin/.poetry/lib/poetry/console/application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 /Users/benjamin/.poetry/lib/poetry/_vendor/py3.6/cleo/application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 /Users/benjamin/.poetry/lib/poetry/console/commands/command.py in run() at line 77
   return super(BaseCommand, self).run(i, o)
 /Users/benjamin/.poetry/lib/poetry/_vendor/py3.6/cleo/commands/base_command.py in run() at line 146
   status_code = self.execute(input_, output_)
 /Users/benjamin/.poetry/lib/poetry/_vendor/py3.6/cleo/commands/command.py in execute() at line 107
   return self.handle()
 /Users/benjamin/.poetry/lib/poetry/console/commands/add.py in handle() at line 139
   status = installer.run()
 /Users/benjamin/.poetry/lib/poetry/installation/installer.py in run() at line 73
   self._do_install(local_repo)
 /Users/benjamin/.poetry/lib/poetry/installation/installer.py in _do_install() at line 165
   ops = solver.solve(use_latest=self._whitelist)
 /Users/benjamin/.poetry/lib/poetry/puzzle/solver.py in solve() at line 38
   packages, depths = self._solve(use_latest=use_latest)
 /Users/benjamin/.poetry/lib/poetry/puzzle/solver.py in _solve() at line 167
   locked[package.name] = DependencyPackage(package.to_dependency(), package)
 /Users/benjamin/.poetry/lib/poetry/packages/package.py in to_dependency() at line 346
   return dependency_from_pep_508(name)
 /Users/benjamin/.poetry/lib/poetry/packages/__init__.py in dependency_from_pep_508() at line 35
   req = Requirement(name)
 /Users/benjamin/.poetry/lib/poetry/version/requirements.py in __init__() at line 202
   requirement_string[e.loc : e.loc + 8]

@sdispater
Copy link
Member

@Paikan Thanks! I will investigate.

@flaviut
Copy link

flaviut commented Jun 14, 2019

Here's a part of my poetry.lock file:

[[package]]
category = "dev"
description = "Lightweight, extensible schema and data validation tool for Python dictionaries."
marker = "<empty>"
name = "cerberus"
optional = false
python-versions = ">=2.7"
version = "1.3.1"

It works fine if I remove the marker value and run poetry install.

 [[package]]
 category = "dev"
 description = "Lightweight, extensible schema and data validation tool for Python dictionaries."
-marker = "<empty>"
 name = "cerberus"
 optional = false
 python-versions = ">=2.7"
 version = "1.3.1"

@deepio
Copy link

deepio commented Jun 14, 2019

Marker is not emptry, it should read marker = "extra == \"gcp_api\"" if you ran the installation like in the issue: poetry add apache-airflow --extras gcp_api -v

Still an issue:

Poetry
======

 * Version: 0.12.16
 * Python:  3.7.3


Virtualenv
==========

 * Python:         3.7.3
 * Implementation: CPython
 * Path:           /Users/deepio/Documents/GitHub/test2/env
 * Valid:          True


System
======

 * Platform: darwin
 * OS:       posix
 * Python:   /usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7

But my earlier issue with installing pyobjc was fixed. Thank you.

@djetelina
Copy link

Still an issue, both under 0.12.17 and 1.0.0a4

@bjoernpollex
Copy link
Contributor

@sdispater I'd be happy to help looking into this, because this is an issue for me, but I'm not entirely sure what the expected behaviour here is. It seems that what happens is that this line is adding the ; <empty> that cannot be parsed here:

def to_dependency(self):
        from . import dependency_from_pep_508

        name = "{} (=={})".format(self._name, self._version)

        if not self.marker.is_any():
            name += " ; {}".format(str(self.marker))

        return dependency_from_pep_508(name)

In the case of Airflow, the marker is an instance of EmptyMarker. The condition evaluates to True (because EmptyMarker.is_any() returns False), and then the string representation for EmptyMarker (which is <empty>) gets appended. Is that intended?

@bjoernpollex
Copy link
Contributor

This seems to be addressed in #1230.

@magnusja
Copy link

magnusja commented Oct 7, 2019

same issue here ...

@sdispater
Copy link
Member

This should be fixed in the latest 1.0.0b2 prerelease.

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
area/solver Related to the dependency resolver kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

10 participants