NameError: name 'unit_y' is not defined · Issue #9 · srush/GPU-Puzzles · GitHub
Skip to content

NameError: name 'unit_y' is not defined #9

Open

Description

@renhaofan

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.

Activity

  1. srush commented on Jul 15, 2022

    @srush
    Owner

    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).

  2. renhaofan commented on Jul 17, 2022

    @renhaofan
    Author

    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
    
  3. renhaofan commented on Jul 17, 2022

    @renhaofan
    Author

    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]'
    
  4. srush commented on Jul 17, 2022

    @srush
    Owner

    Ah thanks. This is a bug with one of the chalk dependencies. I will fix it there.

    Sorry about that.

  5. srush commented on Jul 17, 2022

    @srush
    Owner

    Okay, this issue should be fixed now. Could you try it again?

  6. renhaofan commented on Jul 18, 2022

    @renhaofan
    Author

    Thanks in advance.

    I create a new py37 virtual environment. Then tried again, but not work due to the same error mentioned above.

  7. GdMacmillan commented on Jul 20, 2022

    @GdMacmillan

    I also get the same error. unit_y is not defined. Where would this come from?

  8. srush commented on Jul 20, 2022

    @srush
    Owner

    @GdMacmillan can you confirm that you installed Chalk from GitHub, as in the first notebook cell?

  9. ch1y0q commented on Jan 16, 2023

    @ch1y0q

    I met this problem before, but solved by:

    1. creating a conda env with Python version 3.9 (I suppose <=3.10 are acceptable because build_py_2to3 was removed from distutils for higher versions)
    2. install setuptools<=57.5.0 for the same reason above
    3. 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

  10. austinvhuang commented on Mar 13, 2023

    @austinvhuang

    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.

  11. srush commented on Mar 13, 2023

    @srush
    Owner

    Oh, I'll fix this up and make sure they are compatible.

  12. reopened this on Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions