Re: Configuring Python3 on MacOS Macports

2019-12-02 Thread Forrest

Thank you everyone for these really useful suggestions -- learning always!


Forrest




Re: Configuring Python3 on MacOS Macports

2019-12-02 Thread Ruben Di Battista
I still need to release my muscle memory 😉.

(in reality I don't use bare virtualenv but more pew and pipenv that I
believe use venv for Python 3)

On Tue, 3 Dec 2019, 01:42 Ralph Seichter,  wrote:

> * Ruben Di Battista:
>
> > What I suggest you is to use virtualenvs.
>
> Good advice.
>
> > * Install py-virtualenv
>
> That's not required anymore. Python 3.3 and newer have virtual
> environment support built in[1].
>
> [1] https://docs.python.org/3/library/venv.html
>
> -Ralph
>


Re: Configuring Python3 on MacOS Macports

2019-12-02 Thread Ralph Seichter
* Ruben Di Battista:

> What I suggest you is to use virtualenvs.

Good advice.

> * Install py-virtualenv

That's not required anymore. Python 3.3 and newer have virtual
environment support built in[1].

[1] https://docs.python.org/3/library/venv.html

-Ralph


Re: Configuring Python3 on MacOS Macports

2019-12-02 Thread Bill Cole

On 2 Dec 2019, at 13:50, Forrest wrote:

I'm new to Python and I'm trying to figure out why, for example, when 
I install aws-cli (from source) using Macports, it doesn't install 
properly vs /usr/bin/python that does the right thing and places the 
commands in proper places.   When I run "/opt/local/bin/python 
setup.py install" it ends up buried in directories under the Macports 
directory structure, which isn't usable.   Maybe I am missing some 
ENV variables?


Assuming you have Python 3.7 installed using MacPorts:

  port select python python37
  port install py37-awscli
  port select awscli py37-awscli

That gets you the current MacPorts version: 1.16.266. It gives you these 
symlinks in /opt/local/bin:


  aws -> /opt/local/bin/aws-3.7
  aws-3.7 -> 
/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin/aws

  aws.cmd -> /opt/local/bin/aws.cmd-3.7
  aws.cmd-3.7 -> 
/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin/aws.cmd
  aws_bash_completer-3.7 -> 
/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin/aws_bash_completer

  aws_completer -> /opt/local/bin/aws_completer-3.7
  aws_completer-3.7 -> 
/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin/aws_completer

  aws_zsh_completer.sh -> /opt/local/bin/aws_zsh_completer.sh-3.7
  aws_zsh_completer.sh-3.7 -> 
/opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin/aws_zsh_completer.sh




To update that installation to the latest (1.16.293) you can use pip:

  port install py37-pip
  port select pip pip37
  pip install awscli --upgrade --user



--
Bill Cole
b...@scconsult.com or billc...@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire


Re: Configuring Python3 on MacOS Macports

2019-12-02 Thread Christopher Jones
OK, I see.

Maybe though you could learn from what the macports port does, and try and 
replicate it. Note it does install stuff to ${prefix}/bin, as you want. e.g.

> port contents py37-awscli

  /opt/local/bin/aws-3.7
  /opt/local/bin/aws.cmd-3.7
  /opt/local/bin/aws_bash_completer-3.7
  /opt/local/bin/aws_completer-3.7
  /opt/local/bin/aws_zsh_completer.sh-3.7


so you should take a look into how it achieves that.

sudo port -s -d install py37-awscli

will force a build from source, with full debug output.

Another possibility is you clone the port and make a new ‘devel’ version of it, 
that takes the nightly snapshot you want instead of the released version, but 
uses the rest of the infrastructure just the same.

Chris

> On 2 Dec 2019, at 9:11 pm, Forrest  wrote:
> 
> I have a need to run the latest GIT of the aws-cli, so while the port is 
> there, I need to be able to compile and install the nightly code updates for 
> testing.
> 
> So I am building aws-cli from the GIT repository.
> 
> 
> Thanks.
> 
> 
> On 12/2/19 3:07 PM, Christopher Jones wrote:
>> 
>> OK.
>> 
>> So when you say build from source, do you mean using MacPorts port for this, 
>> or are you building directly yourself (and if the later, any reason why you 
>> are not using the port ?)
>> 
>> https://github.com/macports/macports-ports/blob/master/python/py-awscli/Portfile
>>  
>> 
>> 
>> 
>>> crjoberon ~ > port search awscli
>>> awscli_select @0.1 (python, sysutils)
>>> common files for selecting default awscli version
>>> 
>>> py-awscli @1.16.292 (python)
>>> Universal Command Line Environment for AWS.
>>> 
>>> py27-awscli @1.16.292 (python)
>>> Universal Command Line Environment for AWS.
>>> 
>>> py35-awscli @1.16.292 (python)
>>> Universal Command Line Environment for AWS.
>>> 
>>> py36-awscli @1.16.292 (python)
>>> Universal Command Line Environment for AWS.
>>> 
>>> py37-awscli @1.16.292 (python)
>>> Universal Command Line Environment for AWS.
>> 
>> 
>> 
>>> On 2 Dec 2019, at 8:43 pm, Forrest > 
>>> ie.com > wrote:
>>> 
>>> The /usr/bin/python installs the executable into /usr/local/bin. I'd be 
>>> fine if the Macports installed it in /opt/local/bin -- this makes me 
>>> believe there is a config directive I'm missing somewhere.
>>> 
>>> 
>>> 
>>> On 12/2/19 2:38 PM, Christopher Jones wrote:
 When you say " vs /usr/bin/python that does the right thing and places the 
 commands in proper places “  where exactly are you referring to ? Where 
 exactly do you want the macports provided python to install things to ?
 
