Upgrading Python version ubuntu 14.04

Is there a supported way to upgrade the version of pypy from python 2.7.6 to python 2.7.13 after zato is installed?

Hi @samuel.rose,

do you mean to upgrade Python rather than PyPy? We do not depend on PyPy in the core package? If it is Python, what OS it is under?

Thanks.

Thanks for the response @dsuch

In the package install in 2.0.7 it appears that there is a binary placed at /bin/py

For some reason I thought this was actually a pypy binary. The operating system is ubuntu trusty 14.04

But it looks like you are saying to just upgrade the python in the operating system itself?

That’s an interesting question, I’ve never needed to do it myself.

Updating the system-wide Python version is definitely the first step, next would be to run ./bin/buildout that will update ./bin/python binary.

As for ./bin/py - this is a wrapper that constructs PYTHONPATH with all dependencies and then forwards control to the very ./bin/python command.

In my case, I was needing to use the “bolt” protocol over TLS, which purportedly only works with Python 2.7.9 and newer as part of the python driver for neo4j

https://neo4j.com/docs/api/python-driver/current/_modules/neo4j/v1/security.html

Thanks @dsuch I will try the system wide upgrade

If anyone else stumbles across this I also realized I can just I stall zato on ubuntu 16.04 LTS and it uses Python 2.7.12 by default

(Apparently it is not recommended to update system wide Python in ubuntu 14.04 as packages etc depend on this. But ymmv)

Confirmed today that using xenial solved all issues, left me with python 2.7.12

Here is zato 2.0.7 communicating with neo4j!

2017-07-03 16:12:07,492 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - ~~ [CONNECT] (’’, 24786)
2017-07-03 16:12:07,539 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - ~~ [SECURE]
2017-07-03 16:12:07,618 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - C: [HANDSHAKE] 0x6060B017 [1, 0, 0, 0]
2017-07-03 16:12:07,652 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - S: [HANDSHAKE] 1
2017-07-03 16:12:07,653 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - C: INIT (u’neo4j-python/1.4.0’, {…})
2017-07-03 16:12:07,691 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - S: SUCCESS ({u’server’: u’Neo4j/3.1.4’})
2017-07-03 16:12:07,759 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - C: RUN (u’CREATE (a:Person {name: {name}, title: {title}})’, {u’name’: ‘Arthur’, u’title’: ‘King’})
2017-07-03 16:12:07,760 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - C: PULL_ALL ()
2017-07-03 16:12:07,812 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - S: SUCCESS ({u’fields’: [], u’result_available_after’: 2})
2017-07-03 16:12:07,813 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - C: RUN (u’MATCH (a:Person) WHERE a.name = {name} RETURN a.name AS name, a.title AS title’, {u’name’: ‘Arthur’})
2017-07-03 16:12:07,813 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - C: PULL_ALL ()
2017-07-03 16:12:07,813 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - S: SUCCESS ({u’type’: u’w’, u’stats’: {u’labels-added’: 1, u’nodes-created’: 1, u’properties-set’: 2}, u’result_consumed_after’: 0})
2017-07-03 16:12:07,853 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - S: SUCCESS ({u’fields’: [u’name’, u’title’], u’result_available_after’: 1})
2017-07-03 16:12:07,853 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - S: RECORD * 1
2017-07-03 16:12:07,853 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - S: SUCCESS ({u’type’: u’r’, u’result_consumed_after’: 0})
2017-07-03 16:12:07,854 - INFO - 29133:Dummy-605 - neoex.my-service:22 - King Arthur
2017-07-03 16:12:07,854 - INFO - 29133:Dummy-605 - neo4j.bolt:22 - ~~ [CLOSE]

Thanks Sam, I never realized that there were Python packages depending on exact 2.7.x sub-releases.

Nice job with Neo4j - are you communicating with it through outgoing HTTP connections?

@dsuch yes usually sub releases are not a common show stopping factor. It turns out that the “bolt://” protocol in TLS is only supported in python 2.7.9 and above.

In the case of the example above, I am communicating with neo4j over the “bolt://” protocol after pip install neo4j-driver on the system wide python 2.7.12 in xenial

Then, my service to test it looks like

from neo4j.v1 import GraphDatabase, basic_auth

from zato.server.service import Service

class MyService(Service):
  def handle(self):
    driver = GraphDatabase.driver("bolt://myneo4jdomain.com:24786", auth=basic_auth("user", "pass"))
    session = driver.session()

    session.run("CREATE (a:Person {name: {name}, title: {title}})",
      {"name": "Arthur", "title": "King"})

    result = session.run("MATCH (a:Person) WHERE a.name = {name} "
                   "RETURN a.name AS name, a.title AS title",
                   {"name": "Arthur"})
    for record in result:
       item = "%s %s" % (record["title"], record["name"])
       self.logger.info(item)
    session.close()

It turns out the bolt protocol is generally faster than HTTP/REST service in transacting with neo4j

https://boltprotocol.org/

I had not been exposed to bolt until trying this out.