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

Maximum recursion depth still occurs #3749

Closed
tastyminerals opened this issue Mar 3, 2021 · 5 comments
Closed

Maximum recursion depth still occurs #3749

tastyminerals opened this issue Mar 3, 2021 · 5 comments
Labels
kind/bug Something isn't working as expected

Comments

@tastyminerals
Copy link

tastyminerals commented Mar 3, 2021

I have a poetry project on Linux machine which builds without issues. Today I have cloned this project to Mac machine, removed poetry.lock and got RuntimeError maximum recursion depth exceeded.

Here is the -vvv error log.

$ poetry install -vvv                                                                                                                                                    
/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/subprocess32.py:149: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
  "program uses threads.", RuntimeWarning)

Python 2.7 will no longer be supported in the next feature release of Poetry (1.2).
You should consider updating your Python version to a supported one.

Note that you will still be able to manage Python 2.7 projects by using the env command.
See https://python-poetry.org/docs/managing-environments/ for more information.

The currently activated Python version 2.7.16 is not supported by the project (^3.7.9).
Trying to find and use a compatible version.
Trying python3
Using python3 (3.8.2)
Virtualenv return-assistant-qa-jXMyULZa-py3.8 already exists.
Using virtualenv: /Users/pavels/Library/Caches/pypoetry/virtualenvs/return-assistant-qa-jXMyULZa-py3.8
Updating dependencies
Resolving dependencies...
   1: fact: return-assistant-qa is 0.1.0
   1: derived: return-assistant-qa
   1: fact: return-assistant-qa depends on fuzzywuzzy (^0.17.0)
   1: fact: return-assistant-qa depends on pandas (^1)
   1: fact: return-assistant-qa depends on gini-api-clients (^2.0)
   1: fact: return-assistant-qa depends on python-Levenshtein (^0.12.0)
   1: fact: return-assistant-qa depends on requests (^2.22.0)
   1: fact: return-assistant-qa depends on semantics_knowledge (^0.1.1)
   1: fact: return-assistant-qa depends on pytest-datadir (^1.3.1)
   1: fact: return-assistant-qa depends on pytest-html (^1.19.0)
   1: fact: return-assistant-qa depends on pytest (^5.0)
   1: fact: return-assistant-qa depends on pytest-cov (^2.5.0)
   1: fact: return-assistant-qa depends on pytest-datadir (^1.3.1)
   1: fact: return-assistant-qa depends on pytest-html (^1.19.0)
   1: fact: return-assistant-qa depends on pytest (^5.0)
   1: fact: return-assistant-qa depends on pytest-cov (^2.5.0)
   1: selecting return-assistant-qa (0.1.0)
   1: derived: pytest-cov (^2.5.0)
   1: derived: pytest (^5.0)
   1: derived: pytest-html (^1.19.0)
   1: derived: pytest-datadir (^1.3.1)
   1: derived: semantics_knowledge (^0.1.1)
   1: derived: requests (^2.22.0)
   1: derived: python-Levenshtein (^0.12.0)
   1: derived: gini-api-clients (^2.0)
   1: derived: pandas (^1)
   1: derived: fuzzywuzzy (^0.17.0)
   1: fact: pytest-datadir (1.3.1) depends on pytest (>=2.7.0)
   1: selecting pytest-datadir (1.3.1)
   1: fact: gini-api-clients (2.0.8) depends on python-magic (>=0.4.10,<1.0)
   1: fact: gini-api-clients (2.0.8) depends on requests (>=2.18,<3.0)
   1: selecting gini-api-clients (2.0.8)
   1: derived: python-magic (>=0.4.10,<1.0)
   1: selecting fuzzywuzzy (0.17.0)
   1: selecting semantics-knowledge (0.1.5)
   1: Version solving took 2.626 seconds.
   1: Tried 1 solutions.

RuntimeError

maximum recursion depth exceeded

