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

Installation fails for some package with error on IsolatedEnv instanciation #8458

Closed
4 tasks done
nanoy42 opened this issue Sep 21, 2023 · 17 comments
Closed
4 tasks done
Labels
kind/bug Something isn't working as expected status/external-issue Issue is caused by external project (platform, dep, etc)

Comments

@nanoy42
Copy link

nanoy42 commented Sep 21, 2023

  • Poetry version: Poetry (version 1.6.1)

  • Python version: Python: 3.11.5

  • OS version and name: Arch Linux

  • pyproject.toml: https://gist.github.com/nanoy42/20a7742335290a2f60341a7dff9cdb7f (almost default)

  • I am on the latest stable Poetry version, installed using a recommended method.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • I have consulted the FAQ and blog for any relevant entries or release notes.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

I am experiencing the following issue when trying to install some packages: it fails with the error Can't instantiate abstract class IsolatedEnv with abstract methods make_extra_environ, python_executable

Full stack trace:

Loading configuration file /home/nanoy/.config/pypoetry/config.toml
Using virtualenv: /home/nanoy/.cache/pypoetry/virtualenvs/test-eFcMuGbA-py3.11
Cloning 'https://github.com/nanoy42/falcon' using system git client

Updating dependencies
Resolving dependencies...
   1: fact: test is 0.1.0
   1: derived: test
   1: fact: test depends on falcon (0.9.2)
   1: selecting test (0.1.0)
   1: derived: falcon (0.9.2) @ git+https://github.com/nanoy42/falcon
   1: fact: falcon (0.9.2) depends on numpy (^1.22.3)
   1: fact: falcon (0.9.2) depends on pycryptodome (^3.16.0)
   1: selecting falcon (0.9.2 906b225)
   1: derived: pycryptodome (>=3.16.0,<4.0.0)
   1: derived: numpy (>=1.22.3,<2.0.0)
No suitable keyring backend found
No suitable keyring backends were found
Keyring is not available, credentials will be stored and retrieved from configuration files as plaintext.
Creating new session for pypi.org
[urllib3.connectionpool] Starting new HTTPS connection (1): pypi.org:443
[urllib3.connectionpool] https://pypi.org:443 "GET /simple/pycryptodome/ HTTP/1.1" 304 0
[filelock] Attempting to acquire lock 139921706129360 on /home/nanoy/.cache/pypoetry/cache/repositories/PyPI/_http/e/1/6/a/f/e16aff1a3f121e44b7a7d104d7cf73a008a55e8e7b9ee657c267f5a7.lock
[filelock] Lock 139921706129360 acquired on /home/nanoy/.cache/pypoetry/cache/repositories/PyPI/_http/e/1/6/a/f/e16aff1a3f121e44b7a7d104d7cf73a008a55e8e7b9ee657c267f5a7.lock
[filelock] Attempting to release lock 139921706129360 on /home/nanoy/.cache/pypoetry/cache/repositories/PyPI/_http/e/1/6/a/f/e16aff1a3f121e44b7a7d104d7cf73a008a55e8e7b9ee657c267f5a7.lock
[filelock] Lock 139921706129360 released on /home/nanoy/.cache/pypoetry/cache/repositories/PyPI/_http/e/1/6/a/f/e16aff1a3f121e44b7a7d104d7cf73a008a55e8e7b9ee657c267f5a7.lock
Source (PyPI): 4 packages found for pycryptodome >=3.16.0,<4.0.0
[urllib3.connectionpool] https://pypi.org:443 "GET /simple/numpy/ HTTP/1.1" 304 0
[filelock] Attempting to acquire lock 139921703037456 on /home/nanoy/.cache/pypoetry/cache/repositories/PyPI/_http/c/c/1/3/3/cc133da5701a066bc3777b2575e0daa601596f19871db4608ca98b97.lock
[filelock] Lock 139921703037456 acquired on /home/nanoy/.cache/pypoetry/cache/repositories/PyPI/_http/c/c/1/3/3/cc133da5701a066bc3777b2575e0daa601596f19871db4608ca98b97.lock
[filelock] Attempting to release lock 139921703037456 on /home/nanoy/.cache/pypoetry/cache/repositories/PyPI/_http/c/c/1/3/3/cc133da5701a066bc3777b2575e0daa601596f19871db4608ca98b97.lock
[filelock] Lock 139921703037456 released on /home/nanoy/.cache/pypoetry/cache/repositories/PyPI/_http/c/c/1/3/3/cc133da5701a066bc3777b2575e0daa601596f19871db4608ca98b97.lock
Source (PyPI): 17 packages found for numpy >=1.22.3,<2.0.0
   1: selecting pycryptodome (3.19.0)
   1: selecting numpy (1.26.0)
   1: Version solving took 0.335 seconds.
   1: Tried 1 solutions.

