Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'unit_y' is not defined #9

Open
renhaofan opened this issue Jul 15, 2022 · 11 comments
Open

NameError: name 'unit_y' is not defined #9

renhaofan opened this issue Jul 15, 2022 · 11 comments

Comments

@renhaofan
Copy link

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.

@srush
Copy link
Owner

srush commented Jul 15, 2022

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

@renhaofan
Copy link
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

@renhaofan
Copy link
Author

renhaofan commented Jul 17, 2022

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]'

@srush
Copy link
Owner

srush commented Jul 17, 2022

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

Sorry about that.

@srush
Copy link
Owner

srush commented Jul 17, 2022

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

@renhaofan
Copy link
Author

Thanks in advance.

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

@GdMacmillan
Copy link

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

@srush
Copy link
Owner

srush commented Jul 20, 2022

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

@ch1y0q
Copy link

ch1y0q commented Jan 16, 2023

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

@austinvhuang
Copy link

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.

@srush
Copy link
Owner

srush commented Mar 13, 2023

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

@srush srush reopened this Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants