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

Relative path cannot be found #3275

Closed
3 tasks done
jonapich opened this issue Oct 23, 2020 · 7 comments
Closed
3 tasks done

Relative path cannot be found #3275

jonapich opened this issue Oct 23, 2020 · 7 comments
Labels
kind/question User questions (candidates for conversion to discussion)

Comments

@jonapich
Copy link
Contributor

  • 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: Windows 10

  • Poetry version: 1.1.3

  • Repo with bug: https://github.com/jonapich/test-poetry-relative-paths

Issue

Depending on a module through a relative path that also depends on a relative path broke between 1.0.10 and 1.1.0.

The issue only seems to occur with nested packages. It works with one relative path, but if this path also contains a relative path dependency, that's when the bug occurs.

Following the steps in the readme of the linked repository will lead to this error:

  Command C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\test-functools-dloyykXv-py3.8\Scripts\pip.exe install --no-deps -U C:/Users/user/code/test-poetry-relative-paths/test-functools/test-poetry-relative-paths/test-testing errored with the following return code 1, and output:
  Processing c:\users\user\code\test-poetry-relative-paths\test-functools\test-poetry-relative-paths\test-testing
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: 'C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\test-functools-dloyykXv-py3.8\Scripts\python.exe' 'C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\test-functools-dloyykXv-py3.8\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\user\AppData\Local\Temp\tmp6_drxiht'
           cwd: C:\Users\user\AppData\Local\Temp\pip-req-build-6vl779_r
      Complete output (16 lines):
      Traceback (most recent call last):
        File "C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\test-functools-dloyykXv-py3.8\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
          main()
        File "C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\test-functools-dloyykXv-py3.8\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\user\AppData\Local\pypoetry\Cache\virtualenvs\test-functools-dloyykXv-py3.8\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 133, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "C:\Users\user\AppData\Local\Temp\pip-build-env-8git_pgc\overlay\Lib\site-packages\poetry\core\masonry\api.py", line 34, in prepare_metadata_for_build_wheel
          poetry = Factory().create_poetry(Path(".").resolve())
        File "C:\Users\user\AppData\Local\Temp\pip-build-env-8git_pgc\overlay\Lib\site-packages\poetry\core\factory.py", line 91, in create_poetry
          self.create_dependency(name, constraint, root_dir=package.root_dir)
        File "C:\Users\user\AppData\Local\Temp\pip-build-env-8git_pgc\overlay\Lib\site-packages\poetry\core\factory.py", line 242, in create_dependency
          dependency = DirectoryDependency(
        File "C:\Users\user\AppData\Local\Temp\pip-build-env-8git_pgc\overlay\Lib\site-packages\poetry\core\packages\directory_dependency.py", line 36, in __init__
          raise ValueError("Directory {} does not exist".format(self._path))
      ValueError: Directory ..\test-lib does not exist
@jonapich jonapich added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 23, 2020
@abn
Copy link
Member

abn commented Oct 23, 2020

With 1.1.0 Poetry no longer defaults to develop = true for path dependencies.

Please refer to https://python-poetry.org/blog/announcing-poetry-1-1-0.html#directory-dependencies-are-now-non-editable-by-default

In your case poetry attempts a PEP 517 build of your dependency, but since thats are relative files required for the build are not correctly marked for inclusion by the package, they are not copied over into the isolated build environment causing the error.

@abn abn closed this as completed Oct 23, 2020
@abn abn removed the status/triage This issue needs to be triaged label Oct 23, 2020
@abn
Copy link
Member

abn commented Oct 23, 2020

Appreciate the detailed issue report @jonapich !! ❤️

@jonapich
Copy link
Contributor Author

😮

Hey how about an update to the exception text to suggest this? This has been preventing me to go forward for weeks 😅

@jonapich
Copy link
Contributor Author

🤔

When I add develop = true, mypy will no longer be able to locate the local imports (they're all PEP 561). Is there a known workaround? I'll dig (probably not related to poetry 😅 ) but asking just in case this can document a common side effect.

@jonapich
Copy link
Contributor Author

aaah ha: #3094
python/mypy#8847

all good, thanks!

@abn
Copy link
Member

abn commented Oct 24, 2020

😮

Hey how about an update to the exception text to suggest this? This has been preventing me to go forward for weeks 😅

Sorry to hear that.

We will be able to do this , hopefully, once we drop pip and use python-build instead. Today, this error happens in a second level subprocess and the best we can do is guess the context and check for strings in stderr and wrap the exception. This is not necessarily reliable as you might already know.

That said I am happy to review any reasonable improvement to how we handle these kind of errors.

@abn abn added kind/question User questions (candidates for conversion to discussion) and removed kind/bug Something isn't working as expected labels Oct 24, 2020
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/question User questions (candidates for conversion to discussion)
Projects
None yet
Development

No branches or pull requests

2 participants