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

AttributeError: module 'attr' has no attribute 's' #99

Open
almereyda opened this issue Sep 22, 2022 · 5 comments
Open

AttributeError: module 'attr' has no attribute 's' #99

almereyda opened this issue Sep 22, 2022 · 5 comments

Comments

@almereyda
Copy link

Expected Behavior

kb runs.

Actual Behavior

Executing kb yields:

$ kb
Traceback (most recent call last):
  File "/home/yala/.local/bin/kb", line 5, in <module>
    from kb.main import main
  File "/home/yala/.local/lib/python3.10/site-packages/kb/main.py", line 19, in <module>
    from kb.commands.add import add
  File "/home/yala/.local/lib/python3.10/site-packages/kb/commands/add.py", line 19, in <module>
    import kb.db as db
  File "/home/yala/.local/lib/python3.10/site-packages/kb/db.py", line 21, in <module>
    from kb.entities.artifact import Artifact
  File "/home/yala/.local/lib/python3.10/site-packages/kb/entities/artifact.py", line 18, in <module>
    @attr.s(auto_attribs=True, frozen=True, slots=True)
AttributeError: module 'attr' has no attribute 's'

Steps to Reproduce the Problem

  1. Execute pip install -U kb-manager
  2. Execute kb
  3. See the error above.

Specifications

  • Version: 70eda73
  • Platform: Ubuntu 22.04
  • Subsystem: Python 3.10 (system)
@gnebbia
Copy link
Owner

gnebbia commented Sep 22, 2022

Please give a look at the FAQ section of the README

@almereyda almereyda changed the title Incompatible with Python 3.10 AttributeError: module 'attr' has no attribute 's' Sep 22, 2022
@almereyda
Copy link
Author

Ah yes ;) I saw this comment in another issue, why I returned here in the first place.

@almereyda almereyda reopened this Sep 22, 2022
@almereyda
Copy link
Author

almereyda commented Sep 22, 2022

Unfortunately on my system running the commands as in

does not help:

$ pip uninstall attr attrs
Found existing installation: attr 0.3.2
Uninstalling attr-0.3.2:
  Would remove:
    /home/yala/.local/lib/python3.10/site-packages/attr-0.3.2.dist-info/*
    /home/yala/.local/lib/python3.10/site-packages/attr.py
    /home/yala/.local/lib/python3.10/site-packages/dry_attr.py
Proceed (Y/n)?
  Successfully uninstalled attr-0.3.2
Found existing installation: attrs 21.2.0
Not uninstalling attrs at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'attrs'. No files were found to uninstall.

$ pip install attr
Defaulting to user installation because normal site-packages is not writeable
Collecting attr
  Using cached attr-0.3.2-py2.py3-none-any.whl (3.3 kB)
Installing collected packages: attr
Successfully installed attr-0.3.2

$ pip install -U kb-manager
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: kb-manager in /home/yala/.local/lib/python3.10/site-packages (0.1.7)
Requirement already satisfied: colored in /home/yala/.local/lib/python3.10/site-packages (from kb-manager) (1.4.3)
Requirement already satisfied: gitpython in /home/yala/.local/lib/python3.10/site-packages (from kb-manager) (3.1.27)
Requirement already satisfied: attrs in /usr/lib/python3/dist-packages (from kb-manager) (21.2.0)
Requirement already satisfied: toml in /usr/lib/python3/dist-packages (from kb-manager) (0.10.2)
Requirement already satisfied: attr in /home/yala/.local/lib/python3.10/site-packages (from kb-manager) (0.3.2)
Requirement already satisfied: gitdb<5,>=4.0.1 in /home/yala/.local/lib/python3.10/site-packages (from gitpython->kb-manager) (4.0.9)
Requirement already satisfied: smmap<6,>=3.0.1 in /home/yala/.local/lib/python3.10/site-packages (from gitdb<5,>=4.0.1->gitpython->kb-manager) (5.0.0)

$ kb list
Traceback (most recent call last):
  File "/home/yala/.local/bin/kb", line 5, in <module>
    from kb.main import main
  File "/home/yala/.local/lib/python3.10/site-packages/kb/main.py", line 19, in <module>
    from kb.commands.add import add
  File "/home/yala/.local/lib/python3.10/site-packages/kb/commands/add.py", line 19, in <module>
    import kb.db as db
  File "/home/yala/.local/lib/python3.10/site-packages/kb/db.py", line 21, in <module>
    from kb.entities.artifact import Artifact
  File "/home/yala/.local/lib/python3.10/site-packages/kb/entities/artifact.py", line 18, in <module>
    @attr.s(auto_attribs=True, frozen=True, slots=True)
AttributeError: module 'attr' has no attribute 's'

Please note that attrs (with s) has not been uninstalled, since it derives from the system installation and is outside of the /usr (as it says, despite being in /usr; well).

This might be an issue with my Python environment, after all. I should try reproducing this within a dedicated pyenv, Poetry, conda or asdf environment.

@gnebbia
Copy link
Owner

gnebbia commented Sep 22, 2022

Wait there is no attrs installed? Yes please retry with a clean environment.

@almereyda
Copy link
Author

Apparently, attrs is installed, but cannot be deleted (due to the lack of sudo):

Found existing installation: attrs 21.2.0
Not uninstalling attrs at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'attrs'. No files were found to uninstall.

Working with a dedicated environment seems advisable here, as you suggest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants