St2: Running st2 cli on OSX?

Created on 7 Aug 2017  路  6Comments  路  Source: StackStorm/st2

Hi im just trying to get started using this project. Server is set up and running well.

I installed the cli on my Mac using : pip install st2client
and have set up the ~/.st2/config file.
but im getting the issue bellow, should this work on OSX

Neils-MacBook-Pro:~ nbaillie$ which st2
/Library/Frameworks/Python.framework/Versions/3.6/bin/st2
Neils-MacBook-Pro:~ nbaillie$ st2 -h
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/bin/st2", line 7, in <module>
    from st2client.shell import main
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/st2client/shell.py", line 34, in <module>
    from st2client.base import BaseCLIApp
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/st2client/base.py", line 242
    file_st_mode = oct(os.stat(cached_token_path).st_mode & 0777)
                                                               ^
SyntaxError: invalid token
Neils-MacBook-Pro:~ nbaillie$
question

Most helpful comment

Also looks like OP is using Python 3.x, which probably won't work?

Shouldn't matter so long as venv is set up to use py2. If installed via pip then likely that'd be the issue, but current macOS version ships w/ py 2.7. If someone is brew installing 3 and setting it to default then they know enough to set up a virtualenv.

See this line from OP:

/Library/Frameworks/Python.framework/Versions/3.6/bin/st2

Seems to clash with this other line though:

/Library/Frameworks/Python.framework/Versions/3.5/bin/st2

Default with macOS is to use Python 2.7, but looks like @nbaillie has Python 3.5 or 3.6 as default?
If I install with sudo -H pip install st2client, it installs into /usr/local/bin/st2 by default. I am using the default python.

All 6 comments

While we definitely won't support running server on Mac,
I agree that it would be nice and probably relatively easy to have st2client working on OSX as widely used dev/client environment.

@lakshmi-kannan @bigmstone @LindsayHill WDYT?

Yes, I would like to have it working, but CI/CD testing could be a challenge?

Also looks like OP is using Python 3.x, which probably won't work?

Also looks like OP is using Python 3.x, which probably won't work?

Shouldn't matter so long as venv is set up to use py2. If installed via pip then likely that'd be the issue, but current macOS version ships w/ py 2.7. If someone is brew installing 3 and setting it to default then they know enough to set up a virtualenv.

My knee jerk reaction is +1 to adding macOS support for it, CircleCI (:trollface: for arma) has macOS support...though I'm not sure how mature/supported it is...just did a quick search for it. https://circleci.com/mobile/osx/

Current macOS version ships w/ 2.7 so we can reasonably expect (and only support) using it w/ 2.7. I'd need to look over dependencies to know if there's any major blockers.

Also looks like OP is using Python 3.x, which probably won't work?

Shouldn't matter so long as venv is set up to use py2. If installed via pip then likely that'd be the issue, but current macOS version ships w/ py 2.7. If someone is brew installing 3 and setting it to default then they know enough to set up a virtualenv.

See this line from OP:

/Library/Frameworks/Python.framework/Versions/3.6/bin/st2

Seems to clash with this other line though:

/Library/Frameworks/Python.framework/Versions/3.5/bin/st2

Default with macOS is to use Python 2.7, but looks like @nbaillie has Python 3.5 or 3.6 as default?
If I install with sudo -H pip install st2client, it installs into /usr/local/bin/st2 by default. I am using the default python.

If we are to support OSX, it makes sense to pack st2 cli as a single executable rather than relying on system version of python. We've seen what could happen when we tried st2-install. Also, I believe CircleCI supports testing on OSX so it may not be as big of a challenge as we might expect.

I think it's figured out by @LindsayHill: wrong 3.5 (or 3.6) version was used for pip st2client.
As @bigmstone noted, 2.7 is the default version on OSX where st2 client should work.

So I think we can close the issue, because we don't support python 3.
@nbaillie feel free to report an issue if you still have a problem with pip st2client, installed under python 2.7 version.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saahn picture saahn  路  8Comments

JohnWelborn picture JohnWelborn  路  8Comments

sidkrishna picture sidkrishna  路  9Comments

trstruth picture trstruth  路  3Comments

bigmstone picture bigmstone  路  8Comments