Link to home
Start Free TrialLog in
Avatar of Phazz
Phazz

asked on

How to install python packages nympy and pylab on linux without root permissions?

I am a Python newbie, who need to prepare the python framework to run a python program on a linux machine on which I don't have root permissions. The program is known to work on python 2.6. The system python version in /user/bin/python is older (2.4).

So I have downloaded and built python 2.6 from source and installed it in /home/web/tools/ where I have permissions:
configure --prefix=/home/web/tools; make; make install

Now, the problem is that the python program depends on (imports) the numpy and pylab packages (and whatever they may depend on as well). How to do this in a clean and standard way without root permissions?
Avatar of farzanj
farzanj
Flag of Canada image

For all the standard installs, you definitely need root permissions either doing su - or sudo su - .

What kind of Linux is it?  RedHat/CentOS/SL or Ubuntu/Debian etc?

You will have to first install the missing packages and install python.
Avatar of Phazz
Phazz

ASKER

Scientific Linux SL release 5.4, it is a Linux distribution based on Red Hat Enterprise Linux.

OK, first step is to install python 2.6.7 (like shown above). It gives some crypic error messages, but it is actually installed and I can start it. Can I ignore the error messages ?

** WARNING: renaming "readline" since importing it failed: /usr/lib64/libreadline.so.5: undefined symbol: PC

Failed to find the necessary bits to build these modules:
_bsddb             _curses            _curses_panel  
_hashlib           _sqlite3           _ssl            
_tkinter           bsddb185           bz2            
dbm                dl                 gdbm            
imageop            sunaudiodev                        
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


Failed to build these modules:
readline    
SOLUTION
Avatar of gelonida
gelonida
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Did you try:

yum upgrade python
Avatar of Phazz

ASKER

I tired it now:

yum upgrade python
Loaded plugins: kernel-module
You need to be root to perform this command.
Of course, you will need to be root no matter how you try to install.  In Linux, it a very bad idea trying to install as a common user.  If you don't own the machine, you may not even have good enough space to do so and I don't think the System Admin would appreciate you loading binaries on a user account.
Farzanji.

You don't have to be root to install python and all packages.
However it is much more work than not being root.
gelonida,

Theoretically you don't.  But it is an extremely bad practice to install in an unusual location.  There are situations when you are building RPM packages and testing installs and you don't want to corrupt that machine, you do things like this but I would never recommend something that could potentially put someone in trouble with the admin.  I have managed 3,000-10,000 servers in multiple companies and policies about installs are typically similar.  No admin would like this to happen in his machine.I
Avatar of Phazz

ASKER

You're right. And it's far more complex than I imagined anyway.

The simplest would probably be if I could get the python script to work with the system python version (2.4). Now, excuse me if the following is a stupid question. What about the packages the script is importing (numpy, pylab); can they be in located in user space, or must I convince the Adm to install them in system space?
farzanj.

Depending on the company you are working for, the company policies  and the goodwill /
lazyiness of the admin some bizarre setups show up.

What I agree though  is, that you should ask the admins what they prefers.

- Installing the entire python for you (with all modules like numpy)

- Install
    - basic python, virtualenv and loads of source modules
    - let you compile pyton packages in your virtualenv

- let you install everything by yourself in non custom paths
Python 2.4 is really old.

You will have loads of trouble finding all the packages.

From python 2.5 on things are already much better.

Couldn't you get a virtual machine installed for you (where you have root privileges???)
or run everything on a Windows PC? (where you have privileges to install software)
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Phazz

ASKER

Thanks for your help so far, I'll talk to admin next week .... have a nice weekend!
@farzanj I apologize if I seemed rude in any way. You provided many valid contributions to this thread and in no way did I intend to imply that you don't have any ideas.

I focused more on what's technically possible (virtualenv, etc) you focused more on whether it is really a smart idea to do what I suggested.
Further you gave information about Redhat, which I used last many years ago.

All this are important considerations.
@gelonida: Thanks for a nice gesture.  I am really getting rusty on my Python (used until 2000), maybe I can use your help there.

Have a wonderful weekend!
Avatar of Phazz

ASKER

Eventually I managed to get the python program running with the system python in /user/bin/python (2.4).

I'm accepting both of your solutions, although I tend to agree the most with farzanj; things stay simple if I don't start messing with non-system python installations. On the other hand, I guess it could have been necessary in the rare case of a really lazy and grumpy admin ;)

I have the impression that python version compatibility is problematic?