caseman / noise

Perlin noise library for Python
MIT License
423 stars 70 forks source link

Error during the installation #12

Closed Gnu-Bricoleur closed 8 years ago

Gnu-Bricoleur commented 8 years ago

When using pip to install noise : sudo pip install noise , an error occured : ...... blablabla ...... running build_ext

building 'noise._simplex' extension

creating build/temp.linux-x86_64-2.7

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c _simplex.c -o build/temp.linux-x86_64-2.7/_simplex.o -funroll-loops

_simplex.c:5:20: fatal error: Python.h: Aucun fichier ou dossier de ce type

compilation terminated.

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

When trying the installation via the github repository, the folder Python.h is also missing: sudo python setup.py install ...... ..... building 'noise._simplex' extension x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c _simplex.c -o build/temp.linux-x86_64-2.7/_simplex.o -funroll-loops _simplex.c:5:20: fatal error: Python.h: Aucun fichier ou dossier de ce type compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Anyway, thank for your helpfull librairy. Gnu-Bricoleur

EDIT : It work with pip3 install but not with pip for the default version of python wich is 2.7 on my distrib, i suppose it work with sudo python3 setup.py install although i didn't try

brycepg commented 8 years ago

Looks like need to install the python development headers for python 2.7.

sudo apt-get install python-dev for ubuntu sudo yum install python-devel for fedora

caseman commented 8 years ago

Yeah, it's annoying sometimes that Linux distros leave those out. Who do they think we are, mere end users? :^)

Glad you figured it out. Let me know if anything else bites you.

-Casey

On Sat, Feb 27, 2016 at 3:24 PM Bryce Guinta notifications@github.com wrote:

Looks like need to install the python development headers for python 2.7.

sudo apt-get install python-dev for ubuntu sudo yum install python-devel for fedora

— Reply to this email directly or view it on GitHub https://github.com/caseman/noise/issues/12#issuecomment-189739003.

Gnu-Bricoleur commented 8 years ago

Wow that was an amazingly fast answer ! You were right about the python-dev package and it explain why it worked on my PC and not on two fresh install of ubuntu. I didn't imagine that the Python.h folder was provided by the python development header and not by the library. However, it is strange that the header for python3 are installed (by default or as depency with pip3) on ubuntu and not the header for python2 whereas python2 is the default python compiler. Also, i have done few tests and it seems (i haven't test everything) that no librairy can be install using pip without the header so maybe i will signal this to the pip team. Thank again, brycepg for your help and caseman for your librairy. (I am not sure it is my job to close the issue but i'll did that and you'll correct me if i'am wrong :-) )

AidenWard13 commented 8 years ago

Hey! Hope you're still reading comments. I really like this noise module for being really fast.

I have my own script for noise, but since it's a .py script, it's not as fast. I have no choice really to use my own. Cause this noise library doesn't allow you to change the perm. (seed)

I've tried converting my .py to .pyd, and i succeeded. I made this tutorial immediately. https://www.youtube.com/watch?v=7UR8JXzfRR4 (It goes from .py to .c to .pyd)

But even after converting it to pyd, it didn't seem to speed up. You have a nice perlin noise script in c, but for some reason, my method of converting the code to .pyd didn't work with your .c script.

How do you convert .c to .pyd? It would really help me out.

And/or as an alternative, how do i seed your noise module? Thanks. -Aiden

brycepg commented 8 years ago

I'd recommend using 3d noise(if you are doing something 2d), and then using the z-axis as your seed. If you are doing something 3d, consider using 4d simplex noise and using the w axis as your seed. (that is only change that axis value when you want a different seed).

This thread is maybe not the best place to ask though

Cheers

AidenWard13 commented 8 years ago

thanks! to be honest, i didn't even think of that. as long as making it generate faster means using this module, and using 3d noise as 2d so i can seed it, then i guess that's what i'll do.

is a bit of a let down that he didn't include an argument in the noise classes to input your own perm...

overall, i just wish i knew how he generated his own .pyd file. it's just so fast compared to .py

if it's compiled right from pure c... not .py to .c to .pyd like i attempted...

i tried with his .c though, cause if it worked, i would have modded the module myself. but sadly i got a weird error saying: include/math.h:217: error: unknown constraint 't'

might just have to do some more googling on it. then if i figure that out, i can make another video. and update this 3 year old noise module...

anyway... thanks for replying so quickly!