Tensor-Puzzles icon indicating copy to clipboard operation
Tensor-Puzzles copied to clipboard

Installation fails

Open snth768 opened this issue 1 year ago • 1 comments

On ubuntu 24.04, I tried to install the requirements and run the notebook on python 3.7, 3.9 and 3.10. In each case, it does not work. After installing requirements.txt, I am still missing matplotlib, colour and chalk. When I also install these, I get the error

{
	"name": "NameError",
	"message": "name 'vstrut' is not defined",
	"stack": "---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[2], line 5
      2     \"Use this function to replace a for-loop.\"
      3     return torch.tensor(range(i))
----> 5 draw_examples(\"arange\", [{\"\" : arange(i)} for i in [5, 3, 9]])

File ~/Documents/tensor_questions/Tensor-Puzzles/lib.py:83, in draw_examples(name, examples)
     78 def draw_examples(name, examples):
     79     data = {\"name\":name,
     80                   \"vals\" :[{k: [v.tolist()] if len(v.shape) == 1 else v.tolist() 
     81                         for k, v in example.items()}
     82                         for example in examples ] }
---> 83     return draw_example(data)

File ~/Documents/tensor_questions/Tensor-Puzzles/lib.py:57, in draw_example(data)
     55 cols = []
     56 for k in keys:
---> 57     mat = [(vstrut(0.5) / text(k, 0.5).fill_color(Color(\"black\")).line_width(0.0) / vstrut(0.5))]         
     58     for ex in data[\"vals\"]:
     59         v2 = ex[k]           

NameError: name 'vstrut' is not defined"
}

I guess because it should have been imported from chalk with the star imports. Could the correct version of chalk be added to the requirements.txt?

Also, does anyone know why I have this problem but no one else in the issues has mentioned it?

Thanks

snth768 avatar Jan 30 '25 11:01 snth768

Make sure you're installing the requirements in the first cell of the notebook, namely

pip install -qqq torchtyping hypothesis pytest git+https://github.com/chalk-diagrams/chalk

AbhijeetKrishnan avatar Apr 19 '25 07:04 AbhijeetKrishnan