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.

AttributeError while installing Pydantic with Python 3.8

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: Ubuntu 20.04.3 LTS

  • Poetry version: 1.1.10

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

I tried this both with Python 3.7.12 and Python 3.8.10 and Poetry is able to install Pydantic when my system python is 3.7.12 (and the installer script install-poetry.py is also run with Python3.7, I haven’t tried installing poetry with Python 3.8 but using a dev environment with 3.7). However with Python 3.8.10, while installing Pydantic, this is the AssertionError that is raised. Output in debug mode:

PyPI: 78 packages found for pydantic *
Using version ^1.8.2 for pydantic

Updating dependencies
Resolving dependencies...
   1: fact: poetry-demo is 0.1.0
   1: derived: poetry-demo
   1: fact: poetry-demo depends on pydantic (^1.8.2)
   1: fact: poetry-demo depends on pytest (^5.2)
   1: fact: poetry-demo depends on pytest (^5.2)
   1: selecting poetry-demo (0.1.0)
   1: derived: pytest (>=5.2,<6.0)
   1: derived: pydantic (>=1.8.2,<2.0.0)
   1: fact: pytest (5.4.3) depends on py (>=1.5.0)
   1: fact: pytest (5.4.3) depends on packaging (*)
   1: fact: pytest (5.4.3) depends on attrs (>=17.4.0)
   1: fact: pytest (5.4.3) depends on more-itertools (>=4.0.0)
   1: fact: pytest (5.4.3) depends on pluggy (>=0.12,<1.0)
   1: fact: pytest (5.4.3) depends on wcwidth (*)
   1: fact: pytest (5.4.3) depends on atomicwrites (>=1.0)
   1: fact: pytest (5.4.3) depends on colorama (*)
   1: selecting pytest (5.4.3)
   1: derived: colorama
   1: derived: atomicwrites (>=1.0)
   1: derived: wcwidth
   1: derived: pluggy (>=0.12,<1.0)
   1: derived: more-itertools (>=4.0.0)
   1: derived: attrs (>=17.4.0)
   1: derived: packaging
   1: derived: py (>=1.5.0)
PyPI: 1 packages found for pydantic >=1.8.2,<2.0.0
   1: fact: pydantic (1.8.2) depends on typing-extensions (>=3.7.4.3)
   1: selecting pydantic (1.8.2)
   1: derived: typing-extensions (>=3.7.4.3)
   1: selecting wcwidth (0.2.5)
   1: selecting pluggy (0.13.1)
   1: selecting more-itertools (8.10.0)
   1: selecting attrs (21.2.0)
   1: fact: packaging (21.0) depends on pyparsing (>=2.0.2)
   1: selecting packaging (21.0)
   1: derived: pyparsing (>=2.0.2)
   1: selecting py (1.10.0)
   1: selecting typing-extensions (3.10.0.2)
   1: selecting pyparsing (2.4.7)
   1: selecting colorama (0.4.4)
   1: selecting atomicwrites (1.4.0)
   1: Version solving took 0.032 seconds.
   1: Tried 1 solutions.

Finding the necessary packages for the current system

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

  • Removing atomicwrites (1.4.0): Pending...
  • Removing atomicwrites (1.4.0): Skipped for the following reason: Not currently installed
  • Removing colorama (0.4.4): Pending...
  • Removing colorama (0.4.4): Skipped for the following reason: Not currently installed
  • Installing pyparsing (2.4.7): Pending...
  • Installing pyparsing (2.4.7): Skipped for the following reason: Already installed
  • Installing attrs (21.2.0): Pending...
  • Installing attrs (21.2.0): Skipped for the following reason: Already installed
  • Installing more-itertools (8.10.0): Pending...
  • Installing more-itertools (8.10.0): Skipped for the following reason: Already installed
  • Installing packaging (21.0): Pending...
  • Installing packaging (21.0): Skipped for the following reason: Already installed
  • Installing pluggy (0.13.1): Pending...
  • Installing pluggy (0.13.1): Skipped for the following reason: Already installed
  • Installing py (1.10.0): Pending...
  • Installing py (1.10.0): Skipped for the following reason: Already installed
  • Installing typing-extensions (3.10.0.2): Pending...
  • Installing typing-extensions (3.10.0.2): Skipped for the following reason: Already installed
  • Installing wcwidth (0.2.5): Pending...
  • Installing wcwidth (0.2.5): Skipped for the following reason: Already installed
  • Installing pydantic (1.8.2): Pending...
  • Installing pydantic (1.8.2): Failed

  AttributeError

  'Link' object has no attribute 'name'

  at ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/installation/executor.py:632 in _download_link
      628│                 raise RuntimeError(
      629│                     "Invalid hashes ({}) for {} using archive {}. Expected one of {}.".format(
      630│                         ", ".join(sorted(archive_hashes)),
      631│                         package,
    → 632│                         archive.name,
      633│                         ", ".join(sorted(hashes)),
      634│                     )
      635│                 )
      636│ 

  • Installing pytest (5.4.3): Pending...
  • Installing pytest (5.4.3): Skipped for the following reason: Already installed

Failed to add packages, reverting the pyproject.toml file to its original content.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
miohtamacommented, Oct 22, 2021

I started a new project and encountered this error, so it cannot be related to the old lock file or similar. I suggest it might be related to corrupted caches, or something in the cache. I managed to workaround with the following.

To downgrade Poetry to 1.1.8:

wget -S https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py 
python get-poetry.py --version 1.1.8  

Make sure your cache is nuked.

poetry cache clear . --all
# macOS
rm -rf ~/Library/Caches/pypoetry/artifacts  

Then this worked again

poetry add ipdb
1reaction
wojdattocommented, Sep 28, 2021

I had the same issue ('Link' object has no attribute 'name') during poetry install of a different set of packages. Downgrading to poetry 1.1.8 and poetry-core 1.0.4 (I think the latter makes the difference here) solved it. I’m not sure about the root cause, though.

My clue was taken from the author of #4528.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Install - pydantic
Install. Installation is as simple as: pip install pydantic. pydantic has no required dependencies except Python 3.7 ...
Read more >
AttributeError: Module 'pydantic' has no attribute '__version__ ...
I have installed 2 libraries (using pip): spaCy and BeautifulSoup. What could be the cause of this error and what could I try...
Read more >
pydantic - PyPI
Fast and extensible, pydantic plays nicely with your linters/IDE/brain. Define how data should be in pure, canonical Python 3.7+; validate it with pydantic....
Read more >
pydantic [python-library] - Occam :: Details
Install using pip install -U pydantic or conda install pydantic -c conda-forge ... Remove typing_extensions dependency for python 3.8, #1342 by @prettywood ...
Read more >
Import cobra - Google Groups
I followed all the steps to install CobraPy in a Conda enviroment but when ... My environment with python 3.8.12 is running pydantic...
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