installing cx_Oracle.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Carl K

    installing cx_Oracle.

    I am trying to use this:
    Gate is a leading provider of web hosting, domain names, exchange hosting and virtual private servers.

    it is a real module, right?

    sudo easy_install cx_Oracle did not easy_install cx_Oracle.

    http://www.python.org/pypi/cx_Oracle/4.3.1 doesn't give me any clue.

    I got the source from


    carl@dell17:~/a/cx_Oracle-4.3.1$ python setup.py build
    Traceback (most recent call last):
    File "setup.py", line 36, in ?
    oracleHome = os.environ["ORACLE_HOM E"]
    File "/usr/lib/python2.4/UserDict.py", line 17, in __getitem__
    def __getitem__(sel f, key): return self.data[key]
    KeyError: 'ORACLE_HOME'


    Now I don't really know whos problem this is.

    Carl K
  • Diez B. Roggisch

    #2
    Re: installing cx_Oracle.

    Carl K schrieb:
    I am trying to use this:
    Gate is a leading provider of web hosting, domain names, exchange hosting and virtual private servers.

    it is a real module, right?
    >
    sudo easy_install cx_Oracle did not easy_install cx_Oracle.
    >
    http://www.python.org/pypi/cx_Oracle/4.3.1 doesn't give me any clue.
    >
    I got the source from

    >
    >
    carl@dell17:~/a/cx_Oracle-4.3.1$ python setup.py build
    Traceback (most recent call last):
    File "setup.py", line 36, in ?
    oracleHome = os.environ["ORACLE_HOM E"]
    File "/usr/lib/python2.4/UserDict.py", line 17, in __getitem__
    def __getitem__(sel f, key): return self.data[key]
    KeyError: 'ORACLE_HOME'
    yours. because you need the oracle OCI with libs and header files
    installed + the environment variable ORACLE_HOME pointing to the
    installation.

    I suggest you download the appropriat oracle instant client for your system.

    Diez

    Comment

    • Carl K

      #3
      Re: installing cx_Oracle.

      Getting closer, thanks Bill and Diez.

      $ export ORACLE_HOME
      $ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
      $ python setup.py build
      $ sudo python setup.py install

      $ python -c "import cx_Oracle"
      Traceback (most recent call last):
      File "<string>", line 1, in ?
      ImportError: libclntsh.so.10 .1: cannot open shared object file: No such file or
      directory

      guessing I need to add
      /usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/
      to some path?

      btw - anyone know of a .deb that will install this?

      Carl K

      Comment

      • Bill Scherer

        #4
        Re: installing cx_Oracle.

        Carl K wrote:
        Getting closer, thanks Bill and Diez.
        >
        $ export ORACLE_HOME
        $ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
        $ python setup.py build
        $ sudo python setup.py install
        >
        $ python -c "import cx_Oracle"
        Traceback (most recent call last):
        File "<string>", line 1, in ?
        ImportError: libclntsh.so.10 .1: cannot open shared object file: No such file or
        directory
        >
        guessing I need to add
        /usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/
        to some path?
        >
        You can `export
        LD_LIBRARY_PATH =/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib`

        or (assuming a recent RedHat linux (or similar) now), put that path in a
        file, /etc/ld.so.conf.d/oracle.conf

        and run /sbin/ldconfig

        You'll find the latter operation to be persistent, and the former is not.
        btw - anyone know of a .deb that will install this?
        >
        Carl K
        >

        Comment

        • Carl K

          #5
          Re: installing cx_Oracle.

          Bill Scherer wrote:
          Carl K wrote:
          >Getting closer, thanks Bill and Diez.
          >>
          >$ export ORACLE_HOME
          >$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
          >$ python setup.py build
          >$ sudo python setup.py install
          >>
          >$ python -c "import cx_Oracle"
          >Traceback (most recent call last):
          > File "<string>", line 1, in ?
          >ImportError: libclntsh.so.10 .1: cannot open shared object file: No
          >such file or directory
          >>
          >guessing I need to add
          >/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/
          >to some path?
          >>
          You can `export
          LD_LIBRARY_PATH =/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib`
          >
          or (assuming a recent RedHat linux (or similar) now), put that path in a
          file, /etc/ld.so.conf.d/oracle.conf
          >
          and run /sbin/ldconfig
          >
          You'll find the latter operation to be persistent, and the former is not.
          >btw - anyone know of a .deb that will install this?
          >>
          >Carl K
          >>
          bingo.

          carl@dell17:~/a/cx_Oracle-4.3.1$ python
          Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
          [GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
          Type "help", "copyright" , "credits" or "license" for more information.
          >>import cx_Oracle
          >>connection = cx_Oracle.conne ct('testuserA', 'pw', 'nf55')
          >>cursor = connection.curs or()
          >>cursor.execut e("select * from tbl1")
          [<cx_Oracle.NUMB ER with value None>, <cx_Oracle.FIXE D_CHAR with value None>,
          <cx_Oracle.NUMB ER with value None>]
          >>rows=cursor.f etchall()
          >>rows
          [(1, 'a ', 1.01), (2, 'a ', 1.02), (3, 'a ', 1.03)]

          Thanks - now I can get to the real problem: client side join/order by :)

          But I have already done it in MySql, so this should be the easy part...

          Thanks again.

          Carl K

          Comment

          • Steve Holden

            #6
            Re: installing cx_Oracle.

            Dennis Lee Bieber wrote:
            On Thu, 24 May 2007 09:07:07 -0500, Carl K <carl@personnel ware.com>
            declaimed the following in comp.lang.pytho n:
            >
            >Getting closer, thanks Bill and Diez.
            >>
            >$ export ORACLE_HOME
            >$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
            >
            Don't those lines need to be reversed? Set the variable in the
            current shell, and /then/ export it?
            Modern shells actually allow the single statement

            export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client

            regards
            Steve
            --
            Steve Holden +1 571 484 6266 +1 800 494 3119
            Holden Web LLC/Ltd http://www.holdenweb.com
            Skype: holdenweb http://del.icio.us/steve.holden
            ------------------ Asciimercial ---------------------
            Get on the web: Blog, lens and tag your way to fame!!
            holdenweb.blogs pot.com squidoo.com/pythonology
            tagged items: del.icio.us/steve.holden/python
            All these services currently offer free registration!
            -------------- Thank You for Reading ----------------

            Comment

            • Carl K

              #7
              Re: installing cx_Oracle.

              Dennis Lee Bieber wrote:
              On Thu, 24 May 2007 09:07:07 -0500, Carl K <carl@personnel ware.com>
              declaimed the following in comp.lang.pytho n:
              >
              >Getting closer, thanks Bill and Diez.
              >>
              >$ export ORACLE_HOME
              >$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
              >
              Don't those lines need to be reversed? Set the variable in the
              current shell, and /then/ export it?
              whoops - I may have cut/pasted too fast.

              Carl K

              Comment

              • Carsten Haese

                #8
                Re: installing cx_Oracle.

                On Thu, 2007-05-24 at 16:15 +0000, Dennis Lee Bieber wrote:
                On Thu, 24 May 2007 09:07:07 -0500, Carl K <carl@personnel ware.com>
                declaimed the following in comp.lang.pytho n:
                >
                Getting closer, thanks Bill and Diez.

                $ export ORACLE_HOME
                $ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
                >
                Don't those lines need to be reversed? Set the variable in the
                current shell, and /then/ export it?
                It also works the other way around, at least on the non-empty set of
                systems that contains my workstation. export simply marks the variable
                name for automatic export to the environment of subsequent commands. The
                value at that time doesn't matter. What matters is the value that the
                name has at the time the command is run:

                [carsten@dot ~]$ export FOOD
                [carsten@dot ~]$ FOOD=spam
                [carsten@dot ~]$ python -c "import os; print os.environ['FOOD']"
                spam
                [carsten@dot ~]$ FOOD=eggs
                [carsten@dot ~]$ python -c "import os; print os.environ['FOOD']"
                eggs

                Regards,

                --
                Carsten Haese



                Comment

                Working...