7

I am working on a compute server which runs a linux. The machine is used by several users so I don't have and won't get root privileges. I need to install Keras which you would normally do by using pip

Now, pip is not installed and the root won't install it for me either unless I beg him for probably a month or so. I tried to locally install pip with the python installation scrip Python352/bin/python3.5 get-pip.py --user

This unfortunately throws me an no permission error /etc. This is not exactly what I expected from installing the tool locally. Is it somehow possible to make an installation of pip that does not try to touch anything outside my local directory?

jww
  • 97,681
  • 90
  • 411
  • 885
toobee
  • 2,592
  • 4
  • 26
  • 35
  • 2
    Create a virtual environment and do your stuff within that – Moinuddin Quadri Nov 28 '16 at 19:46
  • 1
    Are you sure `pip` is not already installed? [Since 3.4, `pip` comes default with the binary installers of python](https://docs.python.org/3/installing/). – Anthon Nov 28 '16 at 19:54
  • I tried `python3.5 get-pip.py --user` using on my Linux Mint 17 system and did not get the permission error (as normal user without write rights on `/etc` and using 3.5.2) – Anthon Nov 28 '16 at 19:57
  • Then this might be some over-strict restriction on this shared system. I think they want to contain all user-tools in a folder than can simply deleted after some time when the user is inactive. – toobee Nov 28 '16 at 19:58
  • For installing pip, try: [How to install pip (python) to user without root access](http://askubuntu.com/questions/363300/how-to-install-pip-python-to-user-without-root-access) – Moinuddin Quadri Nov 28 '16 at 20:02
  • In your case, Anaconda is strongly recommended, which makes Python package management and virtual environment creation/switch a breeze. – pyan Nov 28 '16 at 20:51

3 Answers3

9

Here is the up-to-date version to install pip (python) to user without root access method:

wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py --user
yeah22
  • 420
  • 5
  • 12
Kashan
  • 906
  • 10
  • 15
5

I had the similar case as you and I chose the Anaconda. You can download Anaconda file from this page using wget. You will happily find the file to be a .sh file.

Use the following command to install Anaconda (for Python3):

bash ./Anaconda3-5.0.1-Linux-x86_64.sh

Use the following command to install other software (SOFTWARE_NAME) by pip:

anaconda3/bin/pip install SOFTWARE_NAME

Hope it could help you.

Tengerye
  • 1,796
  • 1
  • 23
  • 46
1

For installing pip as user without sudo access, check: How to install pip (python) to user without root access.


Also, you need a virtual environment and for that you may use virtualenv. As the virtual environment doc says:

A Virtual Environment is a tool to keep the dependencies required by different projects in separate places, by creating virtual Python environments for them. It solves the “Project X depends on version 1.x but, Project Y needs 4.x” dilemma, and keeps your global site-packages directory clean and manageable.

How it fits you?

  1. You don't need to be root, in order to use it
  2. You may install multiple versions of libraries in different virtual environment without worrying about the version conflicts.
  3. You need not to worry about the libraries you install to mess up with the configuration of the other users using the system
Community
  • 1
  • 1
Moinuddin Quadri
  • 46,825
  • 13
  • 96
  • 126
  • 3
    And how do you propose the OP installs `virtualenv`? Using `pip install virtualenv`? Without detailed instructions how to do that , this is just a repeat of your other comment, not an answer. – Anthon Nov 28 '16 at 19:51