gl.deploy.ec2_cluster.create on pythoh 3.4

User 5212 | 5/20/2016, 1:37:29 PM

Executing the following on OS X with python 3.4

import graphlab as gl ec2_config = gl.deploy.Ec2Config() ec2_cluster = gl.deploy.ec2_cluster.create('Test Cluster', 's3://j2-graphlab/', ec2_config)

Gives the following error:

` /Users/samuelhopkins/.virtualenvs/wrangle/lib/python3.4/site-packages/graphlab/connect/aws/ec2.py in ec2factory(instancetype, region, availabilityzone, CIDRrule, securitygroupname, tags, userdata, credentials, amiserviceparameters, numhosts, additionalporttoopen, producttype, subnetid, securitygroupid) 454 except Exception as e: 455 # import pdb; pdb.settrace() --> 456 raise Exception('Unable to successfully retrieve correct EC2 image to launch for this ' 457 'version. This could be a temporary problem. Please try again in a few ' 458 'minutes. If the problem persists visit https://dato.com/support for support options.')

Exception: Unable to successfully retrieve correct EC2 image to launch for this version. This could be a temporary problem. Please try again in a few minutes. If the problem persists visit https://dato.com/support for support options. `

Which seems to be caused by config.graphlab_server being an empty string when constructing json_blob_url in the same file:

` jsonblobpath = JSONBLOBPATHFORMAT % (instancetype, graphlab.version, region, productkey) for (paramname, paramvalue) in amiserviceparameters.items(): jsonblobpath += "&%s=%s" % (str(paramname), str(paramvalue)) jsonbloburl = config.graphlabserver + jsonblobpath

    try:
        # set specific timeout for this web service request, lots of time spent in SSL negotiation
        # for staging server allows a little more time
        timeout_in_seconds = 10 if config.mode == 'PROD' else 60
        graphlab_server_response = urllib2.urlopen(json_blob_url, timeout=timeout_in_seconds)

        json_blob = json.loads(graphlab_server_response.read())
    except Exception as e:

`

In graphlab.config.util.py the import of graphlab_env is done as follows

` try: import graphlabenv except ImportError: self.graphlabserver = '' self.mode = 'UNIT' self.metrics_url = ''

`

The import of graphlab_env causes an import error. I'm not really sure why there is a try, except around this section because in same directory, there is a file called graphlab_env.py. I think that this import works under python 2 but not python 3 because if I change it to:

` try: from . import graphlabenv except ImportError: self.graphlabserver = '' self.mode = 'UNIT' self.metrics_url = ''

`

everything works fine. Once I make this change I still get the same exception (because of the generic exception handling in _ec2.py even though the exception is now different:

` try: # set specific timeout for this web service request, lots of time spent in SSL negotiation # for staging server allows a little more time timeoutinseconds = 10 if config.mode == 'PROD' else 60 graphlabserverresponse = urllib2.urlopen(jsonbloburl, timeout=timeoutinseconds) jsonblob = json.loads(graphlabserver_response.read()) except Exception as e: print(e)

The above print statement I added shows the following: the JSON object must be str, not 'bytes' `

A small refactor to use requests instead of urllib2 (which is python 2 and python 3 compatible BTW) and it seems to work:

try: # set specific timeout for this web service request, lots of time spent in SSL negotiation # for staging server allows a little more time timeout_in_seconds = 10 if config.mode == 'PROD' else 60 graphlab_server_response = urMarkdown�I�M! ��7# ++����FYI: If you are using Anaconda and having problems with NumPyHello everyone,

I ran into an issue a few days ago and found out something that may be affecting many GraphLab users who use

Comments

User 16 | 5/20/2016, 6:50:26 PM

Hi Sam -

GraphLab Create is currently in beta for Python 3.4. Dato Distributed (i.e. creating an EC2 cluster for jobs) currently does not support Python 3.4.

Having Dato Distributed support Python 3.4 (and 3.5) is on our roadmap, but we're not there yet. What you're trying to do will work in Python 2.7.

Sorry for the inconvenience.

Toby


User 5212 | 5/21/2016, 7:28:37 AM

I see. Maybe it could throw an error with the appropriate message?

Also, is there a way to contribute to the code? The refactors I made probably make sense to go into the code base and I would be willing to do more (particularly the generic exception handling in _ec2.py).


User 16 | 5/23/2016, 6:16:02 PM

Our core technology, SFrame is open source (https://github.com/dato-code/SFrame), but Dato Distributed is not open source. So contributing is not possible.

Thanks for you feedback about the error message. I agree we should do better here. I've open up an internal issue and will get this resolved.