You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/08/27 01:25:32 UTC

[GitHub] [airflow] skylarbpayne edited a comment on issue #8172: setproctitle causes "Expected in: flat namespace" error

skylarbpayne edited a comment on issue #8172:
URL: https://github.com/apache/airflow/issues/8172#issuecomment-681227551


   ## Potential Fix
   Just see this to skip all the ugly details:
   
   So concretely, here's how to install with homebrew + get airflow to work (tried this from fresh install, so I _think_ it should work for all of you too):
   
   ```
   # Note: these instructions are for python3.7 but can be loosely modified for other versions
   brew install python@3.7
   virtualenv -p /usr/local/opt/python@3.7/Frameworks/Python.framework/Versions/3.7/bin/python3 .toy-venv
   source .toy-venv/bin/activate
   pip install apache-airflow
   python
   >>> import setproctitle
   # Success!
   ```
   
   ## Ugly Details
   
   Mercurial ran into a similar issue some time ago: https://bz.mercurial-scm.org/show_bug.cgi?id=5858
   
   According to that ticket, the issue is that setproctitle uses a non-public Python API, and depending on how your python was compiled, it may not be discoverable by setproctitle.
   
   Versions of python installed to OS X with the standard python installer (i.e. downloaded from the python website) seem to always have a file like:
   
   ```
   /Library/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib
   ```
   
   And if we use `nm` on this, we find that it contains the definition `setproctitle` relies on:
   ```
   nm -gU /Library/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib | grep -i argcargv
   0000000000135630 T _Py_GetArgcArgv
   ```
   
   By default, the "bin" directory used by homebrew is `/usr/local/opt/bin` -- libpython is not there. But there's also a `Frameworks` install (Note: I'm not smart enough to understand why this divide exists -- maybe someone knowledgeable about OS X, Python, and/or Homebrew can chime in :) ).
   
   If we check out the Frameworks install, it has the dylib and has the required method defined:
   
   ```
   nm -gU /usr/local/opt/python@3.7/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib | grep -i argcargv
   ```
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org