0

I have been given access to a University Data Center to deploy an Image Analysis python project. The server has Python 2.7 and 3.5 installed and I can see that it is missing packages like numpy, theano and keras which I have used in my code as additional libraries.

The problem at hand is, that I do not have access to install anything, or run commands like pip install or apt-get install, and cannot copy anything to the original site-packages location in my server.

But I can copy files into my userspace, and I tried to: - clone numpy and its prerequisites, and all the additional packages I need into a folder called site-packages. - add this path to my sys.path, but it gives me errors like "cannot import multiarray"

I'm new to Linux, and my question is: can I copy package files into a Linux system and provide this path to my PYTHONPATH to run the code?

Batwoman05
  • 215
  • 1
  • 2
  • 9
  • You should take a look of the following thread: https://stackoverflow.com/questions/7143077/how-can-i-install-packages-in-my-home-folder-with-pip – benjarobin Apr 30 '18 at 15:13
  • It should work, but the package pip is missing. That's why I was manually copying the library files. – Batwoman05 Apr 30 '18 at 15:18

1 Answers1

0

I believe you are looking for:

pip install --user package_name

You might also need to investigate compiling some packages from their source code, but this will depend on the package.

From the user guide more on pip install --user:

pip install --user follows four rules:

  1. When globally installed packages are on the python path, and they conflict with the installation requirements, they are ignored, and not uninstalled.
  2. When globally installed packages are on the python path, and they satisfy the installation requirements, pip does nothing, and reports that requirement is satisfied (similar to how global packages can satisfy requirements when installing packages in a --system-site-packages virtualenv).
  3. pip will not perform a --user install in a --no-site-packages > virtualenv (i.e. the default kind of virtualenv), due to the user site not being on the python path. The installation would be pointless.
  4. In a --system-site-packages virtualenv, pip will not install a package that conflicts with a package in the virtualenv site-packages. The --user installation would lack sys.path precedence and be pointless.

Edit: If pip itself is not installed then you can read up here: https://pip.pypa.io/en/stable/installing/

Charmander35
  • 115
  • 1
  • 11