> On 2 Dec 2019, at 7:50 pm, Forrest  > wrote:
> 
> I'm new to Python and I'm trying to figure out why, for example, when I 
> install aws-cli (from source) using Macports, it doesn't install properly 
> vs /usr/bin/python that does the right thing and places the commands in 
> proper places.   When I run "/opt/local/bin/python setup.py install" it 
> ends up buried in directories under the Macports directory structure, 
> which isn't usable.   Maybe I am missing some ENV variables?
> 
> 
> 
> F
> 
>>> 
>> 
> 



smime.p7s
Description: S/MIME cryptographic signature


Re: Configuring Python3 on MacOS Macports

2019-12-02 Thread Forrest
I have a need to run the latest GIT of the aws-cli, so while the port is 
there, I need to be able to compile and install the nightly code updates 
for testing.


So I am building aws-cli from the GIT repository.


Thanks.


On 12/2/19 3:07 PM, Christopher Jones wrote:


OK.

So when you say build from source, do you mean using MacPorts port for 
this, or are you building directly yourself (and if the later, any 
reason why you are not using the port ?)


https://github.com/macports/macports-ports/blob/master/python/py-awscli/Portfile



crjoberon ~ > port search awscli
awscli_select @0.1 (python, sysutils)
common files for selecting default awscli version

py-awscli @1.16.292 (python)
Universal Command Line Environment for AWS.

py27-awscli @1.16.292 (python)
Universal Command Line Environment for AWS.

py35-awscli @1.16.292 (python)
Universal Command Line Environment for AWS.

py36-awscli @1.16.292 (python)
Universal Command Line Environment for AWS.

py37-awscli @1.16.292 (python)
Universal Command Line Environment for AWS.





On 2 Dec 2019, at 8:43 pm, Forrest 


ie.com > wrote:

The /usr/bin/python installs the executable into /usr/local/bin. I'd 
be fine if the Macports installed it in /opt/local/bin -- this makes 
me believe there is a config directive I'm missing somewhere.




On 12/2/19 2:38 PM, Christopher Jones wrote:
When you say " vs /usr/bin/python that does the right thing and 
places the commands in proper places “  where exactly are you 
referring to ? Where exactly do you want the macports provided 
python to install things to ?


On 2 Dec 2019, at 7:50 pm, Forrest > wrote:


I'm new to Python and I'm trying to figure out why, for example, 
when I install aws-cli (from source) using Macports, it doesn't 
install properly vs /usr/bin/python that does the right thing and 
places the commands in proper places.   When I run 
"/opt/local/bin/python setup.py install" it ends up buried in 
directories under the Macports directory structure, which isn't 
usable.   Maybe I am missing some ENV variables?




F









Re: Configuring Python3 on MacOS Macports

2019-12-02 Thread Christopher Jones

OK.

So when you say build from source, do you mean using MacPorts port for this, or 
are you building directly yourself (and if the later, any reason why you are 
not using the port ?)

https://github.com/macports/macports-ports/blob/master/python/py-awscli/Portfile
 



> crjoberon ~ > port search awscli
> awscli_select @0.1 (python, sysutils)
> common files for selecting default awscli version
> 
> py-awscli @1.16.292 (python)
> Universal Command Line Environment for AWS.
> 
> py27-awscli @1.16.292 (python)
> Universal Command Line Environment for AWS.
> 
> py35-awscli @1.16.292 (python)
> Universal Command Line Environment for AWS.
> 
> py36-awscli @1.16.292 (python)
> Universal Command Line Environment for AWS.
> 
> py37-awscli @1.16.292 (python)
> Universal Command Line Environment for AWS.



> On 2 Dec 2019, at 8:43 pm, Forrest  ie.com> wrote:
> 
> The /usr/bin/python installs the executable into /usr/local/bin. I'd be fine 
> if the Macports installed it in /opt/local/bin -- this makes me believe there 
> is a config directive I'm missing somewhere.
> 
> 
> 
> On 12/2/19 2:38 PM, Christopher Jones wrote:
>> When you say " vs /usr/bin/python that does the right thing and places the 
>> commands in proper places “  where exactly are you referring to ? Where 
>> exactly do you want the macports provided python to install things to ?
>> 
>>> On 2 Dec 2019, at 7:50 pm, Forrest  wrote:
>>> 
>>> I'm new to Python and I'm trying to figure out why, for example, when I 
>>> install aws-cli (from source) using Macports, it doesn't install properly 
>>> vs /usr/bin/python that does the right thing and places the commands in 
>>> proper places.   When I run "/opt/local/bin/python setup.py install" it 
>>> ends up buried in directories under the Macports directory structure, which 
>>> isn't usable.   Maybe I am missing some ENV variables?
>>> 
>>> 
>>> 
>>> F
>>> 
> 



