how to install cx_oracle package with pip from Ubuntu linux?

3

I am trying to install cx_oracle from Ubuntu using pip install cx_oracle however I get the error below. Also tried to go to the pip package page and it does not look like there are any files associated to this package: https://pypi.python.org/pypi/cx_Oracle/5.1.2

Does this mean I have to install the package manually from http://cx-oracle.sourceforge.net with Alien?

  Downloading/unpacking cx-Oracle
      Downloading cx_Oracle-5.1.2.tar.gz
    Exception:
    Traceback (most recent call last):
      File "/home/develop1/virtualEnv2/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
        status = self.run(options, args)
      File "/home/develop1/virtualEnv2/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 245, in run
        requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
      File "/home/develop1/virtualEnv2/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 985, in prepare_files
        self.unpack_url(url, location, self.is_download)
      File "/home/develop1/virtualEnv2/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1109, in unpack_url
        retval = unpack_http_url(link, location, self.download_cache, self.download_dir)
      File "/home/develop1/virtualEnv2/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/download.py", line 456, in unpack_http_url
        unpack_file(temp_location, location, content_type, link)
      File "/home/develop1/virtualEnv2/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/util.py", line 494, in unpack_file
        untar_file(filename, location)
      File "/home/develop1/virtualEnv2/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/util.py", line 418, in untar_file
        tar = tarfile.open(filename, mode)
      File "/usr/lib/python2.7/tarfile.py", line 1678, in open
        return func(name, filemode, fileobj, **kwargs)
      File "/usr/lib/python2.7/tarfile.py", line 1729, in gzopen
        raise ReadError("not a gzip file")
    ReadError: not a gzip file

user465374

Posted 2013-04-12T13:59:20.727

Reputation: 83

Answers

5

It seems automatically downloaded file corrupted. That is why ReadError: not a zip file

To install cx_Oracle you also need instantclient from Oracle. If you want a easy way to install, i prepared a bundle some time ago python-cxoracle.

Just copy the files for your Ubuntu version and add instantclient to ld.so.conf

wget https://github.com/ozanturksever/python-cxoracle/archive/master.zip
unzip master.zip
cp -r python-cxoracle-master/12.04/* /
echo "/opt/instantclient_11_2" > /etc/ld.so.conf.d/oracleclient.conf
ldconfig

ozan.turksever

Posted 2013-04-12T13:59:20.727

Reputation: 66