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 'collections' has no attribute 'Mapping' #34

Open
karapapas opened this issue Jul 7, 2023 · 3 comments
Open

Comments

@karapapas
Copy link

karapapas commented Jul 7, 2023

Python Python 3.10.9
Jupyter Notebook 6.5.2

!pip install experta
Requirement already satisfied: experta in c:\programdata\anaconda3\lib\site-packages (1.9.4)
Requirement already satisfied: frozendict==1.2 in c:\programdata\anaconda3\lib\site-packages (from experta) (1.2)
Requirement already satisfied: schema==0.6.7 in c:\programdata\anaconda3\lib\site-packages (from experta) (0.6.7)

from experta import *

AttributeError Traceback (most recent call last)
Cell In[9], line 1
----> 1 from experta import *

File C:\ProgramData\anaconda3\lib\site-packages\experta_init_.py:5
3 try:
4 from .conditionalelement import AND, OR, NOT, TEST, EXISTS, FORALL
----> 5 from .engine import KnowledgeEngine
6 from .fact import Fact, InitialFact, Field
7 from .fieldconstraint import L, W, P

File C:\ProgramData\anaconda3\lib\site-packages\experta\engine.py:13
10 from experta import abstract
12 from experta.agenda import Agenda
---> 13 from experta.fact import InitialFact
14 from experta.factlist import FactList
15 from experta.rule import Rule

File C:\ProgramData\anaconda3\lib\site-packages\experta\fact.py:9
6 from schema import Schema
8 from experta.pattern import Bindable
----> 9 from experta.utils import freeze, unfreeze
10 from experta.conditionalelement import OperableCE
11 from experta.conditionalelement import ConditionalElement

File C:\ProgramData\anaconda3\lib\site-packages\experta\utils.py:4
1 from functools import singledispatch
2 import collections.abc
----> 4 from frozendict import frozendict
6 from .fieldconstraint import P
9 class frozenlist(tuple):

File C:\ProgramData\anaconda3\lib\site-packages\frozendict_init_.py:16
10 OrderedDict = NotImplemented
13 iteritems = getattr(dict, 'iteritems', dict.items) # py2-3 compatibility
---> 16 class frozendict(collections.Mapping):
17 """
18 An immutable wrapper around dictionaries that implements the complete :py:class:collections.Mapping
19 interface. It can be used as a drop-in replacement for dictionaries where immutability is desired.
20 """
22 dict_cls = dict

AttributeError: module 'collections' has no attribute 'Mapping'


After deleting the site-packages
!pip install experta
Collecting experta
Using cached experta-1.9.4-py3-none-any.whl (35 kB)
Requirement already satisfied: frozendict==1.2 in c:\programdata\anaconda3\lib\site-packages (from experta) (1.2)
Requirement already satisfied: schema==0.6.7 in c:\programdata\anaconda3\lib\site-packages (from experta) (0.6.7)
Installing collected packages: experta
Successfully installed experta-1.9.4

from experta import *
...
AttributeError: module 'collections' has no attribute 'Mapping'

@horaciogacevedo
Copy link

This is a problem with python 3.10 upwards. If you create a conda environment with python 3.9 it works in ubuntu.

@mohamedamara1
Copy link

This is a problem with python 3.10 upwards. If you create a conda environment with python 3.9 it works in ubuntu.

Any other fix for this? I tested with 3.9.18 on python venv and I got the same error

@mohamedamara1
Copy link

Using

This is a problem with python 3.10 upwards. If you create a conda environment with python 3.9 it works in ubuntu.

Any other fix for this? I tested with 3.9.18 on python venv and I got the same error

Installing python 3.8.18 worked for me

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

3 participants