question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

poetry 1.2.0a1: AttributeError when installing package from secondary repo

See original GitHub issue
  • 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: macOS 10.15

  • Poetry version: 1.2.0a1

  • Link of a Gist with the contents of your pyproject.toml file:

Issue

Hi! I’m testing new 1.2.0a1 version as an early-adopter to find potential issues.

My pyproject.toml defines a secondary repo:

[[tool.poetry.source]]
name = "XXX"
url = "https://pypi.XXX.YYY"
secondary = true

And I have one dependency which comes from this private pypi repo. Poetry 1.1.3 installed it without errors, but on 1.2.0a1 I get this stacktrace:

  β€’ Installing FOOBAR (1.7.2): Pending...
  β€’ Installing FOOBAR (1.7.2): Failed

  Stack trace:

  5  ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/installation/executor.py:244 in _execute_operation
      242β”‚ 
      243β”‚             try:
    β†’ 244β”‚                 result = self._do_execute_operation(operation)
      245β”‚             except EnvCommandError as e:
      246β”‚                 if e.e.returncode == -2:

  4  ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/installation/executor.py:321 in _do_execute_operation
      319β”‚             return 0
      320β”‚ 
    β†’ 321β”‚         result = getattr(self, f"_execute_{method}")(operation)
      322β”‚ 
      323β”‚         if result != 0:

  3  ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/installation/executor.py:462 in _execute_install
      460β”‚ 
      461β”‚     def _execute_install(self, operation: Union[Install, Update]) -> int:
    β†’ 462β”‚         status_code = self._install(operation)
      463β”‚ 
      464β”‚         self._save_url_reference(operation)

  2  ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/installation/executor.py:498 in _install
      496β”‚             archive = self._download_link(operation, Link(package.source_url))
      497β”‚         else:
    β†’ 498β”‚             archive = self._download(operation)
      499β”‚ 
      500β”‚         operation_message = self.get_operation_message(operation)

  1  ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/installation/executor.py:648 in _download
      646β”‚         link = self._chooser.choose_for(operation.package)
      647β”‚ 
    β†’ 648β”‚         return self._download_link(operation, link)
      649β”‚ 
      650β”‚     def _download_link(self, operation: Union[Install, Update], link: Link) -> Link:

  AttributeError

  'Link' object has no attribute 'name'

  at ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/installation/executor.py:683 in _download_link
      679β”‚                 ).hash()
      680β”‚             )
      681β”‚             if archive_hash not in {f["hash"] for f in package.files}:
      682β”‚                 raise RuntimeError(
    β†’ 683β”‚                     f"Invalid hash for {package} using archive {archive.name}"
      684β”‚                 )
      685β”‚ 
      686β”‚             self._hashes[package.name] = archive_hash
      687β”‚ 

If you need any additional info to better understand the issue, I’ll be happy to provide it.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:12
  • Comments:39 (5 by maintainers)

github_iconTop GitHub Comments

13reactions
paulmelnikowcommented, Sep 20, 2021

This regression appeared in Poetry 1.1.7/1.1.9 two days ago when poetry-core 1.0.5 was released. Downgrading to poetry-core 1.0.4 is a workaround.

11reactions
sudo-ankitmishracommented, Oct 18, 2021

I had the same issue, with poetry 1.1.11, I downgraded poetry to 1.0.6 and it worked, but that was not the permanent solution as 1.1.11 brought new features, which were really handy in building/publishing wheels. After some research I found that poetry’s local cache was getting corrupted, since I built the packages multiple times. So I needed to delete the cache and it started working again like a charm.

To find the cache location poetry config --list

delete the cache directory containing the private repository. Or run poetry cache clear repo-name --all

delete the virtual-env from your project run poetry install/update again it will work.

Please Have a look https://github.com/python-poetry/poetry/issues/1631 I think that’s the reason why we are having this problem at first place.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Announcing Poetry 1.2.0a1 | Blog
It no longer relies on the prebuilt release packages of Poetry (see ... It supports installing from a git repository or a file/directory....
Read more >
python - Poetry trying to install everything from private repository
poetry first checks if the project is in your private-pypi and then checks public-pypi . Here the error is mostly because of 403...
Read more >
e: package 'python3.8-venv' has no installation candidate
The package python-virtualenv has no installation candidate error ... 1.2.0a1: AttributeError when installing package from secondary repo#4085.
Read more >
poetry-version-plugin 0.1.3 - PyPI
And this plugin would get the version of the package from that Git tag. Install Poetry 1.2.0a1. For this plugin to work, you...
Read more >
poetry: Versions - Openbase
Clarify that poetry install removes dependencies of non-installed extras (#6229) ... Fixed an error with repository prioritization when specifying secondary ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found