Traceback (most recent call last):
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/Users/pavels/.poetry/lib/poetry/console/commands/install.py", line 71, in handle
    return_code = self._installer.run()
  File "/Users/pavels/.poetry/lib/poetry/installation/installer.py", line 103, in run
    return self._do_install(local_repo)
  File "/Users/pavels/.poetry/lib/poetry/installation/installer.py", line 235, in _do_install
    ops = solver.solve(use_latest=self._whitelist)
  File "/Users/pavels/.poetry/lib/poetry/puzzle/solver.py", line 65, in solve
    packages, depths = self._solve(use_latest=use_latest)
  File "/Users/pavels/.poetry/lib/poetry/puzzle/solver.py", line 234, in _solve
    self._package, self._provider, locked=locked, use_latest=use_latest
  File "/Users/pavels/.poetry/lib/poetry/mixology/__init__.py", line 7, in resolve_version
    return solver.solve()
  File "/Users/pavels/.poetry/lib/poetry/mixology/version_solver.py", line 84, in solve
    next = self._choose_package_version()
  File "/Users/pavels/.poetry/lib/poetry/mixology/version_solver.py", line 397, in _choose_package_version
    version = self._provider.complete_package(version)
  File "/Users/pavels/.poetry/lib/poetry/puzzle/provider.py", line 437, in complete_package
    repository=package.dependency.source_name,
  File "/Users/pavels/.poetry/lib/poetry/repositories/pool.py", line 135, in package
    package = repo.package(name, version, extras=extras)
  File "/Users/pavels/.poetry/lib/poetry/repositories/legacy_repository.py", line 323, in package
    package = super(LegacyRepository, self).package(name, version, extras)
  File "/Users/pavels/.poetry/lib/poetry/repositories/pypi_repository.py", line 158, in package
    return self.get_release_info(name, version).to_package(name=name, extras=extras)
  File "/Users/pavels/.poetry/lib/poetry/repositories/pypi_repository.py", line 224, in get_release_info
    '{}:{}'.format(name, version), lambda: self._get_release_info(name, version)
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/cachy/repository.py", line 174, in remember_forever
    val = value(callback)
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/cachy/helpers.py", line 6, in value
    return val()
  File "/Users/pavels/.poetry/lib/poetry/repositories/pypi_repository.py", line 224, in <lambda>
    '{}:{}'.format(name, version), lambda: self._get_release_info(name, version)
  File "/Users/pavels/.poetry/lib/poetry/repositories/legacy_repository.py", line 377, in _get_release_info
    info = self._get_info_from_urls(urls)
  File "/Users/pavels/.poetry/lib/poetry/repositories/pypi_repository.py", line 419, in _get_info_from_urls
    return self._get_info_from_sdist(urls['sdist'][0])
  File "/Users/pavels/.poetry/lib/poetry/repositories/pypi_repository.py", line 447, in _get_info_from_sdist
    return PackageInfo.from_sdist(filepath)
  File "/Users/pavels/.poetry/lib/poetry/inspection/info.py", line 561, in from_sdist
    return cls._from_sdist_file(path=path)
  File "/Users/pavels/.poetry/lib/poetry/inspection/info.py", line 291, in _from_sdist_file
    new_info = cls.from_directory(path=sdist_dir)
  File "/Users/pavels/.poetry/lib/poetry/inspection/info.py", line 534, in from_directory
    info = cls.from_metadata(path)
  File "/Users/pavels/.poetry/lib/poetry/inspection/info.py", line 390, in from_metadata
    for directory in directories:
  File "/Users/pavels/.poetry/lib/poetry/inspection/info.py", line 375, in _find_dist_info
    for d in directories:
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 1366, in glob
    for p in selector.select_from(self):
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 799, in _select_from
    for x in _try_except_permissionerror_iter(try_iter, except_iter):
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 147, in _try_except_permissionerror_iter
    for x in try_iter():
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 786, in try_iter
    parent_path, is_dir, scandir):
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 777, in _iterate_directories
    for x in _try_except_permissionerror_iter(try_iter, except_iter):
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 147, in _try_except_permissionerror_iter
    for x in try_iter():
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 770, in try_iter
    for p in self._iterate_directories(path, is_dir, scandir):
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 777, in _iterate_directories
    for x in _try_except_permissionerror_iter(try_iter, except_iter):
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 147, in _try_except_permissionerror_iter
    for x in try_iter():
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 770, in try_iter
    for p in self._iterate_directories(path, is_dir, scandir):
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 777, in _iterate_directories
    for x in _try_except_permissionerror_iter(try_iter, except_iter):
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 147, in _try_except_permissionerror_iter
    for x in try_iter():
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 770, in try_iter
    for p in self._iterate_directories(path, is_dir, scandir):
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 777, in _iterate_directories
    for x in _try_except_permissionerror_iter(try_iter, except_iter):
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 147, in _try_except_permissionerror_iter
    for x in try_iter():
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 770, in try_iter
    for p in self._iterate_directories(path, is_dir, scandir):
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 777, in _iterate_directories
    for x in _try_except_permissionerror_iter(try_iter, except_iter):
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 147, in _try_except_permissionerror_iter
    for x in try_iter():
  
 (...)
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/pathlib2/__init__.py", line 764, in try_iter
    entry_is_dir = entry.is_dir()
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/scandir.py", line 504, in is_dir
    st = self.stat(follow_symlinks=follow_symlinks)
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/scandir.py", line 488, in stat
    if self.is_symlink():
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/scandir.py", line 529, in is_symlink
    st = self.stat(follow_symlinks=False)
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/scandir.py", line 497, in stat
    self._lstat = lstat(self.path)
  File "/Users/pavels/.poetry/lib/poetry/_vendor/py2.7/scandir.py", line 482, in path
    self._path = join(self._scandir_path, self.name)
