Friday, August 23, 2013

[Errno 14] PYCURL ERROR 7 - epel repo install not working RHEL 64 bit



Solution:
I added

proxy=http://proxyHost:proxyPort/
proxy_username=myUsername
proxy_password=myPassword

to

vi /etc/yum.conf

and it worked.

Original error:

 sudo yum --enablerepo=epel install R
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
http://download.fedoraproject.org/pub/epel/6/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "Failed to connect to 2610:28:3090:3001:dead:beef:cafe:fed4: Network is unreachable"
Trying other mirror.


was fixed

Wednesday, August 21, 2013

How to install ox_Oracle in RHEL 64 bit and get it working

Ok this sucked... but it is done now and hopefully this helps one person somewhere, please comment if it does.

So this is the version of RHEL I am using when I call uname -or
2.6.32-358.el6.x86_64 GNU/Linux

I didn't know what version of Oracle was running and so rather than asking the DBA I just ran this SQL statement in my developer tool: "Select * from v$version;"

which told me 10.2.0.5. So then I went over to Oracle's website for 64bit drivers:

http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html  (select the license agreement and download to /tmp/)

and download the basic 10.2.04 rpm to my /tmp/ folder

cd /tmp/
rpm -ivh oracle-instantclient-basic-10.2.0.4-1.x86_64.rpm

after that was installed I needed to setup the environmental variables just right. If you don't do this your ox_Oracle install will fail silently and you will hit your head against the wall forever..

Tkae note your exact paths might be a little different so check them (incase you have a different version or didn't do the 64bit, etc..

echo export LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.4/client64/lib/ >> ~/.bashrc
echo export ORACLE_HOME=/usr/lib/oracle/10.2.0.4/client64 >> ~/.bashrc
echo export PATH=$ORACLE_HOME/bin:$PATH >> ~/.bashrc

This also throws them into the bashrc so they will be there next time. Now it is time to download the ox_Oracle RPM for python. For that go here: http://cx-oracle.sourceforge.net/

Even though I am using RHEL you can just use the CENTOS RPM. So pick your version of oracle and python. If you don't know your version of python run: python -V

wget http://downloads.sourceforge.net/project/cx-oracle/5.1/cx_Oracle-5.1-10g-py26-1.x86_64.rpm?r=http%3A%2F%2Fcx-oracle.sourceforge.net%2F&ts=1377121971&use_mirror=superb-dca2

Now install

rpm -ivh cx_Oracle-5.1-10g-py26-1.x86_64.rpm

Yay!! You did it! You are awesome! You saved hours and hours of time compared to everyone else that has tried this! Congrats, you are a genius, epic genius. Well... maybe... to really know if all of this is true try this:

python -c "import cx_Oracle"

If that works with no errors you did it! Now for some more robust testing try actually doing a simple select statement. Let's try the one we started with. Make a file called connect.py and put this in it.

vi connect.py

Once that opens then copy this in, and of course populate with your connection info. Then save.

import sys
import cx_Oracle

host='yourhostname'
sid='yourSID'
username='yourUserName'
password='yourPassWord'
dsn = cx_Oracle.makedsn(host, 1521, sid)
con = cx_Oracle.connect(username+'/'+password+'@' + dsn)
cur = con.cursor()

cur.execute('Select * from v$version')
for result in cur:
    print result
print con.version

cur.close()
con.close()
print "I am awesome!"

and test

python connect.py

Saturday, August 10, 2013

How to prevent parallel python from connecting to localhost

How to prevent parallel python from connecting to localhost How to exclude parallel python from using localhost To do this in your script that you are calling to kick of your jobs just set:

job_server = pp.Server(ncpus=0, ppservers=ppservers)

 By setting the number of CPUS to 0 you will not see anything startup and then you get something like this:


Starting pp with 0 workers
Sum of primes below 5 6 7 is node001
Sum of primes below 6 7 8 is node002
Sum of primes below 7 8 9 is node001
Sum of primes below 4 5 6 is node002
Sum of primes below 9 8 1 is node001
Sum of primes below 1 2 3 is node001
Sum of primes below 3 4 5 is node001
Sum of primes below 3 3 2 is node002
Job execution statistics:
Name:local
 job count | % of all jobs | job time sum | time per job | job server
         5 |         62.50 |       0.1804 |     0.036082 | node001:60000
         3 |         37.50 |       0.1753 |     0.058426 | node002:60000
Time elapsed since server creation 0.495481967926
0 active tasks, 0 cores


No localhost!