smime.p7s
Description: S/MIME cryptographic signature


Re: Configuring Python3 on MacOS Macports

2019-12-02 Thread Forrest
The /usr/bin/python installs the executable into /usr/local/bin. I'd be 
fine if the Macports installed it in /opt/local/bin -- this makes me 
believe there is a config directive I'm missing somewhere.




On 12/2/19 2:38 PM, Christopher Jones wrote:

When you say " vs /usr/bin/python that does the right thing and places the 
commands in proper places “  where exactly are you referring to ? Where exactly do 
you want the macports provided python to install things to ?


On 2 Dec 2019, at 7:50 pm, Forrest  wrote:

I'm new to Python and I'm trying to figure out why, for example, when I install aws-cli 
(from source) using Macports, it doesn't install properly vs /usr/bin/python that does 
the right thing and places the commands in proper places.   When I run 
"/opt/local/bin/python setup.py install" it ends up buried in directories under 
the Macports directory structure, which isn't usable.   Maybe I am missing some ENV 
variables?



F





Re: Configuring Python3 on MacOS Macports

2019-12-02 Thread Christopher Jones

When you say " vs /usr/bin/python that does the right thing and places the 
commands in proper places “  where exactly are you referring to ? Where exactly 
do you want the macports provided python to install things to ?

> On 2 Dec 2019, at 7:50 pm, Forrest  wrote:
> 
> I'm new to Python and I'm trying to figure out why, for example, when I 
> install aws-cli (from source) using Macports, it doesn't install properly vs 
> /usr/bin/python that does the right thing and places the commands in proper 
> places.   When I run "/opt/local/bin/python setup.py install" it ends up 
> buried in directories under the Macports directory structure, which isn't 
> usable.   Maybe I am missing some ENV variables?
> 
> 
> 
> F
> 



smime.p7s
Description: S/MIME cryptographic signature


Re: Configuring Python3 on MacOS Macports

2019-12-02 Thread Forrest
For aws-cli, I use the current code and this is how you install it, 
setup.py.


Again, when I use the system MacOS python, it does the right thing; when 
I use Macports python3, it ends up installing under a large tree under 
/opt, which is not the correct behavior.    So until I figure out the 
Macports version, I have been using the system python.


How would the virtual environment benefit me here?   It's just an AWS 
interface command, written in python.



_F



On 12/2/19 1:56 PM, Ruben Di Battista wrote:

Wait wait wait wait...

Why are you doing the `python setup.py` thing? I strongly discourage 
you to use the system python to install packages globally.


What I suggest you is to use virtualenvs.

* Install py-virtualenv
* Create virtualenv
* Activate  the virtual environment
* Install things locally to the virtual env using pip
* Deactivate when finished


This way you create isolated environments for each one of your 
applications without messing up with the system packages. You can then 
delete them if you don't need them anymore without the fear of 
destroying everything... :)


There are also other tools to make this even more pleasant (pew, pipenv).


On Mon, 2 Dec 2019, 19:51 Forrest, > wrote:


I'm new to Python and I'm trying to figure out why, for example,
when I
install aws-cli (from source) using Macports, it doesn't install
properly vs /usr/bin/python that does the right thing and places the
commands in proper places.   When I run "/opt/local/bin/python
setup.py
install" it ends up buried in directories under the Macports
directory
structure, which isn't usable.   Maybe I am missing some ENV
variables?



F





Re: Configuring Python3 on MacOS Macports

2019-12-02 Thread Ruben Di Battista
Wait wait wait wait...

Why are you doing the `python setup.py` thing? I strongly discourage you to
use the system python to install packages globally.

What I suggest you is to use virtualenvs.

* Install py-virtualenv
* Create virtualenv
* Activate  the virtual environment
* Install things locally to the virtual env using pip
* Deactivate when finished


This way you create isolated environments for each one of your applications
without messing up with the system packages. You can then delete them if
you don't need them anymore without the fear of destroying everything... :)

There are also other tools to make this even more pleasant (pew, pipenv).


On Mon, 2 Dec 2019, 19:51 Forrest,  wrote:

> I'm new to Python and I'm trying to figure out why, for example, when I
> install aws-cli (from source) using Macports, it doesn't install
> properly vs /usr/bin/python that does the right thing and places the
> commands in proper places.   When I run "/opt/local/bin/python setup.py
> install" it ends up buried in directories under the Macports directory
> structure, which isn't usable.   Maybe I am missing some ENV variables?
>
>
>
> F
>
>


Configuring Python3 on MacOS Macports

2019-12-02 Thread Forrest
I'm new to Python and I'm trying to figure out why, for example, when I 
install aws-cli (from source) using Macports, it doesn't install 
properly vs /usr/bin/python that does the right thing and places the 
commands in proper places.   When I run "/opt/local/bin/python setup.py 
install" it ends up buried in directories under the Macports directory 
structure, which isn't usable.   Maybe I am missing some ENV variables?




F