ModuleNotFoundError: No module named 'poetry'
Closed this issue · 6 comments
I saw a previous issue with the same error, but I seem to be encountering this issue. It's specifically when I try to package the rich module with my flatpak. I've tried adding poetry to the arguments that I pass to this flatpak-pip-generator
, but the error still persists, except this time its poetry complaining that poetry isn't found. Running python3 flatpak-pip-generator rich
works fine, but the error happens when I build my flatpak. Here's my JSON file:
{
"name": "python3-rich",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"rich\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/60/48/a60f593447e8f0894ebb7f6e6c1f25dafc5e89c5879fdc9360ae93ff83f0/commonmark-0.9.1.tar.gz",
"sha256": "452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/1f/bb/5d3246097ab77fa083a61bd8d3d527b7ae063c7d8e8671b1cf8c4ec10cbe/colorama-0.4.4.tar.gz",
"sha256": "5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/6b/ea/af2a2218d57cc52dc7f14e4350ee9647fa79c6c820cfc05c438795fb13b4/rich-10.7.0.tar.gz",
"sha256": "13ac80676e12cf528dc4228dc682c8402f82577c2aa67191e294350fa2c3c4e9"
}
]
}
Rich error log:
Running: pip3 install --verbose --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} "rich>=9.11.0" --no-build-isolation
Using pip 21.0.1 from /usr/lib/python3.8/site-packages/pip (python 3.8)
Non-user install due to --prefix or --target option
Ignoring indexes: https://pypi.org/simple
Created temporary directory: /tmp/pip-ephem-wheel-cache-dz1xjzll
Created temporary directory: /tmp/pip-req-tracker-bpasxxjh
Initialized build tracking at /tmp/pip-req-tracker-bpasxxjh
Created build tracker: /tmp/pip-req-tracker-bpasxxjh
Entered build tracker: /tmp/pip-req-tracker-bpasxxjh
Created temporary directory: /tmp/pip-install-ql2213dq
Looking in links: file:///run/build/python3-rich
0 location(s) to search for versions of rich:
Skipping link: not a file: file:///run/build/python3-rich (from -f)
Skipping link: Missing project version for rich: file:///run/build/python3-rich/commonmark-0.9.1.tar.gz
Skipping link: Missing project version for rich: file:///run/build/python3-rich/colorama-0.4.4.tar.gz
Found link file:///run/build/python3-rich/rich-10.7.0.tar.gz, version: 10.7.0
Local files found: /run/build/python3-rich/rich-10.7.0.tar.gz
Given no hashes to check 1 links for project 'rich': discarding no candidates
Processing ./rich-10.7.0.tar.gz
Added rich>=9.11.0 from file:///run/build/python3-rich/rich-10.7.0.tar.gz to build tracker '/tmp/pip-req-tracker-bpasxxjh'
Created temporary directory: /tmp/pip-modern-metadata-ilip5aul
Running command /usr/bin/python3 /usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp8v_anb6w
Preparing wheel metadata ... done
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 171, in _merge_into_criterion
crit = self.state.criteria[name]
KeyError: 'rich'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 189, in _main
status = self.run(options, args)
File "/usr/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 178, in wrapper
return func(self, options, args)
File "/usr/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 316, in run
requirement_set = resolver.resolve(
File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 121, in resolve
self._result = resolver.resolve(
File "/usr/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 453, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/usr/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 318, in resolve
name, crit = self._merge_into_criterion(r, parent=None)
File "/usr/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 173, in _merge_into_criterion
crit = Criterion.from_requirement(self._p, requirement, parent)
File "/usr/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 82, in from_requirement
if not cands:
File "/usr/lib/python3.8/site-packages/pip/_vendor/resolvelib/structs.py", line 124, in __bool__
return bool(self._sequence)
File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in __bool__
return any(self)
File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 38, in _iter_built
candidate = func()
File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 167, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 300, in __init__
super().__init__(
File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 144, in __init__
self.dist = self._prepare()
File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 226, in _prepare
dist = self._prepare_distribution()
File "/usr/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 311, in _prepare_distribution
return self._factory.preparer.prepare_linked_requirement(
File "/usr/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 457, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "/usr/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 500, in _prepare_linked_requirement
dist = _get_prepared_distribution(
File "/usr/lib/python3.8/site-packages/pip/_internal/operations/prepare.py", line 66, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(finder, build_isolation)
File "/usr/lib/python3.8/site-packages/pip/_internal/distributions/sdist.py", line 41, in prepare_distribution_metadata
self.req.prepare_metadata()
File "/usr/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 549, in prepare_metadata
self.metadata_directory = self._generate_metadata()
File "/usr/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 534, in _generate_metadata
return generate_metadata(
File "/usr/lib/python3.8/site-packages/pip/_internal/operations/build/metadata.py", line 34, in generate_metadata
distinfo_dir = backend.prepare_metadata_for_build_wheel(
File "/usr/lib/python3.8/site-packages/pip/_vendor/pep517/wrappers.py", line 193, in prepare_metadata_for_build_wheel
return self._call_hook('prepare_metadata_for_build_wheel', {
File "/usr/lib/python3.8/site-packages/pip/_vendor/pep517/wrappers.py", line 284, in _call_hook
raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pep517.wrappers.BackendUnavailable: Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 86, in _build_backend
obj = import_module(mod_path)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'poetry'
Have you tried this tool: https://github.com/flatpak/flatpak-builder-tools/tree/master/poetry
How should I use that if I don't use poetry to build my project? Should I clone the rich source and run it from there?
I tried what I asked, and I get this error:
Running: pip3 install --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} appdirs atomicwrites attrs black click colorama commonmark coverage dataclasses importlib-metadata iniconfig mypy mypy-extensions packaging pathspec pluggy py pygments pyparsing pytest pytest-cov regex toml typed-ast types-dataclasses typing-extensions zipp
Looking in links: file:///run/build/poetry-deps
Processing ./appdirs-1.4.4-py2.py3-none-any.whl
Processing ./atomicwrites-1.4.0-py2.py3-none-any.whl
Processing ./attrs-21.2.0-py2.py3-none-any.whl
Processing ./black-20.8b1.tar.gz
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /usr/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-n9ktrlnw/overlay --no-warn-script-location --no-binary :none: --only-binary :none: --no-index --find-links file:///run/build/poetry-deps -- 'setuptools>=41.0' setuptools-scm wheel
cwd: None
Complete output (3 lines):
Looking in links: file:///run/build/poetry-deps
ERROR: Could not find a version that satisfies the requirement setuptools>=41.0
ERROR: No matching distribution found for setuptools>=41.0
----------------------------------------
WARNING: Discarding file:///run/build/poetry-deps/black-20.8b1.tar.gz. Command errored out with exit status 1: /usr/bin/python3 /usr/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-n9ktrlnw/overlay --no-warn-script-location --no-binary :none: --only-binary :none: --no-index --find-links file:///run/build/poetry-deps -- 'setuptools>=41.0' setuptools-scm wheel Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement black
ERROR: No matching distribution found for black
Error: module poetry-deps: Child process exited with code 1
Yeah thats what I was thinking, not familiar with poetry
myself though.
I ran into this error today, I add this to my manifest which fixed the issues
- name: poetry-core
buildsystem: simple
build-commands:
- pip3 install --prefix /app --no-deps .
sources:
- type: archive
url: https://github.com/python-poetry/poetry-core/archive/refs/tags/1.0.3.tar.gz
sha256: b5a9f8284c685c638796a322ea868843da5e2094c664436e44061e6bcea367ea
Thanks, that seemed to have fixed the issue