vishnubob / snowflake

Snowflake Generator
MIT License
109 stars 21 forks source link

Can't get it running on Mac #1

Open adius opened 9 years ago

adius commented 9 years ago

I installed the dependencies (but using pillow instead of PIL) and then run the installation script with $ ./install.sh. When I try to execute the script with $ ./build/scripts-2.7/snowflake.py, I get following error message:

Traceback (most recent call last):
  File "app_main.py", line 75, in run_toplevel
  File "./build/scripts-2.7/snowflake.py", line 5, in <module>
    from sfgen import *
  File "/usr/local/Cellar/pypy/2.4.0_2/libexec/site-packages/sfgen/__init__.py", line 21, in <module>
    from graphics import *
  File "/usr/local/Cellar/pypy/2.4.0_2/libexec/site-packages/sfgen/graphics.py", line 18, in <module>
    from PIL import Image
ImportError: No module named PIL
adius commented 9 years ago

…and I can't get PIL installed (which is not very surprising in light of not having been updated since 2009). But using pillow instead of PIL seems to be the best practice anyway…

vishnubob commented 9 years ago

Hi Adius. Yeh, pillow is the money, since PIL is no longer maintained and they are 100% compatible. As you can see, you are the first person to report an issue. I'm curious, how did you find out about this repo? Are you interested in cutting your own snowflakes?

roryk commented 9 years ago

Hi Adius,

If you install the anaconda distribution of python like this:

wget http://09c8d0b2229f813c1b93-c95ac804525aac4b6dba79b00b39d1d3.r79.cf1.rackcdn.com/Anaconda-1.9.2-MacOSX-x86_64.sh
bash Anaconda-1.9.2-MacOSX-x86_64.sh
conda install pip
conda install distribute

You can install PIL with conda install PIL, and then you should be good to go!

adius commented 9 years ago

@vishnubob Well, I want to lasercut snowflakes and so I searched for snowflake generator on github and found your repo. =)

@roryk I'd rather only use homebrew and I already installed all the necessary dependencies with homebrew so it should work. The question now is: why not? =P

roryk commented 9 years ago

Gotcha, as a last sell: conda is awesome because it solves this exact problem. PIL doesn't compile out of the box because it has been deprecated and isn't well maintained but conda provides binaries for all of the hard to compile things. It just installs into a ~/anaconda directory in your home directory, so if you don't like it you can just delete the directory and that's it.

adius commented 9 years ago

I guess it won't get easier then brew install pillow and brew uninstall pillow ;-)

roryk commented 9 years ago

True. :) The script looks like it is using pypy as the interpreter by default, which is using it's own site-packages that pillow is not in, maybe? If you run:

python build/scripts-2.7/snowflake.py

does it work?

vishnubob commented 9 years ago

snowflake uses pypy because it simulates a closed dynamic system at a mesoscopic scale. using straight python to generate your snowflake will take days, but with pypy, it will only take hours. i don't use anaconda, so i can't directly speak to its utility, but i can make some suggestions based on how i setup my environment. first, you will want to install pypy. use virtualenv to setup a virtual environment, pointing to pypy as the interpreter (virtualenv -p /path/to/pypy). switch to that environment, and use pip to install pillow.

adius commented 9 years ago

@roryk Ah, this seems to be the problem! I can make it work with python. =)

Can you maybe add some example configurations to the README? I tried some configurations but couldn't really figure out which one are allowed and which are not…

vishnubob commented 9 years ago

if you are looking for a quicker simulation time, i recommend you use pypy for the simulations, but if you have the time, python will work fine.

as far as examples and documentation goes, i just don't have time right now. i wrote this as a one-off project a few years back, and haven't had the chance to circle around and improve it; but feel free to submit pull requests.

adius commented 9 years ago

OK, too bad, this is a really cool project! Maybe next year I'll have a closer look … this year I simply retraced your PNGs with potrace. =P But I got some really nice lasercut wooden snowflakes now. =)

seanth commented 7 years ago

Necro, but I just got things working on mac os 10.12. The following assume you have homebrew installed:

brew install numpy brew install pillow brew install pypy pypy -m pip install git+https://bitbucket.org/pypy/numpy.git pypy -m pip install pillow

That should correctly install everything. The newest version of pillow removed a call used in graphics.py, and I put in a pull request to fix it (https://github.com/vishnubob/snowflake/pull/2)

In my tests, I can make snowflake images using the python or pypy method. I am not set up to test the 3dprinting or laser cutting though. Pretty simple test is:

pypy snowflake.py -b -V -M 49 testflake