Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

heroku local python version #42

Closed
opyate opened this issue Jan 5, 2018 · 8 comments
Closed

heroku local python version #42

opyate opened this issue Jan 5, 2018 · 8 comments

Comments

@opyate
Copy link

opyate commented Jan 5, 2018

Somewhat related to #41

Heroku local finds my Python 3.6 executable:

$ heroku local:run python
[WARN] No ENV file found
Python 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 13:19:00)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

...but running my app with heroku local still croaks on py3 syntax when I try runtime.txt with:

  • python-3.6
  • python-3.6.0

What else can I try?

@jdx
Copy link
Contributor

jdx commented Jan 5, 2018

@kennethreitz do you have any idea? I'm not sure what is going on here

@opyate
Copy link
Author

opyate commented Jan 5, 2018

I even tried conda install python=3.6.3 and changing runtime.txt to python-3.6.3 as per the latest supported version.

@opyate
Copy link
Author

opyate commented Jan 5, 2018

Digging through Heroku CLI/util etc to see how my environment is interrogated.

UPDATE: hint to look at node foreman.

@opyate
Copy link
Author

opyate commented Jan 5, 2018

Foreman clearly finds System py27 (at "/Library/Python/2.7"):

% heroku local
[WARN] No ENV file found
16:43:54 web.1   |  [2018-01-05 16:43:54 +0000] [27288] [INFO] Starting gunicorn 19.7.1
16:43:54 web.1   |  [2018-01-05 16:43:54 +0000] [27288] [INFO] Listening at: http://0.0.0.0:5000 (27288)
16:43:54 web.1   |  [2018-01-05 16:43:54 +0000] [27288] [INFO] Using worker: sync
16:43:54 web.1   |  [2018-01-05 16:43:54 +0000] [27292] [INFO] Booting worker with pid: 27292
16:43:54 web.1   |  [2018-01-05 16:43:54 +0000] [27293] [INFO] Booting worker with pid: 27293
16:43:54 web.1   |  [2018-01-05 16:43:54 +0000] [27294] [INFO] Booting worker with pid: 27294
16:43:54 web.1   |  [2018-01-05 16:43:54 +0000] [27292] [ERROR] invalid syntax (__init__.py, line 5)
16:43:54 web.1   |  Traceback (most recent call last):
16:43:54 web.1   |    File "/Library/Python/2.7/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
16:43:54 web.1   |      self.wsgi = self.app.wsgi()

@opyate
Copy link
Author

opyate commented Jan 5, 2018

#41 also tried here: strongloop/node-foreman#149

@kennethreitz
Copy link

Heroku local is not aware of runtime.txt, like the heroku runtime is. Whatever python is normally, it will remain.

@kennethreitz
Copy link

kennethreitz commented Jan 5, 2018

I recommend creating a virtualenv with the desired Python interpreter and activating it before invoking heroku local.

@opyate
Copy link
Author

opyate commented Jan 5, 2018

Thanks for the suggestions.

So many moving parts: heroku, conda, python, foreman, gunicorn.

I suspect the problem with OSX system python clashing with conda python somehow, and gunicorn not getting the correct environment (or the wrong/old gunicorn in /Library/Python/2.7/site-packages/gunicorn being used).

Anyhoo, closing, as this is clearly not a heroku-local issue.

@opyate opyate closed this as completed Jan 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants