some problems importing noise module



  • hey guys, hope everyone's doing well!
    im new to coding in drawbot, and was trying to experiment with the noise module. However, i have tried pip and git cloning (not sure if thats the proper terminology, sorry!) noise, and it comes with the error "ModuleNotFoundError: No module named 'noise' when i simply try to import noise.
    I have tried the following code below to try and "hack" it into working,

    import random, math, sys
     
    sys.path.append('/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/')
     
    import noise
    

    however it comes up with the error:

     "Traceback (most recent call last):
      File "weirdv061219.py", line 5, in <module>
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/noise/__init__.py", line 12, in <module>
    ImportError: cannot import name '_perlin'"
    

    I'm sure im doing something wrong here, just not even sure where to start. I apologize for generalness of this, I'm trying my best.



  • hello @rachelkriebel,

    from your error message it looks like you have installed noise for Python 3.7. but DrawBot currently uses Python 3.6, so it can’t find it.

    you can specify the version of Python when installing a package with pip:

    pip3.6 install noise

    give it a try! good luck



  • Hello,
    I'm having the exact same problem as @rachelkriebel
    I tried what @gferreira suggested but I couldn't make the command pip3.6 work. My terminal says:

    -bash: pip3.6: command not found
    

    Sorry if this is a silly question, I'm very new to python so my knowledge is still limited.
    Thanks in advance.



  • hello @burnier & everyone else with the same problem,

    • the latest version of Python is 3.7
    • DrawBot currently embeds Python 3.6

    if you recently installed “Python 3” from python.org, you probably have 3.7.

    to make modules available in DrawBot, they need to be installed for Python 3.6 (not 3.7).

    so, the first step is to make sure that you have Python 3.6 installed in your system. you can check that by typing python3.6 in Terminal. if you get -bash: python3.6: command not found, then you need to install Python 3.6 first. you can get it from python.org/downloads.

    pip is included in Python, so once you have Python 3.6 you should have pip3.6 too. please give it a try, and let us know how it goes… good luck!