'Could not find a version that satisfies the requirement lispy

I read book, I try practice these code snippet

>>> from lis import parse
>>> parse('1.5')
1.5

Then I follow guide at https://github.com/adamhaney/lispy#getting-started . My PC is Windows 11 Pro x64.

C:\Users\donhu>python -V
Python 3.10.4

C:\Users\donhu>pip -V
pip 22.0.4 from C:\Program Files\Python310\lib\site-packages\pip (python 3.10)

C:\Users\donhu>pip install lispy
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement lispy (from versions: none)
ERROR: No matching distribution found for lispy

C:\Users\donhu>

enter image description here

I also try install with Anaconda, but not success.

enter image description here

How to fix?



Solution 1:[1]

lispy is not a library in pip downloadable library. Instead, install lispy from the github repo. Here is a Link to post explaining how install directly from github repo

Solution 2:[2]

It seems Norvig's lispy is not module for installing but you have to download lis.py and put in folder with your code - or you would have to manually put it in folder with other modules.


As for github repo adamhaney/lispy: on Linux I can install it using git+ before https

pip install git+https://github.com/adamhaney/lispy 

But this is not original lis.py but some modification and it needs

import lispy

parsed = lispy.runtime.parse('(define pi 3.141592653589793)')
result = lispy.runtime.eval(parsed)

parsed = lispy.runtime.parse('(define r 10)')
result = lispy.runtime.eval(parsed)

parsed = lispy.runtime.parse('(* pi (* r r))')
result = lispy.runtime.eval(parsed)

print(result)

or more useful

import lispy

def cmd(text):
    parsed = lispy.runtime.parse(text)
    result = lispy.runtime.eval(parsed)
    if result:
        print(result)

# --- main ---

cmd('(define pi 3.141592653589793)')
cmd('(define r 10)')
cmd('(* pi (* r r))')

or using interactive mode which displays prompt lispy>

import lispy

lispy.runtime.Runtime().repl()

BTW: repo adamhaney/lispy is 10 years old (last update on 6 Jul 2013) and maybe this is problem. Maybe this lispy was removed from pypi.org and now you can't install it with pip


EDIT:

See also main page norvig.com - there is link to "NEW" List of Jupyter/Ipython notebooks with the newest materials (even from 2022)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Samuel Simon
Solution 2