0

Steps To Replicate

Approach #1

rhc ssh my_app_name
pip install bottle-cork

Approach #2

rhc ssh my_app_name
source ~/python/virtenv/bin/activate
pip install bottle-cork

Approach #3

Adding bottle-cork to requirements.txt.

Approach #4

Adding install_requires=['bottle-cork'] to setup.py.

Approach 1 and 2 produced a long set of errors.

Approach 3 and 4 were suggested in official documentation and caused multiple errors and warnings.

I'm tempted to try a sudo pip install but am aware that this can sometimes result in permission problems and incongruities (see this general warning against sudo pip).

Questions

01) Is it best practise to use pip install or sudo pip install when installing packages in OpenShift?

02) Should you be in virtualenv when doing a pip install, ie:

source ~/python/virtenv/bin/activate

03) Or should you use one of the following:

  • Adding bottle-cork to requirements.txt.
  • Adding install_requires=['bottle-cork'] to setup.py.

#1 and #2 approach errors

Note: ******* represents user id.

The directory '/var/lib/openshift/*******/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
You are using pip version 7.1.0, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The directory '/var/lib/openshift/*******/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting bottle-cork
  Downloading bottle-cork-0.12.0.tar.gz (108kB)
    100% |????????????????????????????????| 110kB 3.5MB/s 
Collecting Bottle (from bottle-cork)
  Downloading bottle-0.12.9.tar.gz (69kB)
    100% |????????????????????????????????| 69kB 3.2MB/s 
Collecting pycrypto (from bottle-cork)
  Downloading pycrypto-2.6.1.tar.gz (446kB)
    100% |????????????????????????????????| 446kB 956kB/s 
Building wheels for collected packages: bottle-cork, Bottle, pycrypto
Exception:
Traceback (most recent call last):
  File "/var/lib/openshift/*******/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/pip/basecommand.py", line 223, in main
    status = self.run(options, args)
  File "/var/lib/openshift/*******/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/pip/commands/install.py", line 293, in run
    wb.build(autobuilding=True)
  File "/var/lib/openshift/*******/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/pip/wheel.py", line 756, in build
    ensure_dir(output_dir)
  File "/var/lib/openshift/*******/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/pip/utils/__init__.py", line 70, in ensure_dir
    os.makedirs(path)
  File "/var/lib/openshift/*******/python/virtenv/lib64/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/var/lib/openshift/*******/python/virtenv/lib64/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/var/lib/openshift/*******/python/virtenv/lib64/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/var/lib/openshift/*******/python/virtenv/lib64/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/var/lib/openshift/*******/python/virtenv/lib64/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/var/lib/openshift/*******/python/virtenv/lib64/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/var/lib/openshift/*******/python/virtenv/lib64/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/var/lib/openshift/*******/.cache'

#3 approach errors

I tried adding bottle-cork to requirements.txt as per this OpenShift document and then pushing and restarting. After ssh'ing in again and running pip freeze, I cannot see bottle-cork. The errors shown during the git push are shown below:

remote: Checking for pip dependency listed in requirements.txt file..
remote: The directory '/var/lib/openshift/*******/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
remote: You are using pip version 7.1.0, however version 8.1.2 is available.
remote: You should consider upgrading via the 'pip install --upgrade pip' command.
remote: The directory '/var/lib/openshift/*******/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
remote: Collecting bottle-cork (from -r /var/lib/openshift/*******/app-root/runtime/repo/requirements.txt (line 1))
remote:   The repository located at mirror1.ops.rhcloud.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host mirror1.ops.rhcloud.com'.
remote:   Could not find a version that satisfies the requirement bottle-cork (from -r /var/lib/openshift/*******/app-root/runtime/repo/requirements.txt (line 1)) (from versions: )
remote: No matching distribution found for bottle-cork (from -r /var/lib/openshift/*******/app-root/runtime/repo/requirements.txt (line 1))

#4 approach errors

I tried adding install_requires=['bottle-cork'] to setup.py as per this OpenShift document and then pushing and restarting. After ssh'ing in again and running pip freeze, I CAN see bottle-cork. However, there were multiple warnings and errors during git push:

