Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13951

Kanren Problem in python -> ImportError: cannot import name 'Iterator' from 'collections'

$
0
0

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, factfrom kanren.assoccomm import eq_assoccomm as eqfrom 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, associativeFile ~\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, memberoFile ~\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, VarFile ~\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 assocImportError: 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.


Viewing all articles
Browse latest Browse all 13951

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>