GPU-Puzzles
GPU-Puzzles copied to clipboard
NameError: name 'unit_y' is not defined
After run: problem.show() in my local environment
NameError Traceback (most recent call last)
/tmp/ipykernel_1818177/1878365812.py in <module>
5 "Map", map_test, [a], out, threadsperblock=Coord(SIZE, 1), spec=map_spec
6 )
----> 7 problem.show()
~/code/mycode/GPU-Puzzles/lib.py in show(self, sparse)
389 self.score(results)
390 return draw_results(results, self.name,
--> 391 self.threadsperblock.x, self.threadsperblock.y, sparse)
392
393 def check(self):
~/code/mycode/GPU-Puzzles/lib.py in draw_results(results, name, tpbx, tpby, sparse)
256 blocks = []
257 locations = []
--> 258 base = draw_base(*results[Coord(0, 0)][Coord(0, 0)])
259 for block, inner in results.items():
260 dia = base
~/code/mycode/GPU-Puzzles/lib.py in draw_base(_, a, c, out)
227
228 def draw_base(_, a, c, out):
--> 229 inputs = vcat([draw_table(d) for d in a], 2.0).center_xy()
230 shared_tables = [[draw_table(c2.refs[i]) for i in range(1, c.rounds())] for c2 in c.caches]
231 shareds = grid(shared_tables, 1.0).center_xy()
~/code/mycode/GPU-Puzzles/lib.py in <listcomp>(.0)
227
228 def draw_base(_, a, c, out):
--> 229 inputs = vcat([draw_table(d) for d in a], 2.0).center_xy()
230 shared_tables = [[draw_table(c2.refs[i]) for i in range(1, c.rounds())] for c2 in c.caches]
231 shareds = grid(shared_tables, 1.0).center_xy()
~/code/mycode/GPU-Puzzles/lib.py in draw_table(tab)
211 tab = table(tab.name, *tab.size)
212 tab = tab.line_width(0.05)
--> 213 return tab.beside((t + vstrut(0.5)), -unit_y)
214
215
NameError: name 'unit_y' is not defined
And problem.check() no error, it's nice.
I think you installed an old version of chalk. Can you make sure you install the one from my branch (command is in the notebook).
I think you installed an old version of
chalk. Can you make sure you install the one from my branch (command is in the notebook).
Actually after run command pip install -qqq git+https://github.com/danoneata/chalk@srush-patch-1, nothing happened.
So I open the repo danoneata/chalk, then follow the guidence, run the command conda install -c conda-forge chalk-diagrams
My chalk version:
$ conda list | grep chalk
chalk-diagrams 0.1.2 pyhd8ed1ab_0 conda-forge
I try to run command pip install git+https://github.com/danoneata/chalk@srush-patch-1, But an error occurred:
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
Traceback (most recent call last):
File "/tmp/pip-install-ofq9w8yg/planar_3384c07b07cb49e694e3d9f59655d633/setup.py", line 11, in <module>
from distutils.command.build_py import build_py_2to3 as build_py
ImportError: cannot import name 'build_py_2to3' from 'distutils.command.build_py' (/home/steve/.conda/envs/py37/lib/python3.7/site-packages/setuptools/_distutils/command/build_py.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 36, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-ofq9w8yg/planar_3384c07b07cb49e694e3d9f59655d633/setup.py", line 14, in <module>
raise ImportError("build_py_2to3 not found in distutils - it is required for Python 3.x")
ImportError: build_py_2to3 not found in distutils - it is required for Python 3.x
[end of output]
And my python version is totally the same with Colab.
>>> sys.version
'3.7.13 (default, Mar 29 2022, 02:18:16) \n[GCC 7.5.0]'
Ah thanks. This is a bug with one of the chalk dependencies. I will fix it there.
Sorry about that.
Okay, this issue should be fixed now. Could you try it again?
Thanks in advance.
I create a new py37 virtual environment. Then tried again, but not work due to the same error mentioned above.
I also get the same error. unit_y is not defined. Where would this come from?
@GdMacmillan can you confirm that you installed Chalk from GitHub, as in the first notebook cell?
I met this problem before, but solved by:
- creating a conda env with Python version 3.9 (I suppose <=3.10 are acceptable because
build_py_2to3was removed fromdistutilsfor higher versions) - install setuptools<=57.5.0 for the same reason above
pip install git+https://github.com/danoneata/chalk@srush-patch-1
btw, I did above with requirements.txt which would make setting up environment easier
I'm running into this too fwiw. Using the git patch didn't resolve it outof the box - haven't tried limiting the python version per @ch1y0q yet. Would be good if we could get this working with the latest official version of chalk.
Oh, I'll fix this up and make sure they are compatible.