oTree Forum >

How do i use Numpy on Heroku?

#1 by noob_forever

My project requires numpy. I can import this when running locally and everything works perfectly. However, the "import numpy as np" thing doesn't work when I upload my experiment to heroku. 

My question, is how can I use numpy when deploying my experiment thru Heroku? I found an older answer to this question, which was " add numpy to requirements.txt" but I don't know what requirements.txt is or how to add numpy to it. 


Any ideas?

#2 by Chris_oTree

Are you using oTree Studio or a text editor?

#3 by noob_forever

I am using oTreeStudio

#4 by Chris_oTree

OK I have added numpy to your your requirements.txt, so the next time you upload to Heroku it should work.

However, if you're able to avoid using numpy altogether that may be advantageous in the long run.

#5 by Chris_oTree

(Reason being that sometimes numpy datatypes clash with python's native data types and I have seen errors due to this.)

#6 by noob_forever

Chris -- perhaps this is what you meant -- I am now getting an error message indicating I have a lower bound of zero on a pair of variables that do not actually have a min value. Any idea what might be causing this?

#7 by Chris_oTree

If the min is something other than 0, specify it with min=-1000 or whatever it is.

#8 by noob_forever

Chris, this worked. I have no idea what caused the issue or why this worked, but I am grateful for the suggestion. 

Cheers.

Write a reply

Set forum username