Bug 971582

Summary: setup.py installs alembic binary in wrong Python environment
Product: OpenShift Online Reporter: Sumana Annam <sannam>
Component: ContainersAssignee: Mrunal Patel <mpatel>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: bmeng, chunchen, jofernan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-24 14:52:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sumana Annam 2013-06-06 20:42:40 UTC
Description of problem:

https://www.openshift.com/forums/openshift/setuppy-installs-alembic-binary-in-wrong-python-environment

My app's setup.py installs Alembic as a requirement, but the binary script is installed in wrong Python env during build phase (2.6 instead of 2.7):

<code>
(virtenv)[brewlog-zgoda.rhcloud.com 515a90de500446a7d6000007]\> cd $OPENSHIFT_REPO_DIR
(virtenv)[brewlog-zgoda.rhcloud.com repo]\> alembic
Traceback (most recent call last):
  File "/var/lib/openshift/515a90de500446a7d6000007/python/virtenv/bin/alembic", line 8, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2655, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 648, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: alembic==0.5.0
</code>

Package is installed properly, I can import it from Python shell. Now if i uninstall Alembic package by hand and then install it again using pip everything works fine and I can run alembic migrations.

Am I doing something wrong or just spotted a bug?

Notes from Sumana: I am able to reproduce using user's instructions.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 chunchen 2013-06-14 07:12:06 UTC
It's fixed, verified on devenv_3360,please refer to the following results:

1. Create a python-2.7 or python-3.3 app
rhc app create cpy70 python-2.7
2. Install "alembic" package
add "alembic" to "install_requires" in setup.py
git add .; git commit -amp; git push
3. SSH into this app
\> cd $OPENSHIFT_REPO_DIR
\> alembic -h
usage: alembic [-h] [-c CONFIG] [-n NAME]
               
               {branches,current,downgrade,history,init,list_templates,revision,splice,stamp,upgrade}
               ...

positional arguments:
  {branches,current,downgrade,history,init,list_templates,revision,splice,stamp,upgrade}
    branches            Show current un-spliced branch points
    current             Display the current revision for each database.
    downgrade           Revert to a previous version.
    history             List changeset scripts in chronological order.
    init                Initialize a new scripts directory.
    list_templates      List available templates
    revision            Create a new revision file.
    splice              'splice' two branches, creating a new revision file.
                        this command isn't implemented right now.
    stamp               'stamp' the revision table with the given revision;
                        don't run any migrations.
    upgrade             Upgrade to a later version.

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Alternate config file
  -n NAME, --name NAME  Name of section in .ini file to use for Alembic config