remote: Processing dependencies for YourAppName==1.0
remote: Searching for bottle-cork
remote: Reading http://mirror1.ops.rhcloud.com/mirror/python/web/simple/bottle-cork/
remote: Best match: bottle-cork 0.12.0
remote: Downloading http://mirror1.ops.rhcloud.com/mirror/python/web/packages/source/b/bottle-cork/bottle-cork-0.12.0.tar.gz#md5=dfb94beb8038b22e07a1876cad464a23
remote: Processing bottle-cork-0.12.0.tar.gz
remote: Writing /tmp/easy_install-eAzgu8/bottle-cork-0.12.0/setup.cfg
remote: Running bottle-cork-0.12.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-eAzgu8/bottle-cork-0.12.0/egg-dist-tmp-KleNYn
remote: zip_safe flag not set; analyzing archive contents...
remote: Moving bottle_cork-0.12.0-py2.7.egg to /var/lib/openshift/*******/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages
remote: Adding bottle-cork 0.12.0 to easy-install.pth file
remote: 
remote: Installed /var/lib/openshift/*******/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/bottle_cork-0.12.0-py2.7.egg
remote: Searching for pycrypto
remote: Reading http://mirror1.ops.rhcloud.com/mirror/python/web/simple/pycrypto/
remote: Best match: pycrypto 2.6.1
remote: Downloading http://mirror1.ops.rhcloud.com/mirror/python/web/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz#md5=55a61a054aa66812daf5161a0d5d7eda
remote: Processing pycrypto-2.6.1.tar.gz
remote: Writing /tmp/easy_install-3HiFoD/pycrypto-2.6.1/setup.cfg
remote: Running pycrypto-2.6.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-3HiFoD/pycrypto-2.6.1/egg-dist-tmp-dPyoQF
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/_fastmath.c:31:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/stdio.h:28,
remote:                  from src/_fastmath.c:29:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/_fastmath.c:31:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/stdio.h:28,
remote:                  from src/_fastmath.c:29:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/MD2.c:31:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/string.h:27,
remote:                  from src/MD2.c:30:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/MD2.c:31:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/string.h:27,
remote:                  from src/MD2.c:30:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/MD4.c:31:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/string.h:27,
remote:                  from src/MD4.c:30:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/MD4.c:31:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/string.h:27,
remote:                  from src/MD4.c:30:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/hash_SHA2_template.c:33,
remote:                  from src/SHA256.c:72:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/stdint.h:26,
remote:                  from src/hash_SHA2.h:72,
remote:                  from src/SHA256.c:35:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/hash_SHA2_template.c:33,
remote:                  from src/SHA256.c:72:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/stdint.h:26,
remote:                  from src/hash_SHA2.h:72,
remote:                  from src/SHA256.c:35:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/hash_SHA2_template.c:33,
remote:                  from src/SHA224.c:73:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/stdint.h:26,
remote:                  from src/hash_SHA2.h:72,
remote:                  from src/SHA224.c:36:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/hash_SHA2_template.c:33,
remote:                  from src/SHA224.c:73:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/stdint.h:26,
remote:                  from src/hash_SHA2.h:72,
remote:                  from src/SHA224.c:36:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/hash_SHA2_template.c:33,
remote:                  from src/SHA384.c:80:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/stdint.h:26,
remote:                  from src/hash_SHA2.h:72,
remote:                  from src/SHA384.c:36:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/hash_SHA2_template.c:33,
remote:                  from src/SHA384.c:80:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/stdint.h:26,
remote:                  from src/hash_SHA2.h:72,
remote:                  from src/SHA384.c:36:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/hash_SHA2_template.c:33,
remote:                  from src/SHA512.c:80:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/stdint.h:26,
remote:                  from src/hash_SHA2.h:72,
remote:                  from src/SHA512.c:36:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/hash_SHA2_template.c:33,
remote:                  from src/SHA512.c:80:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/stdint.h:26,
remote:                  from src/hash_SHA2.h:72,
remote:                  from src/SHA512.c:36:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/RIPEMD160.c:57:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/stdint.h:26,
remote:                  from src/RIPEMD160.c:48:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/RIPEMD160.c:57:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/stdint.h:26,
remote:                  from src/RIPEMD160.c:48:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/AES.c:29:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/assert.h:37,
remote:                  from src/AES.c:27:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/AES.c:29:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/assert.h:37,
remote:                  from src/AES.c:27:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/ARC2.c:45:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/string.h:27,
remote:                  from src/ARC2.c:44:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/ARC2.c:45:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/string.h:27,
remote:                  from src/ARC2.c:44:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/Blowfish.c:39:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/stdint.h:26,
remote:                  from src/Blowfish.c:31:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/Blowfish.c:39:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/stdint.h:26,
remote:                  from src/Blowfish.c:31:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/DES.c:37:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/assert.h:37,
remote:                  from src/libtom/tomcrypt.h:3,
remote:                  from src/libtom/tomcrypt_des.c:11,
remote:                  from src/DES.c:32:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/DES.c:37:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/assert.h:37,
remote:                  from src/libtom/tomcrypt.h:3,
remote:                  from src/libtom/tomcrypt_des.c:11,
remote:                  from src/DES.c:32:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/DES.c:37,
remote:                  from src/DES3.c:26:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/assert.h:37,
remote:                  from src/libtom/tomcrypt.h:3,
remote:                  from src/libtom/tomcrypt_des.c:11,
remote:                  from src/DES.c:32,
remote:                  from src/DES3.c:26:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/DES.c:37,
remote:                  from src/DES3.c:26:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/assert.h:37,
remote:                  from src/libtom/tomcrypt.h:3,
remote:                  from src/libtom/tomcrypt_des.c:11,
remote:                  from src/DES.c:32,
remote:                  from src/DES3.c:26:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/_counter.c:28:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1191:1: warning: "_POSIX_C_SOURCE" redefined
remote: In file included from /usr/include/assert.h:37,
remote:                  from src/_counter.c:25:
remote: /usr/include/features.h:162:1: warning: this is the location of the previous definition
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from src/_counter.c:28:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:1213:1: warning: "_XOPEN_SOURCE" redefined
remote: In file included from /usr/include/assert.h:37,
remote:                  from src/_counter.c:25:
remote: /usr/include/features.h:164:1: warning: this is the location of the previous definition
remote: zip_safe flag not set; analyzing archive contents...
remote: Moving pycrypto-2.6.1-py2.7-linux-x86_64.egg to /var/lib/openshift/*******/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages
remote: Adding pycrypto 2.6.1 to easy-install.pth file
remote: 
remote: Installed /var/lib/openshift/*******/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/pycrypto-2.6.1-py2.7-linux-x86_64.egg
remote: Searching for Bottle
remote: Best match: bottle cork-0.12.0
remote: Downloading http://mirror1.ops.rhcloud.com/mirror/python/web/packages/source/b/bottle-cork/bottle-cork-0.12.0.tar.gz#md5=dfb94beb8038b22e07a1876cad464a23
remote: Processing bottle-cork-0.12.0.tar.gz
remote: Writing /tmp/easy_install-8wwl3n/bottle-cork-0.12.0/setup.cfg
remote: Running bottle-cork-0.12.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-8wwl3n/bottle-cork-0.12.0/egg-dist-tmp-ZrFuqW
remote: zip_safe flag not set; analyzing archive contents...
remote: Removing /var/lib/openshift/*******/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/bottle_cork-0.12.0-py2.7.egg
remote: Moving bottle_cork-0.12.0-py2.7.egg to /var/lib/openshift/*******/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages
remote: bottle-cork 0.12.0 is already the active version in easy-install.pth
remote: 
remote: Installed /var/lib/openshift/*******/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/bottle_cork-0.12.0-py2.7.egg
remote: error: The 'Bottle' distribution was not found and is required by bottle-cork
Community
  • 1
  • 1
