Bug 1015722 - numpy doesn't get installed when added to setup.py as a dependency
Summary: numpy doesn't get installed when added to setup.py as a dependency
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Image
Version: 2.x
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: Michal Fojtik
QA Contact: libra bugs
URL:
Whiteboard:
: 1013881 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-04 23:37 UTC by Nam Duong
Modified: 2015-05-15 00:34 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-24 03:23:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Nam Duong 2013-10-04 23:37:54 UTC
Description of problem:

See https://www.openshift.com/forums/openshift/installing-numpy-and-pandas-with-openshift for full details.

Problem:  
When adding numpy to setup.py:
...
install_requires=['numpy'],
...

There are errors with the installation as per git push logs:
...
remote: /tmp/easy_install-2oQi9s/numpy-1.7.1/_configtest.c:6: undefined reference to `exp'
remote: collect2: ld returned 1 exit status
remote: _configtest.c:1:20: error: Python.h: No such file or directory
remote: Traceback (most recent call last):
remote:   File "/var/lib/openshift/523f9b0a500446bb97000046/app-root/runtime/repo//setup.py", line 11, in <module>
remote:     install_requires=['numpy'],
...

It installs fine when you ssh onto the app, and install numpy into virtenv manually:
rhc ssh $appName  
source ~/python/virtenv/bin/activate
pip install numpy

Comment 1 Jhon Honce 2013-10-09 19:06:10 UTC
Verified using pip directly or requirements.txt works.  setup.py appears to be failing related to the use of SCL for python 2.7.

Additionally, requested a SCL build of numpy for python 2.7.

Comment 2 Jhon Honce 2013-10-11 18:35:57 UTC
*** Bug 1013881 has been marked as a duplicate of this bug. ***

Comment 3 Michal Fojtik 2013-11-08 16:28:32 UTC
I tried to modify the build() action to use SCL:

    if [ -f ${OPENSHIFT_REPO_DIR}/setup.py ]
    then
        ( cd $OPENSHIFT_REPO_DIR; scl enable python27 "python ${OPENSHIFT_REPO_DIR}/setup.py develop $OPENSHIFT_PYTHON_MIRROR" )
    fi

But the result is:

remote: error: can't create or remove files in install directory
remote: 
remote: The following error occurred while trying to add or remove files in the
remote: installation directory:
remote: 
remote:     [Errno 13] Permission denied: '/opt/rh/python27/root/usr/lib/python2.7/site-packages/test-easy-install-28040.write-test'
remote: 
remote: The installation directory you specified (via --install-dir, --prefix, or
remote: the distutils default setting) was:
remote: 
remote:     /opt/rh/python27/root/usr/lib/python2.7/site-packages/

Do we set a PYTHONPATH pointing to a directory in gear when installing using setup.py?

Comment 4 Mrunal Patel 2013-11-11 19:37:17 UTC
We should try the python27-numpy package and if it works, add it to the python cartridge spec as a requirement.

Comment 5 Michal Fojtik 2013-11-11 19:39:01 UTC
python27-numpy added to python cartridge spec file:

https://github.com/openshift/origin-server/pull/4158

Comment 6 openshift-github-bot 2013-11-11 22:11:29 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/0822b5c1268064d30527f3c896ea8779b046b8b2
Bug 1015722 - Added python27-numpy into python cart spec file

Comment 7 chunchen 2013-11-12 06:43:46 UTC
It's fixed, verified on devenv_4022, please refer to the following results:

[master 0bc65cb] p
 1 file changed, 1 insertion(+), 1 deletion(-)
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 287 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Stopping PYTHON cart
remote: [Tue Nov 12 01:41:00 2013] [warn] PassEnv variable SHELL was undefined
remote: [Tue Nov 12 01:41:00 2013] [warn] PassEnv variable USER was undefined
remote: [Tue Nov 12 01:41:00 2013] [warn] PassEnv variable LOGNAME was undefined
remote: Waiting for stop to finish
remote: Building git ref 'master', commit 0bc65cb
remote: running develop
remote: running egg_info
remote: creating YourAppName.egg-info
remote: writing requirements to YourAppName.egg-info/requires.txt
remote: writing YourAppName.egg-info/PKG-INFO
remote: writing top-level names to YourAppName.egg-info/top_level.txt
remote: writing dependency_links to YourAppName.egg-info/dependency_links.txt
remote: writing requirements to YourAppName.egg-info/requires.txt
remote: writing YourAppName.egg-info/PKG-INFO
remote: writing top-level names to YourAppName.egg-info/top_level.txt
remote: writing dependency_links to YourAppName.egg-info/dependency_links.txt
remote: writing manifest file 'YourAppName.egg-info/SOURCES.txt'
remote: reading manifest file 'YourAppName.egg-info/SOURCES.txt'
remote: writing manifest file 'YourAppName.egg-info/SOURCES.txt'
remote: running build_ext
remote: Creating /var/lib/openshift/5281cd39c465ee861b000007/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/YourAppName.egg-link (link to .)
remote: Adding YourAppName 1.0 to easy-install.pth file
remote: 
remote: Installed /var/lib/openshift/5281cd39c465ee861b000007/app-root/runtime/repo
remote: Processing dependencies for YourAppName==1.0
remote: Searching for numpy==1.4.1
remote: Best match: numpy 1.4.1
remote: Adding numpy 1.4.1 to easy-install.pth file
remote: 
remote: Using /opt/rh/python27/root/usr/lib64/python2.7/site-packages
remote: Finished processing dependencies for YourAppName==1.0
remote: Script /var/lib/openshift/5281cd39c465ee861b000007/python//virtenv/bin/activate.csh cannot be made relative (it's not a normal script that starts with #!/var/lib/openshift/5281cd39c465ee861b000007/python/virtenv/bin/python)
remote: Script /var/lib/openshift/5281cd39c465ee861b000007/python//virtenv/bin/activate.fish cannot be made relative (it's not a normal script that starts with #!/var/lib/openshift/5281cd39c465ee861b000007/python/virtenv/bin/python)
remote: Preparing build for deployment
remote: Deployment id is 51275454
remote: Activating deployment
remote: Script /var/lib/openshift/5281cd39c465ee861b000007/python//virtenv/bin/activate.csh cannot be made relative (it's not a normal script that starts with #!/var/lib/openshift/5281cd39c465ee861b000007/python/virtenv/bin/python)
remote: Script /var/lib/openshift/5281cd39c465ee861b000007/python//virtenv/bin/activate.fish cannot be made relative (it's not a normal script that starts with #!/var/lib/openshift/5281cd39c465ee861b000007/python/virtenv/bin/python)
remote: Starting PYTHON cart
remote: Result: success
remote: Activation status: success
remote: Deployment completed with status: success
To ssh://5281cd39c465ee861b000007.rhcloud.com/~/git/cpy27.git/
   2e00d8c..0bc65cb  master -> master


Note You need to log in before you can comment on or make changes to this bug.