@tastyminerals tastyminerals added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Mar 3, 2021
@ZelphirKaltstahl
Copy link

In a language like Python, it might sometimes be acceptable to assume, that recursion will only reach a certain depth. In that case one needs to take care:

Always change at least one argument while recurring. […] It must be changed to be closer to termination. The changing argument must be tested in the termination condition: […]

("The Little Schemer" by Daniel P. Friedman and Matthias Felleisen)

The error looks like either recursion has been used in a place, in which Python, is not capable of doing it, or a case of not getting closer to finishing the computation.

In cases where the recursion depth could theoretically get anywhere near the allowed limit, one should probably externalize the stack.

@tastyminerals
Copy link
Author

tastyminerals commented Mar 9, 2021

Whoever bumps into this. This one is caused by #536

Do not install poetry via curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 - on MacOS! Use homebrew or MacPorts. In my case, poetry installed via port install poetry pulled python38 + other required deps and managed to successfully run poetry install for the corresponding Python project.

@abn
Copy link
Member

abn commented Mar 21, 2021

@tastyminerals I am unable to reproduce this using the following.

podman run --rm -i --entrypoint bash python:3.8 <<EOF
set -xe
python -m pip install -q poetry
install -d foobar
pushd foobar
cat > pyproject.toml <<TOML
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = "^3.8"
fuzzywuzzy = "^0.17.0"
python-Levenshtein = "^0.12.0"
requests = "^2.22.0"
pandas = "^1"

[tool.poetry.dev-dependencies]
pytest = "^5.0"
pytest-datadir = "^1.3.1"
pytest-cov = "^2.5.0"
pytest-html = "^1.19.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
TOML
poetry install
EOF

Closing this issue as it would seem this was an issue with the environment rather than a poetry bug.

@abn abn closed this as completed Mar 21, 2021
@nobrowser
Copy link

This happens to me with 1.0.10 (I know, team constraint), trying poetry add pandas in an empty project. ie. right after poetry init. Python 3.9.2 via debian bullseye.

Copy link

github-actions bot commented Mar 2, 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 2, 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

4 participants