user1063287
  • 10,265
  • 25
  • 122
  • 218

1 Answers1

0

There is specific process required in order to install dependencies using pip with OpenShift, and sudo isn't really an option. This includes using a requirements.txt or setup.py files (both can be used at the same time, although any conflicts would then need to be resolved manually).

Take a look at the Deployment Guide and Managing Application Package Dependencies - Step 3. Obviously you've tried many different ways already of getting things working, although it's not entirely clear where the issue is without seeing the requirements.txt or setup.py files.

WMRamadan
  • 974
  • 1
  • 11
  • 25
l'L'l
  • 44,951
  • 10
  • 95
  • 146
  • `ls -l /var/lib/openshift` returns `ls: cannot open directory /var/lib/openshift: Permission denied`. – user1063287 Jun 04 '16 at 04:57
  • `sudo ls -l /var/lib/openshift` returns `bash: /usr/bin/sudo: Permission denied`. For reference, this is brand new application using default/pre-installed `virtualenv` set up. – user1063287 Jun 04 '16 at 05:07
  • Links are either outdated or unrelated unfortunately. – user1063287 Jun 04 '16 at 05:19
  • I think this answer might hold some clues to your solution: http://stackoverflow.com/a/24573415/499581. Essentially you'll want to `rhc ssh` first then use `pip`. – l'L'l Jun 04 '16 at 05:30
  • They were my original steps and didn't work. I also tried adding `bottle-cork` to `requirements.txt` without success, see updated original post. – user1063287 Jun 04 '16 at 05:33
  • `chmod: changing permissions of '/var/lib/openshift': Operation not permitted` , `chmod: cannot read directory '/var/lib/openshift': Permission denied`. – user1063287 Jun 04 '16 at 05:43
  • "OpenShift runs pip install -r requirements.txt on build and adds the packages to the applications virtualenv.". What is in your requirements.txt? https://developers.openshift.com/languages/python/getting-started.html#step3 (see step 3) – l'L'l Jun 04 '16 at 05:44
  • I've added all results to original post, all I added to `requirements.txt` when I tried that approach was `bottle-cork`. – user1063287 Jun 04 '16 at 05:58
  • It appears in your last update that easy-install was used now and not pip?! – l'L'l Jun 04 '16 at 06:11
  • Update #1 shows I tried adding `bottle-cork` to `requirements.txt`. Update #2 shows I tried adding `install_requires=['bottle-cork']` to `setup.py`. Both of these were suggested in [official documentation](https://developers.openshift.com/languages/python/deployment-options.html) and caused multiple errors and warnings. – user1063287 Jun 04 '16 at 06:25
  • It says to use "pip freeze > stable-req.txt" to generate requirements.txt. If you use requirements.txt with setup.py you will have to resolve all of those conflicts. – l'L'l Jun 04 '16 at 06:37
  • I've deleted the app and will try again when I find an approach that I haven't tried. I think `pip freeze > stable-req.txt` is just a tip for generating `requirements.txt` files that contain your application's dependencies so that they can be included in future deployments. – user1063287 Jun 04 '16 at 06:43
  • I always use your method #4 without any problems. – fat fantasma Jun 04 '16 at 10:27