Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with python 3.5 #9

Open
smartinsightsfromdata opened this issue Feb 13, 2017 · 2 comments
Open

Problem with python 3.5 #9

smartinsightsfromdata opened this issue Feb 13, 2017 · 2 comments

Comments

@smartinsightsfromdata
Copy link

Trying to port the demo notebook to python 3.5 (Anaconda on Apple Mac)

from pymldb import Connection
mldb = Connection()
from urllib.request import urlopen  # changed original urllib2 to this
import pandas as pd, numpy as np, matplotlib.pyplot as plt
from matplotlib.offsetbox import TextArea, DrawingArea, OffsetImage, AnnotationBbox
from matplotlib._png import read_png
%matplotlib inline
prefix = "http://public.mldb.ai/datasets/dataset-builder"

print( mldb.put("/v1/procedures/embedded_images", {        # added parenthesis
    "type": "import.text",
    "params": {
        "dataFileUrl": prefix + "/cache/dataset_creator_embedding_realestate.csv.gz",
        "outputDataset": {
                "id": "embedded_images_realestate",
                "type": "embedding"
            },
        "select": "* EXCLUDING(rowName)",
        "named": "rowName",
        "runOnCreation": True
    }
}) 
     )

This is the error I get:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/Users/e/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    384             try:  # Python 2.7, use buffering of HTTP responses
--> 385                 httplib_response = conn.getresponse(buffering=True)
    386             except TypeError:  # Python 2.6 and older

TypeError: getresponse() got an unexpected keyword argument 'buffering'

During handling of the above exception, another exception occurred:

RemoteDisconnected                        Traceback (most recent call last)
/Users/e/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, **response_kw)
    577                                                   body=body, headers=headers,
--> 578                                                   chunked=chunked)
    579 

/Users/e/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    386             except TypeError:  # Python 2.6 and older
--> 387                 httplib_response = conn.getresponse()
    388         except (SocketTimeout, BaseSSLError, SocketError) as e:

/Users/e/anaconda3/lib/python3.5/http/client.py in getresponse(self)
   1196             try:
-> 1197                 response.begin()
   1198             except ConnectionError:

/Users/e/anaconda3/lib/python3.5/http/client.py in begin(self)
    296         while True:
--> 297             version, status, reason = self._read_status()
    298             if status != CONTINUE:

/Users/e/anaconda3/lib/python3.5/http/client.py in _read_status(self)
    265             # sending a valid response.
--> 266             raise RemoteDisconnected("Remote end closed connection without"
    267                                      " response")

RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

ProtocolError                             Traceback (most recent call last)
/Users/e/anaconda3/lib/python3.5/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    402                     retries=self.max_retries,
--> 403                     timeout=timeout
    404                 )

/Users/e/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, **response_kw)
    622             retries = retries.increment(method, url, error=e, _pool=self,
--> 623                                         _stacktrace=sys.exc_info()[2])
    624             retries.sleep()

/Users/e/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
    254             if read is False:
--> 255                 raise six.reraise(type(error), error, _stacktrace)
    256             elif read is not None:

/Users/e/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/packages/six.py in reraise(tp, value, tb)
    308         if value.__traceback__ is not tb:
--> 309             raise value.with_traceback(tb)
    310         raise value

/Users/e/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, **response_kw)
    577                                                   body=body, headers=headers,
--> 578                                                   chunked=chunked)
    579 

/Users/e/anaconda3/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    386             except TypeError:  # Python 2.6 and older
--> 387                 httplib_response = conn.getresponse()
    388         except (SocketTimeout, BaseSSLError, SocketError) as e:

/Users/e/anaconda3/lib/python3.5/http/client.py in getresponse(self)
   1196             try:
-> 1197                 response.begin()
   1198             except ConnectionError:

/Users/e/anaconda3/lib/python3.5/http/client.py in begin(self)
    296         while True:
--> 297             version, status, reason = self._read_status()
    298             if status != CONTINUE:

/Users/e/anaconda3/lib/python3.5/http/client.py in _read_status(self)
    265             # sending a valid response.
--> 266             raise RemoteDisconnected("Remote end closed connection without"
    267                                      " response")

ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

During handling of the above exception, another exception occurred:

ConnectionError                           Traceback (most recent call last)
<ipython-input-9-841a388121c0> in <module>()
     11         "select": "* EXCLUDING(rowName)",
     12         "named": "rowName",
---> 13         "runOnCreation": True
     14     }
     15 }) 

/Users/e/anaconda3/lib/python3.5/site-packages/pymldb/__init__.py in inner(*args, **kwargs)
     19 def decorate_response(fn):
     20     def inner(*args, **kwargs):
---> 21         result = add_repr_html_to_response(fn(*args, **kwargs))
     22         if result.status_code < 200 or result.status_code >= 400:
     23             raise ResourceError(result)

/Users/e/anaconda3/lib/python3.5/site-packages/pymldb/__init__.py in put(self, url, payload)
     62         if payload is None:
     63             payload = {}
---> 64         return requests.put(self.uri + url, json=payload)
     65 
     66     @decorate_response

/Users/e/anaconda3/lib/python3.5/site-packages/requests/api.py in put(url, data, **kwargs)
    122     """
    123 
--> 124     return request('put', url, data=data, **kwargs)
    125 
    126 

/Users/e/anaconda3/lib/python3.5/site-packages/requests/api.py in request(method, url, **kwargs)
     55     # cases, and look like a memory leak in others.
     56     with sessions.Session() as session:
---> 57         return session.request(method=method, url=url, **kwargs)
     58 
     59 

/Users/e/anaconda3/lib/python3.5/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    473         }
    474         send_kwargs.update(settings)
--> 475         resp = self.send(prep, **send_kwargs)
    476 
    477         return resp

/Users/e/anaconda3/lib/python3.5/site-packages/requests/sessions.py in send(self, request, **kwargs)
    583 
    584         # Send the request
--> 585         r = adapter.send(request, **kwargs)
    586 
    587         # Total elapsed time of the request (approximately)

/Users/e/anaconda3/lib/python3.5/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    451 
    452         except (ProtocolError, socket.error) as err:
--> 453             raise ConnectionError(err, request=request)
    454 
    455         except MaxRetryError as e:

ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

Please note that I can download the data from the browser at http://public.mldb.ai/datasets/dataset-builder/cache/dataset_creator_embedding_realestate.csv.gz

@chr0n1x
Copy link

chr0n1x commented Jul 15, 2019

just hit this too. this entire lib is not compat. with 3.x

@chr0n1x
Copy link

chr0n1x commented Jul 29, 2019

Have no idea if this helps, but using the docker python:3.5-alpine image I was able to run my own fork. Only change was this chr0n1x@c86e819

I've installed both pandas & numpy on there. Not sure if this package implicitly needs anything in those two packages.

So far I've been able to mldb.put & mldb.get. Might be a bunch of issues that I don't see though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants