Re: Installation location for python code, tools, etc.

2022-01-02 Thread Forrest Aldrich
Thanks for the quick replies.  I understand installing these in /opt may 
cause problems.   Looks like I will need to redo my Macports 
installation soon (grin).   I could try venv, or perhaps just set a 
separate PATH that my third-party stuff gets installed into -- once I 
figure out how to set that option.


Thanks!



Re: Installation location for python code, tools, etc.

2022-01-02 Thread Joshua Root

I'm not very experienced with Python, yet, but with regard to MacPorts,
I'm trying to understand why when I do a pip3 install, or a direct
install from a project tree ie: "python setup.py install" the tool(s)
end up in this directory instead of /opt/local/bin|sbin etc:

/opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/


Python is typically built as a framework on macOS, so that's where the 
modules go. See 
.


% python3.9
Python 3.9.9 (main, Nov 16 2021, 17:57:38)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.prefix
'/opt/local/Library/Frameworks/Python.framework/Versions/3.9'

Pip has a number of options controlling where things are installed: 



I strongly recommend not installing modules into the MacPorts prefix 
with pip (or manually), because modules installed in other ways will 
conflict with modules installed by MacPorts. Install in a venv, or use 
pip's --user option or some completely separate prefix.


- Josh



Re: Installation location for python code, tools, etc.

2022-01-02 Thread Bill Cole

On 2022-01-02 at 16:23:34 UTC-0500 (Sun, 2 Jan 2022 16:23:34 -0500)
Forrest Aldrich 
is rumored to have said:

I'm not very experienced with Python, yet, but with regard to 
MacPorts, I'm trying to understand why when I do a pip3 install, or a 
direct install from a project tree ie: "python setup.py install" the 
tool(s) end up in this directory instead of /opt/local/bin|sbin etc:


/opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/


This is how MacPorts supports simultaneous installs of different Python 
versions. You may note that there are versioned python symlinks in 
/opt/local/bin pointing to that path and possibly an additional bunch of 
symlinks making 'python' and 'python3' go there. If you install the 
python_select and python3_select ports, they will create links in 
/opt/local/bin if you run 'port select python' or 'port select python3' 
that ultimately resolve to that versioned path.


When you install a Python module outside of MacPorts, its installer is 
almost certain to not know to create those links.



I'm suspecting an environment variable.


I believe that *in theory* you should get binaries into 
/opt/local/(s)bin/ if you set the PYTHONHOME environment variable to 
'/opt/local/Library/Frameworks/Python.framework/Versions/3.9:/opt/local' 
when running setup.py or pip.



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


Installation location for python code, tools, etc.

2022-01-02 Thread Forrest Aldrich
I'm not very experienced with Python, yet, but with regard to MacPorts, 
I'm trying to understand why when I do a pip3 install, or a direct 
install from a project tree ie: "python setup.py install" the tool(s) 
end up in this directory instead of /opt/local/bin|sbin etc:


/opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/

I'm suspecting an environment variable.


Thanks.



Re: Building Ruby gems with MacPorts Ruby

2022-01-02 Thread Joshua Root

It appears that the ruby31 port is missing something, as I can install ruby30, 
switch to it with sudo port select --set ruby ruby30, then install gems no 
problem.
I just had a look and ruby31 is indeed doing something wrong. Here's the 
ticket I filed: 


- Josh



Re: Building Ruby gems with MacPorts Ruby

2022-01-02 Thread Andreas Yankopolus
It appears that the ruby31 port is missing something, as I can install ruby30, 
switch to it with sudo port select --set ruby ruby30, then install gems no 
problem.

> On Jan 2, 2022, at 1:48 PM, Andreas Yankopolus  wrote:
> 
> All—
> 
> I’ve installed Ruby with sudo port install ruby31 and want to install 
> middleman  with sudo gem install middleman. This 
> gives an error that header files for building gems are not present in 
> /opt/local/lib/ruby3.1/include:
> 
> Building native extensions. This could take a while...
> ERROR:  Error installing middleman:
>   ERROR: Failed to build gem native extension.
> 
> current directory: 
> /opt/local/lib/ruby3.1/gems/3.1.0/gems/ffi-1.15.4/ext/ffi_c
> /opt/local/bin/ruby3.1 -I /opt/local/lib/ruby3.1/3.1.0 -r 
> ./siteconf20220102-15848-cuiju7.rb extconf.rb
> mkmf.rb can't find header files for ruby at 
> /opt/local/lib/ruby3.1/include/ruby.h
> 
> You might have to install separate package for the ruby development
> environment, ruby-dev or ruby-devel for example.
> 
> extconf failed, exit code 1
> 
> Gem files will remain installed in 
> /opt/local/lib/ruby3.1/gems/3.1.0/gems/ffi-1.15.4 for inspection.
> Results logged to 
> /opt/local/lib/ruby3.1/gems/3.1.0/extensions/arm64-darwin-21/3.1.0/ffi-1.15.4/gem_make.out
> 
> What MacPorts package(s) do I need for installing these headers? I’ve had no 
> luck searching on https://ports.macports.org/  
> for ruby.h
> 
> Cheers,
> 
> Andreas