I am learning A.I. with python from Tutorials Point and I reached to the Logic Programming section, here the program is of "Matching Mathematical expressions", and they consider to import the Kanren package. here is the following code
from kanren import run, var, fact
from kanren.assoccomm import eq_assoccomm as eq
from kanren.assoccomm import commutative, associative
and here is the following error it gives me
ImportError Traceback (most recent call last)
Cell In[3], line 1
----> 1 from kanren import run, var, fact
2 from kanren.assoccomm import eq_assoccomm as eq
3 from kanren.assoccomm import commutative, associative
File ~\anaconda3\lib\site-packages\kanren\__init__.py:7
2 """
3 kanren is a Python library for logic and relational programming.
4 """
5 from __future__ import absolute_import
----> 7 from unification import (unify, reify, unifiable, var, isvar, vars, variables,
8 Var)
10 from .core import run, eq, conde, lall, lany
11 from .goals import seteq, permuteq, goalify, membero
File ~\anaconda3\lib\site-packages\unification\__init__.py:1
----> 1 from .core import unify, reify
2 from .more import unifiable
3 from .variable import var, isvar, vars, variables, Var
File ~\anaconda3\lib\site-packages\unification\core.py:2
1 from functools import partial
----> 2 from collections import Iterator
3 from toolz.compatibility import iteritems, map
4 from toolz import assoc
ImportError: cannot import name 'Iterator' from 'collections' (C:\Users\91997\anaconda3\lib\collections\__init__.py)
I am using Jupyter Notebook for my Python code and am using Python 3.10.9 version
I read the problem where I tried using
from collections.abc import Iterable
and also did try
from collections.abc import Iterator
but it didn't work.
By downloading the older versions of python in my case I downloaded version 3.9, and it worked and gave the output I created a new environment of 3.9 for this following code of kanren and kept 3.10 for all my latest code