การลง neo4j-python ใน ubuntu 10.04

อย่างแรก คือตอนนี้ผมใช้ ubuntu 10.04 แต่ต้องใช้ neo4j เพราะว่าใช้ใน thesis
เลยจะลงตัว neo4j-python ซึ่งเป็นตัว binding

ตัว neo4j เป็น graph database ตัวหนึ่งที่ opensource ให้ใช้ฟรี แบบ GFPL
ซึ่งอาจจะเรียกว่า เป็น nosql ตัวหนึ่ง ความพิเศษตรงที่มัน bindng python นี่ล่ะครับ
เพราะผมต้องการใช้ร่วมกับ django แถมมันมีตัวอย่าง app ที่สร้าง model ให้ โดยไม่ต้องแก้อะไรมาก
เปลี่ยนตรง model แทน เอาไว้พอคล่องเดี๋ยวคงมาเขียนบล็อก

เริ่มต้นเลย คือ เนื่องจากมันเป็น java ที่ binding มาครับ เลยต้องใช้ตัว binnding ทีแรกลง jython
แต่ใน ubuntu ลงไม่ได้ เพราะเป็นรุ่นเก่า 2.2 เลยต้องดึงมาจาก debian sid แทน

พอลงปุ้บ ก็เจอปัญหาเลย

  1. sake@sake-laptop:~/project/Thesis/tools$ svn export https://svn.neo4j.org/components/neo4j.py/trunk neo4j-python
  2. sake@sake-laptop:~/project/Thesis/tools/neo4j-python$ cd neo4j-python
  3. sake@sake-laptop:~/project/Thesis/tools/neo4j-python$ sudo jython setup.py install
  4. setup.py:54: UserWarning: Setuptools is not available.
  5. You will need to make sure that you either have JCC installed prior to
  6. installing Neo4j.py, or that you have JPype installed alongside with
  7. Neo4j.py. With setuptools these could have been automatically installed.
  8.  
  9.   warnings.warn("""Setuptools is not available.
  10. Traceback (most recent call last):
  11.   File "setup.py", line 146, in <module>
  12.     main()
  13.   File "setup.py", line 134, in main
  14.     args[attr] = pom[attr]
  15.   File "/home/sake/project/Thesis/tools/neo4j-python/pom.py", line 59, in __getitem__
  16.     return self.pattern.sub(lambda match:self[match.groupdict()['var']],
  17.   File "/home/sake/project/Thesis/tools/neo4j-python/pom.py", line 59, in <lambda>
  18.     return self.pattern.sub(lambda match:self[match.groupdict()['var']],
  19.   File "/home/sake/project/Thesis/tools/neo4j-python/pom.py", line 54, in __getitem__
  20.     element = self.parent[path]
  21.   File "/home/sake/project/Thesis/tools/neo4j-python/pom.py", line 93, in __getitem__
  22.     return replacement.get(path, lambda s,x:x)(self, self.__pom[path])
  23.   File "/home/sake/project/Thesis/tools/neo4j-python/pom.py", line 58, in __getitem__
  24.     raise KeyError(path)
  25. KeyError: 'project.artifactId'
  26. sake@sake-laptop:~/project/Thesis/tools/neo4j-python$

หลังจากงมอยู่นาน ก็พบว่าต้องไปแก้ในไฟล์ pom.py ดังนี้ครับ

  1.         if element is None and self.parent is not None:
  2.             element = self.parent[path]
  3.         if element is None:  # added
  4.                 element = self.tree.findtext(self.__path('dependencies'))  # added
  5.         if element is None:
  6.             raise KeyError(path)
  7.         return self.pattern.sub(lambda match:self[match.groupdict()['var']],
  8.                                 element)

จากนั้น ก็ลงได้แล้ว

  1. sake@sake-laptop:~/project/Thesis/tools/neo4j-python$ sudo jython setup.py install
  2. setup.py:54: UserWarning: Setuptools is not available.
  3. You will need to make sure that you either have JCC installed prior to
  4. installing Neo4j.py, or that you have JPype installed alongside with
  5. Neo4j.py. With setuptools these could have been automatically installed.
  6.  
  7.   warnings.warn("""Setuptools is not available.
  8. running install
  9. running build
  10. running build_py
  11. package init file 'dependencies/__init__.py' not found (or not a regular file)
  12. copying dependencies/geronimo-jta_1.1_spec.jar -> build/lib/neo4j/classes
  13. copying dependencies/junit.jar -> build/lib/neo4j/classes
  14. package init file 'dependencies/__init__.py' not found (or not a regular file)
  15. running install_lib
  16. creating /usr/share/jython/Lib/site-packages/neo4j
  17. copying build/lib/neo4j/_index.py -> /usr/share/jython/Lib/site-packages/neo4j
  18. creating /usr/share/jython/Lib/site-packages/neo4j/_backend
  19. copying build/lib/neo4j/_backend/reflection.py -> /usr/share/jython/Lib/site-packages/neo4j/_backend
  20. copying build/lib/neo4j/_backend/jcc.py -> /usr/share/jython/Lib/site-packages/neo4j/_backend
  21. copying build/lib/neo4j/_backend/cli.py -> /usr/share/jython/Lib/site-packages/neo4j/_backend
  22. copying build/lib/neo4j/_backend/__init__.py -> /usr/share/jython/Lib/site-packages/neo4j/_backend
  23. copying build/lib/neo4j/_backend/pure.py -> /usr/share/jython/Lib/site-packages/neo4j/_backend
  24. copying build/lib/neo4j/_backend/native.py -> /usr/share/jython/Lib/site-packages/neo4j/_backend
  25. copying build/lib/neo4j/tracsupport.py -> /usr/share/jython/Lib/site-packages/neo4j
  26. copying build/lib/neo4j/__bootstrap__.py -> /usr/share/jython/Lib/site-packages/neo4j
  27. copying build/lib/neo4j/_util.py -> /usr/share/jython/Lib/site-packages/neo4j
  28. creating /usr/share/jython/Lib/site-packages/neo4j/model
  29. copying build/lib/neo4j/model/__init__.py -> /usr/share/jython/Lib/site-packages/neo4j/model
  30. copying build/lib/neo4j/_py_compat.py -> /usr/share/jython/Lib/site-packages/neo4j
  31. creating /usr/share/jython/Lib/site-packages/neo4j/_hooks
  32. copying build/lib/neo4j/_hooks/__init__.py -> /usr/share/jython/Lib/site-packages/neo4j/_hooks
  33. copying build/lib/neo4j/util.py -> /usr/share/jython/Lib/site-packages/neo4j
  34. copying build/lib/neo4j/_traverse.py -> /usr/share/jython/Lib/site-packages/neo4j
  35. copying build/lib/neo4j/__init__.py -> /usr/share/jython/Lib/site-packages/neo4j
  36. copying build/lib/neo4j/_core.py -> /usr/share/jython/Lib/site-packages/neo4j
  37. creating /usr/share/jython/Lib/site-packages/neo4j/classes
  38. copying build/lib/neo4j/classes/neo4j-kernel.jar -> /usr/share/jython/Lib/site-packages/neo4j/classes
  39. copying build/lib/neo4j/classes/junit.jar -> /usr/share/jython/Lib/site-packages/neo4j/classes
  40. copying build/lib/neo4j/classes/neo4j-index.jar -> /usr/share/jython/Lib/site-packages/neo4j/classes
  41. copying build/lib/neo4j/classes/neo4j-commons.jar -> /usr/share/jython/Lib/site-packages/neo4j/classes
  42. copying build/lib/neo4j/classes/lucene-core.jar -> /usr/share/jython/Lib/site-packages/neo4j/classes
  43. copying build/lib/neo4j/classes/geronimo-jta_1.1_spec.jar -> /usr/share/jython/Lib/site-packages/neo4j/classes
  44. copying build/lib/neo4j/classes/neo4j-remote-graphdb.jar -> /usr/share/jython/Lib/site-packages/neo4j/classes
  45. copying build/lib/neo4j/_base.py -> /usr/share/jython/Lib/site-packages/neo4j
  46. copying build/lib/neo4j/_primitives.py -> /usr/share/jython/Lib/site-packages/neo4j
  47. copying build/lib/neo4j/_compat.py -> /usr/share/jython/Lib/site-packages/neo4j
  48. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_index.py to _index$py.class
  49. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_backend/reflection.py to reflection$py.class
  50. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_backend/jcc.py to jcc$py.class
  51. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_backend/cli.py to cli$py.class
  52. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_backend/__init__.py to __init__$py.class
  53. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_backend/pure.py to pure$py.class
  54. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_backend/native.py to native$py.class
  55. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/tracsupport.py to tracsupport$py.class
  56. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/__bootstrap__.py to __bootstrap__$py.class
  57. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_util.py to _util$py.class
  58. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/model/__init__.py to __init__$py.class
  59. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_py_compat.py to _py_compat$py.class
  60. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_hooks/__init__.py to __init__$py.class
  61. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/util.py to util$py.class
  62. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_traverse.py to _traverse$py.class
  63. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/__init__.py to __init__$py.class
  64. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_core.py to _core$py.class
  65. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_base.py to _base$py.class
  66. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_primitives.py to _primitives$py.class
  67. byte-compiling /usr/share/jython/Lib/site-packages/neo4j/_compat.py to _compat$py.class
  68. running install_egg_info
  69. Writing /usr/share/jython/Lib/site-packages/Neo4j.py-0.1_SNAPSHOT-py2.5.egg-info
  70. sake@sake-laptop:~/project/Thesis/tools/neo4j-python$

เย้ ๆ ใช้ได้แล้ว ^^

เพิ่มเติม:
http://components.neo4j.org/neo4j.py/

AttachmentSize
Plain text icon pom.py.txt6.38 KB