jfmatth / openshift-django17

Running django 1.7 apps on Red Hat's Openshift 2 DEPRECATED
MIT License
72 stars 25 forks source link

Python 3.3 doesn't work with PIP #20

Closed arkashkin1 closed 9 years ago

arkashkin1 commented 9 years ago

Hi, I want to report a bug which appeared lately with Python 3. I have created a python 3 app succesfuly about 2 weeks ago but now I can't create another one. If I follow steps of using this repository, I get stack on the 'git push' step which fails.

This is my 'git push' command output:


warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use:

git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

git config --global push.default simple

When push.default is set to 'matching', git will push local branches to the remote branches that already exist with the same name.

In Git 2.0, Git will default to the more conservative 'simple' behavior, which only pushes the current branch to the corresponding remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git)

Counting objects: 341, done. Delta compression using up to 8 threads. Compressing objects: 100% (142/142), done. Writing objects: 100% (335/335), 51.99 KiB | 0 bytes/s, done. Total 335 (delta 191), reused 327 (delta 185) remote: Stopping Python 3.3 cartridge remote: Waiting for stop to finish remote: Waiting for stop to finish remote: Stopping Postgres cartridge remote: Building git ref 'master', commit 73e79b1 remote: --> ACTION HOOK: pre_build <-- remote: Activating virtenv remote: Checking for pip dependency listed in requirements.txt file.. remote: The directory '/var/lib/openshift/5561d2ea5973caf3d1000057/.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: The directory '/var/lib/openshift/5561d2ea5973caf3d1000057/.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 django<1.8,>=1.7 (from -r /var/lib/openshift/5561d2ea5973caf3d1000057/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 django<1.8,>=1.7 (from -r /var/lib/openshift/5561d2ea5973caf3d1000057/app-root/runtime/repo/requirements.txt (line 1)) (from versions: ) remote: No matching distribution found for django<1.8,>=1.7 (from -r /var/lib/openshift/5561d2ea5973caf3d1000057/app-root/runtime/repo/requirements.txt (line 1)) remote: Running setup.py script.. remote: running develop remote: running egg_info remote: creating django_1.7_on_Red_Hat_Openshift.egg-info remote: writing top-level names to django_1.7_on_Red_Hat_Openshift.egg-info/top_level.txt remote: writing django_1.7_on_Red_Hat_Openshift.egg-info/PKG-INFO remote: writing dependency_links to django_1.7_on_Red_Hat_Openshift.egg-info/dependency_links.txt remote: writing manifest file 'django_1.7_on_Red_Hat_Openshift.egg-info/SOURCES.txt' remote: reading manifest file 'django_1.7_on_Red_Hat_Openshift.egg-info/SOURCES.txt' remote: writing manifest file 'django_1.7_on_Red_Hat_Openshift.egg-info/SOURCES.txt' remote: running build_ext remote: Creating /var/lib/openshift/5561d2ea5973caf3d1000057/app-root/runtime/dependencies/python/virtenv/venv/lib/python3.3/site-packages/django-1.7-on-Red-Hat-Openshift.egg-link (link to .) remote: Adding django-1.7-on-Red-Hat-Openshift 1.3 to easy-install.pth file remote: remote: Installed /var/lib/openshift/5561d2ea5973caf3d1000057/app-root/runtime/repo remote: Processing dependencies for django-1.7-on-Red-Hat-Openshift==1.3 remote: Finished processing dependencies for django-1.7-on-Red-Hat-Openshift==1.3 remote: --> ACTION HOOK: build <-- remote: Preparing build for deployment remote: Deployment id is ab14143e remote: Activating deployment remote: Starting Postgres cartridge remote: Postgres started remote: ---> ACTION HOOK: deploy <--- remote: Executing 'python /var/lib/openshift/5561d2ea5973caf3d1000057/app-root/runtime/repo//manage.py migrate --noinput' remote: /var/lib/openshift/5561d2ea5973caf3d1000057/app-root/runtime/repo/.openshift/action_hooks/deploy: line 8: /var/lib/openshift/5561d2ea5973caf3d1000057//python/virtenv/bin/activate: No such file or directory remote: Traceback (most recent call last): remote: File "/var/lib/openshift/5561d2ea5973caf3d1000057/app-root/runtime/repo//manage.py", line 8, in remote: from django.core.management import execute_from_command_line remote: ImportError: No module named 'django' remote: Executing 'python /var/lib/openshift/5561d2ea5973caf3d1000057/app-root/runtime/repo//manage.py collectstatic --noinput' remote: Traceback (most recent call last): remote: File "/var/lib/openshift/5561d2ea5973caf3d1000057/app-root/runtime/repo//manage.py", line 8, in remote: from django.core.management import execute_from_command_line remote: ImportError: No module named 'django' remote: ------------------------- remote: Git Post-Receive Result: failure remote: Activation status: failure remote: Activation failed for the following gears: remote: 5561d2ea5973caf3d1000057 (Error activating gear: CLIENT_ERROR: Failed to execute action hook 'deploy' for 5561d2ea5973caf3d1000057 application mysay remote: #IO:0x000000020e22a0 remote: #IO:0x000000020e2228 remote: ) remote: Deployment completed with status: failure remote: postreceive failed To ssh://5561d2ea5973caf3d1000057@mysay-dbtest1.rhcloud.com/~/git/mysay.git/ 2714758..73e79b1 master -> master


As you can see, It doesn't find django, and seem like, that is because it could not activate the virtual environment? I managed to run my application by ssh into my app and do "pip install django". Is it some change in openshift-django17 repository or maybe in python3.3 cartridge?

jfmatth commented 9 years ago

arkashkin1,

thanks for using my repo and taking the time to file this.

I haven't seen this bug, but I personally don't use python 3.3.

Can you give me the app details and I'll see if i can reproduce?

I removed the creation of the virtualenv because it seemed redundant, and haven't seen issues with it before.

Just to be clear, you ran this from scratch without merging it with some other code of yours?

thanks,

John

arkashkin1 commented 9 years ago

I don't merging any code. Steps for reproduce the problem are:


rhc app create django python-3.3 rhc add-cartridge postgresql-9.2 --app django cd django git remote add upstream -m master https://github.com/jfmatth/openshift-django17.git git pull -s recursive -X theirs upstream master rhc env set OPENSHIFT_PYTHON_WSGI_APPLICATION=wsgi/wsgi.py --app django git push


You should see that the last command fails.

And the problem is not reproducible with the same steps when using python 2.7 catrige.

jfmatth commented 9 years ago

thanks, let me see what comes up for me.

On Sun, May 24, 2015 at 7:44 AM, arkashkin1 notifications@github.com wrote:

I don't merging any code.

Steps for reproduce the problem are:

rhc app create django python-3.3 rhc add-cartridge postgresql-9.2 --app django cd django git remote add upstream -m master https://github.com/jfmatth/openshift-django17.git git pull -s recursive -X theirs upstream master rhc env set OPENSHIFT_PYTHON_WSGI_APPLICATION=wsgi/wsgi.py --app django

git push

You should see that the last command fails.

— Reply to this email directly or view it on GitHub https://github.com/jfmatth/openshift-django17/issues/20#issuecomment-105021751 .

arkashkin1 commented 9 years ago

I checked this problem a little more, and found out something. in 'app_folder/.openshift/deploy' ,there is this line: source $OPENSHIFT_HOMEDIR/python/virtenv/bin/activate but when I ssh into the open shift server, i see that the 'activate' file is located in: $OPENSHIFT_HOMEDIR/python/virtenv/venv/bin

So inside, 'virtenv' directory, we have another directory 'venv'.

jfmatth commented 9 years ago

I'm seeing the same error you are, but strangely, when I ssh in and do a pip list, I get a cache error, where as on 2.7 I do not. I'm wondering if it's a bug on the Red Hat side, since nothing for 3.3 changed regarding this.

I'll have to do some more troubleshooting, but the suggestion of using the venv/activate idea didn't work.

If you could keep troubleshooting I would appreciate that, since Red hat doesn't support 3.3 in their repo.

arkashkin1 commented 9 years ago

Hi,

I think that I have solved this problem by putting the following text inside 'pre_build' file:

echo "--> ACTION HOOK: pre_build <--" source $OPENSHIFT_HOMEDIR/python/virtenv/venv/bin/activate

echo "--> ACTION HOOK: pre_build <--" pip install -r $OPENSHIFT_REPO_DIR/requirements.txt

and removing the following 2 lines from 'deploy' file:

echo "---> ACTION HOOK: deploy <---" source $OPENSHIFT_HOMEDIR/python/virtenv/bin/activate

The only strange output I see from 'git push' is: " The directory '/var/lib/openshift/556217224382ecd33800001b/.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. "

I have few warnings like this in the output, but the procedure finishes successfully and my app seems to work properly.

(I have edited this commented to be more clear.)

jfmatth commented 9 years ago

It looks like a new bug with the python 3.3 cartridge, and I've opened a bug report with Redhat https://bugzilla.redhat.com/show_bug.cgi?id=1225291

jfmatth commented 9 years ago

Red Hat has confirmed the behavior that I put in my bug report, I'll update here once they say it's fixed.

arkashkin1 commented 9 years ago

Thank you. On May 28, 2015 6:57 AM, "John Flynn Matthew" notifications@github.com wrote:

Red Hat has confirmed the behavior that I put in my bug report, I'll update here once they say it's fixed.

— Reply to this email directly or view it on GitHub https://github.com/jfmatth/openshift-django17/issues/20#issuecomment-106164007 .

jfmatth commented 9 years ago

Red Hat has updated their ticket and said this is fixed. I haven't tested it yet, if someone could that would be great.

thanks,

arkashkin1 commented 9 years ago

I will test on the end of the week... thanks.

On Wed, Jul 1, 2015, 16:17 John Flynn Matthew notifications@github.com wrote:

Red Hat has updated their ticket and said this is fixed. I haven't tested it yet, if someone could that would be great.

thanks,

— Reply to this email directly or view it on GitHub https://github.com/jfmatth/openshift-django17/issues/20#issuecomment-117667870 .

arkashkin1 commented 9 years ago

Hi, I have verified their fix. My project pushed to openshift without any problems. Thanks.

jfmatth commented 9 years ago

Thank you for verifying I'll close out the issue On Jul 4, 2015 1:19 AM, "arkashkin1" notifications@github.com wrote:

Hi, I have verified their fix. My project pushed to openshift without. Thanks.

— Reply to this email directly or view it on GitHub https://github.com/jfmatth/openshift-django17/issues/20#issuecomment-118484203 .