p5py / p5

p5 is a Python package based on the core ideas of Processing.
https://p5.readthedocs.io
GNU General Public License v3.0
730 stars 120 forks source link

run() gives error 'module' object has no attribute 'isclose' #84

Closed timo-mart closed 5 years ago

timo-mart commented 5 years ago

Describe the bug I cant run sketches because at run() the program gives an error:

Exception has occurred: AttributeError
'module' object has no attribute 'isclose'

I think I have installed GLFW correctly since I don't get error at from p5 import * anymore

dbhavsar76 commented 5 years ago

@timo-mart Please provide a test script or a sketch that you tried to run and gave the error.

timo-mart commented 5 years ago

This happens with any script. I've used one of the example sketches:

from p5 import *

def setup():
  size(640, 360)
  no_stroke()
  background(204)

def draw():
  if mouse_is_pressed:
    fill(random_uniform(255), random_uniform(127), random_uniform(51), 127)
  else:
    fill(255, 15)

circle_size = random_uniform(low=10, high=80)

circle((mouse_x, mouse_y), circle_size)

def key_pressed(event):
  background(204)

run()

as well as a pretty much blank sketch:

from p5 import *

def setup():
  size(500, 500)

def draw():
  background(204)

run()
dbhavsar76 commented 5 years ago

then, can you provide full error log with traceback? And also which os you are running and python version too.

redfood commented 5 years ago

I believe I saw this error. math.isclose() was added in python 3.5. For me, upgrading from 3.4 to a newer version of python fixed the problem.

abhikpal commented 5 years ago

math.isclose() was added in python 3.5.

Correct. If there's a need we can find a way around this, but for now I'll just mark this as closed. @dbhavsar76, thanks for helping sort this out!