hexgrid-py icon indicating copy to clipboard operation
hexgrid-py copied to clipboard

Example not working

Open rohitgavval opened this issue 7 years ago • 6 comments

The example listed in the ReadMe is not working. I see the following errors when I try to run it: AttributeError: 'module' object has no attribute 'Grid' AttributeError: 'module' object has no attribute 'Point'

Does it need to be updated?

rohitgavval avatar Feb 01 '18 09:02 rohitgavval

Looks like that you use another library (or it was installed later) that provides module with same name. For example I reproduced this behaviour performs following command pip install hexgrid.

I recommend to performs following command: pip install --force-reinstall -U hexgrid-py

habibutsu avatar Feb 01 '18 10:02 habibutsu

I did a pip install hexgrid yesterday. I now realize it should have been hexgrid-py. Update the ReadMe maybe?

I now ran the command suggested by you and then tried to execute the example code. I get this error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-4f6ec1210952> in <module>()
----> 1 import hexgrid
      2 import morton
      3 
      4 center = hexgrid.Point(0, 0)
      5 size = hexgrid.Point(20, 10)

/home/bhaskardhariyal/.virtualenvs/pycuda/local/lib/python2.7/site-packages/hexgrid.py in <module>()
      2 import math
      3 import sys
----> 4 from morton import Morton
      5 
      6 try:

ImportError: cannot import name Morton

Ideas?

rohitgavval avatar Feb 02 '18 06:02 rohitgavval

Requirements had not been installed. As you can see here the morton-py package is required for properly working. I don't have idea why pip did not install needed requirements, but you can try to install it manually: pip install -U morton-py

habibutsu avatar Feb 04 '18 18:02 habibutsu

morton was already installed during the installation of hexgrid, as expected. I did not get an error when i did "import morton". I tried to reinstall morton using the command that you shared. I got the confirmation that it is already installed.(Below message is from the terminal)

Requirement already up-to-date: morton-py in ./.virtualenvs/pycuda/lib/python2.7/site-packages

rohitgavval avatar Feb 05 '18 05:02 rohitgavval

So, it means that you have the same problem as above with hexgrid - looks like that you have installed package morton that provides the same module. Just reinstall morton-py.

habibutsu avatar Feb 05 '18 08:02 habibutsu

Thank you. That worked. Could you provide some documentation on how to use the library?

rohitgavval avatar Feb 08 '18 10:02 rohitgavval