Finding the necessary packages for the current system
Source (PyPI): 1 packages found for pycryptodome >=3.16.0,<4.0.0
Source (PyPI): 1 packages found for numpy >=1.22.3,<2.0.0

Package operations: 1 install, 0 updates, 0 removals, 2 skipped

  • Installing falcon (0.9.2 906b225): Pending...
  • Installing falcon (0.9.2 906b225): Cloning...
  • Installing falcon (0.9.2 906b225): Preparing...
  • Installing falcon (0.9.2 906b225): Failed

  Stack trace:

  7  /usr/lib/python3.11/site-packages/poetry/installation/executor.py:286 in _execute_operation
      284│
      285│             try:
    → 286│                 result = self._do_execute_operation(operation)
      287│             except EnvCommandError as e:
      288│                 if e.e.returncode == -2:

  6  /usr/lib/python3.11/site-packages/poetry/installation/executor.py:386 in _do_execute_operation
      384│             return 0
      385│
    → 386│         result: int = getattr(self, f"_execute_{method}")(operation)
      387│
      388│         if result != 0:

  5  /usr/lib/python3.11/site-packages/poetry/installation/executor.py:511 in _execute_install
      509│
      510│     def _execute_install(self, operation: Install | Update) -> int:
    → 511│         status_code = self._install(operation)
      512│
      513│         self._save_url_reference(operation)

  4  /usr/lib/python3.11/site-packages/poetry/installation/executor.py:538 in _install
      536│         cleanup_archive: bool = False
      537│         if package.source_type == "git":
    → 538│             archive = self._prepare_git_archive(operation)
      539│             cleanup_archive = operation.package.develop
      540│         elif package.source_type == "file":

  3  /usr/lib/python3.11/site-packages/poetry/installation/executor.py:662 in _prepare_git_archive
      660│             )
      661│
    → 662│         archive = self._prepare_archive(operation, output_dir=output_dir)
      663│         if not package.develop:
      664│             package._source_url = original_url

  2  /usr/lib/python3.11/site-packages/poetry/installation/executor.py:615 in _prepare_archive
      613│         self._populate_hashes_dict(archive, package)
      614│
    → 615│         return self._chef.prepare(
      616│             archive, editable=package.develop, output_dir=output_dir
      617│         )

  1  /usr/lib/python3.11/site-packages/poetry/installation/chef.py:99 in prepare
       97│         if archive.is_dir():
       98│             destination = output_dir or Path(tempfile.mkdtemp(prefix="poetry-chef-"))
    →  99│             return self._prepare(archive, destination=destination, editable=editable)
      100│
      101│         return self._prepare_sdist(archive, destination=output_dir)

  TypeError

  Can't instantiate abstract class IsolatedEnv with abstract methods make_extra_environ, python_executable

  at /usr/lib/python3.11/site-packages/poetry/installation/chef.py:109 in _prepare
      105│     ) -> Path:
      106│         from subprocess import CalledProcessError
      107│
      108│         with ephemeral_environment(self._env.python) as venv:
    → 109│             env = IsolatedEnv(venv, self._pool)
      110│             builder = ProjectBuilder(
      111│                 directory,
      112│                 python_executable=env.executable,
      113│                 scripts_dir=env.scripts_dir,

  • Installing numpy (1.26.0): Pending...
  • Installing numpy (1.26.0): Skipped for the following reason: Already installed
  • Installing pycryptodome (3.19.0): Pending...
  • Installing pycryptodome (3.19.0): Skipped for the following reason: Already installed

It also has happened with other git based dependencies I cannot share (that are personal projects) but also with matplotlib (version 3.5.3).

I was using poetry for some time now, in particular for a big project I am working on and it was working very fine until recently (and to be honest I am not sure what action on my part made it switch to the non working state that I have now, potentially an update of my packages).

I don't have any intuition on this (and it might just be a problem on my side) so any help would appreciated on this issue. In any case if it's a configuration problem, I think we could try to improve the error message.

@nanoy42 nanoy42 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Sep 21, 2023
@dimbleby
Copy link
Contributor

Duplicate #8434, please close

@BVollmerhaus
Copy link

BVollmerhaus commented Sep 21, 2023

To provide some more context because the comment on #8434 doesn't really explain much: Poetry 1.6(.1) specifies a dependency on build = "^0.10.0". The Arch repository (where I presume @nanoy42 installed Poetry from, but please correct me if I'm wrong) bumped their python-build package (a dependency of python-poetry) to 1.0.1 two weeks ago, which, as stated before, is not a version that Poetry's current release is compatible with. So this seems like a distro-specific (unsupported) packaging issue to me (hence why @dimbleby called the installation "incorrect" on the linked issue).

Also worthy of note is that Poetry bumped its build dependency to ^1.0.3 on master, so I'd assume this should be resolved once the next Poetry version is released and lands in the Arch repositories.

@dimbleby
Copy link
Contributor

poetry's requirements do not allow build 1.0: if your poetry environment includes build 1.0 then the installation is certainly incorrect.

@Secrus
Copy link
Member

Secrus commented Sep 21, 2023

@BVollmerhaus your assumption is right, however, the Poetry team does not support any means of installation that are not mentioned in our docs. Any distro- or system-specific installation errors should be directed to external packagers that provide those packages.

@Secrus Secrus closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2023
@BVollmerhaus
Copy link

I did not say otherwise; of course, this should be directed to the respective packaging team.

@oktavlachs
Copy link

@BVollmerhaus Thank you for clarifying the deeper background!

This helped me to find a solution for Arch, so in case someone is looking for a workaround while waiting for the next Poetry release, here you go:

There is a little cli tool called "downgrade" that you can find in the official Arch repos.
Install it, run sudo downgrade python-build , set the version to 0.10.0 and et voilà. 👍 Hope that helps.

@radoering radoering added status/external-issue Issue is caused by external project (platform, dep, etc) and removed status/triage This issue needs to be triaged labels Sep 22, 2023
@salomvary
Copy link

Has anyone figured out a workaround for Homebrew? Sadly, the official installer is broken on macOS too: python-poetry/install.python-poetry.org#24

@aaronclong
Copy link

I am having a similar issue on poetry homebrew Mac with M2

@MarcelWilson
Copy link

MarcelWilson commented Oct 10, 2023

It would appear that homebrew poetry users are in rough position. (I don't know if it's possible, but I could not find a way to downgrade python-build via homebrew). I ended up uninstalling poetry via homebrew and installed it natively to the system python (which I installed python 3.11)

Has anyone figured out a workaround for Homebrew? Sadly, the official installer is broken on macOS too: python-poetry/install.python-poetry.org#24

@danibachini figured out how to get the poetry installer to work on mac:
#745 (comment)

what worked for me (MacOS):
go to Applications > Python folder > double click on "Install Certificates.command" file

Once I did that, the native poetry installer worked.

@btalberg
Copy link

I found a way to rollback python-build to 0.10.0 via homebrew on my Mac M1. The command below will:

  1. remove poetry (necessary to rollback python-build)
  2. remove python-build
  3. reinstall python-build v0.10.0 from an old brew formula
  4. reinstall poetry v1.6.1 from the most recent brew formula
  5. pin each of the packages so they're not auto-upgraded

Both poetry and python-build will need to be unpinned once the issue is resolved.

(cd /tmp &&
brew unpin poetry &&
brew remove poetry &&
brew unpin python-build &&
brew remove python-build &&
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/30b71a03f7b071d71675340d5054adb2f07bd6fa/Formula/p/python-build.rb > python-build.rb &&
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/30b71a03f7b071d71675340d5054adb2f07bd6fa/Formula/p/poetry.rb > poetry.rb &&
brew install python-build.rb &&
brew pin python-build &&
brew install poetry.rb &&
brew pin poetry)

@phillipuniverse
Copy link

@btalberg thanks for the workaround! Worked great for me I am back to poetry install working from Homebrew

@dimbleby
Copy link
Contributor

Homebrew's packaging of poetry is not maintained from this repository, and not listed in the poetry docs as a way to install poetry. (Presumably because of exactly this sort of thing).

If you insist on using it anyway: please raise bugs against https://github.com/Homebrew/homebrew-core/blob/master/Formula/p/poetry.rb

@PaulMest
Copy link

Homebrew's packaging of poetry is not maintained from this repository, and not listed in the poetry docs as a way to install poetry. (Presumably because of exactly this sort of thing).

If you insist on using it anyway: please raise bugs against https://github.com/Homebrew/homebrew-core/blob/master/Formula/p/poetry.rb

I brew uninstalled poetry and re-installed poetry using curl -sSL https://install.python-poetry.org | python3 - and it cleared up this problem for me. Thanks for the tip.

@kozlek
Copy link

kozlek commented Oct 13, 2023

Lately, Homebrew maintainers decided to rely more and more on their own versions of installed python packages. While this is efficient way of saving space, it might introduce bugs because Homebrew CI is not testing every use cases of Poetry (and others python tools).

This current issue is the result of this policy. It has been introduced by the following commit: Homebrew/homebrew-core@58a04d1

If someone wants to fill in an issue and a PR on Homebrew side to explain the situation, feel free. I did my best when Poetry 1.2.0 was released, without success.

Meanwhile, I switched to pipx to manage my python tools to avoid any Homebrew related issues.

Disclaimer: Homebrew is still a great tool for managing my binary tools, libraries and services.

@egorgam
Copy link

egorgam commented Oct 13, 2023

you can temporary use build==0.10

I had same problem with 1.6.1 on python 3.10, and fixed it with --no-deps installation:

pip install --no-deps poetry==1.6.1 cleo rapidfuzz tomli crashtest poetry.core
tomlkit pkginfo virtualenv platformdirs filelock requests urllib3 charset_normalizer
idna certifi dulwich cachecontrol msgpack distlib build==0.10 pyproject_hooks installer packaging

@Ebi-web
Copy link

Ebi-web commented Oct 25, 2023

I found a way to rollback python-build to 0.10.0 via homebrew on my Mac M1. The command below will:

  1. remove poetry (necessary to rollback python-build)
  2. remove python-build
  3. reinstall python-build v0.10.0 from an old brew formula
  4. reinstall poetry v1.6.1 from the most recent brew formula
  5. pin each of the packages so they're not auto-upgraded

Both poetry and python-build will need to be unpinned once the issue is resolved.

(cd /tmp &&
brew unpin poetry &&
brew remove poetry &&
brew unpin python-build &&
brew remove python-build &&
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/30b71a03f7b071d71675340d5054adb2f07bd6fa/Formula/p/python-build.rb > python-build.rb &&
curl https://raw.githubusercontent.com/Homebrew/homebrew-core/30b71a03f7b071d71675340d5054adb2f07bd6fa/Formula/p/poetry.rb > poetry.rb &&
brew install python-build.rb &&
brew pin python-build &&
brew install poetry.rb &&
brew pin poetry)

This works for me!!!

Copy link

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 Feb 29, 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 status/external-issue Issue is caused by external project (platform, dep, etc)
Projects
None yet
Development

No branches or pull requests