Poetry build, python is not in the subpath of my folder
- Poetry version: 1.4.2
- Python version: 3.10.11
- OS version and name: macOS 13.0.1
- pyproject.toml: https://gist.github.com/rmarquet21/0a369a0287b0d423fa02396d2835a804
- [X] I am on the latest stable Poetry version, installed using a recommended method.
- [X] I have searched the issues of this repo and believe that this is not a duplicate.
- [X] I have consulted the FAQ and blog for any relevant entries or release notes.
- [X] If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption) and have included the output below.
Issue
Hello, I'm trying to do a poetry build of my Python app. The problem is that I keep getting an error that says '/Users/robin/.pyenv/versions/3.10.9/bin/python3.10' is not in the subpath of '/Users/robin/Documents/rmarquet21/st_annotation' OR one path is relative, and the other is absolute. I have tried to find a solution to my issue, but I haven't found any. I also use pyenv and currently have a global version of Python 3.8, so I don't understand where version 3.10.9 is coming from.
pyproject.toml
[tool.poetry]
name = "st-text-annotator"
version = "0.1.6"
description = "Component for annotating text for NLP resolution"
classifiers = ["Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent"]
authors = ["Robin Marquet <[email protected]>"]
license = "MIT License"
readme = "README.md"
packages = [{include = "st_text_annotator", from = "src"}]
[tool.poetry.dependencies]
python = "^3.8,<3.9"
streamlit = "^1.21.0"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
output
(st-text-annotator-py3.8) ➜ st_annotation git:(master) ✗ poetry build
Building st-text-annotator (0.1.6)
- Building sdist
'/Users/robin/.pyenv/versions/3.10.9/bin/python3.10' is not in the subpath of '/Users/robin/Documents/rmarquet21/st_annotation' OR one path is relative and the other is absolute.
you forgot to rerun with -vvv and provide the output
you forgot to rerun with
-vvvand provide the output
poetry build -vvv
Trying to detect current active python executable as specified in the config.
Found: /Users/robin/.pyenv/versions/3.8.16/bin/python
Stack trace:
13 ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:327 in run
325│
326│ try:
→ 327│ exit_code = self._run(io)
328│ except BrokenPipeError:
329│ # If we are piped to another process, it may close early and send a
12 ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/poetry/console/application.py:190 in _run
188│ self._load_plugins(io)
189│
→ 190│ exit_code: int = super()._run(io)
191│ return exit_code
192│
11 ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:431 in _run
429│ io.input.interactive(interactive)
430│
→ 431│ exit_code = self._run_command(command, io)
432│ self._running_command = None
433│
10 ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:473 in _run_command
471│
472│ if error is not None:
→ 473│ raise error
474│
475│ return terminate_event.exit_code
9 ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:457 in _run_command
455│
456│ if command_event.command_should_run():
→ 457│ exit_code = command.run(io)
458│ else:
459│ exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED
8 ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/cleo/commands/base_command.py:119 in run
117│ io.input.validate()
118│
→ 119│ status_code = self.execute(io)
120│
121│ if status_code is None:
7 ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/cleo/commands/command.py:62 in execute
60│
61│ try:
→ 62│ return self.handle()
63│ except KeyboardInterrupt:
64│ return 1
6 ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/poetry/console/commands/build.py:34 in handle
32│
33│ builder = Builder(self.poetry)
→ 34│ builder.build(fmt, executable=env.python)
35│
36│ return 0
5 ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/poetry/core/masonry/builder.py:39 in build
37│
38│ for builder in builders:
→ 39│ builder(self._poetry, executable=executable).build(target_dir)
40│
4 ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/poetry/core/masonry/builders/sdist.py:80 in build
78│ tar_dir = f"{name}-{self._meta.version}"
79│
→ 80│ files_to_add = self.find_files_to_add(exclude_build=False)
81│
82│ for file in sorted(files_to_add, key=lambda x: x.relative_to_source_root()):
3 ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/poetry/core/masonry/builders/sdist.py:323 in find_files_to_add
321│
322│ def find_files_to_add(self, exclude_build: bool = False) -> set[BuildIncludeFile]:
→ 323│ to_add = super().find_files_to_add(exclude_build)
324│
325│ # add any additional files, starting with all LICENSE files
2 ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/poetry/core/masonry/builders/builder.py:189 in find_files_to_add
187│
188│ if not current_file.is_dir() and not self.is_excluded(
→ 189│ include_file.relative_to_source_root()
190│ ):
191│ to_add.add(include_file)
1 ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/poetry/core/masonry/builders/builder.py:399 in relative_to_source_root
397│ def relative_to_source_root(self) -> Path:
398│ if self.source_root is not None:
→ 399│ return self.path.relative_to(self.source_root)
400│
401│ return self.path
ValueError
'/Users/robin/.pyenv/versions/3.10.9/bin/python3.10' is not in the subpath of '/Users/robin/Documents/rmarquet21/st_annotation' OR one path is relative and the other is absolute.
at ~/.pyenv/versions/3.10.11/lib/python3.10/pathlib.py:818 in relative_to
814│ n = len(to_abs_parts)
815│ cf = self._flavour.casefold_parts
816│ if (root or drv) if n == 0 else cf(abs_parts[:n]) != cf(to_abs_parts):
817│ formatted = self._format_parsed_parts(to_drv, to_root, to_parts)
→ 818│ raise ValueError("{!r} is not in the subpath of {!r}"
819│ " OR one path is relative and the other is absolute."
820│ .format(str(self), str(formatted)))
821│ return self._from_parsed_parts('', root if n == 1 else '',
822│ abs_parts[n:])
I expect you'll want to investigate what's going on near find_files_to_add(), stick some print statements or similar in there.
Perhaps you've got a symlink or something that's behaving unexpectedly.
I find, I have a symlink, in my node_modules, you know how to remove them from build ?
.
├── CHANGELOG.md
├── LICENSE
├── MANIFEST.in
├── README.md
├── examples
│ └── example.py
├── poetry.lock
├── pyproject.toml
├── requirements.txt
├── setup.py
└── src
└── st_text_annotator
├── __init__.py
└── frontend
├── build
├── node_modules
├── package-lock.json
├── package.json
├── public
├── src
└── tsconfig.json
9 directories, 13 files
I try with exclude = ["./src/st_text_annotator/frontend/node_modules/**/*"] but this do nothing
I use a symbolic link for the build/ folder and point it to a different file system. This is done for performance reasons on our CI server (Jenkins). Poetry builds break because of this. But Gradle (Java) builds and other types of builds do not. I use poetry 1.7.1.
Any updates on this? I've run into the same issue.