Opened 3 years ago

Last modified 3 years ago

#63067 new request

Default python environment and package installation

Reported by: forrie (Forrest) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: reneeotten (Renee Otten)
Port:

Description

I've encountered questions from several users concerning Macports and python. The default configuration seems not to install packages correctly. That is, when you install a package (ie: ansible) from source, it ends up buried under the Python library and no pointers or otherwise are configured in /opt/local/bin. I've not been able to figure out why this occurs, but I wonder if it would make sense to fix this. I suspect it's the stock ENV or that certain variables need to be set up ahead of time (is this documented somewhere, i've not found it).

I performed a test today, installing ansible from source and experienced the same effect. I don't use python personally, so hence I'm asking about it here as it applies to a larger context.

Change History (4)

comment:1 Changed 3 years ago by reneeotten (Renee Otten)

I am not sure I fully understand your question.

I performed a test today, installing ansible from source and experienced the same effect. I don't use python personally, so hence I'm asking about it here as it applies to a larger context.

what did you do (i.e., please provide the exact command) and how was the end result wrong, or at least different, than what you expected?

Also, out of curiosity, where did you encountered several questions from users regarding MacPorts and Python? I don’t think we have seen many here or on the mailinglist.

Last edited 3 years ago by reneeotten (Renee Otten) (previous) (diff)

comment:2 Changed 3 years ago by reneeotten (Renee Otten)

Cc: reneeotten added

comment:3 Changed 3 years ago by forrie (Forrest)

Sorry for the delay.

A good example, check out the code to ansible and install it with the Macports Python. The code gets buried under the python lib, but the executable is not placed in the operating PATH (ie: /opt/local/bin).

This applies to all packages installed from source in this manner. So I am trying to determine whether this is an environment variable or some other configuration directive that we're missing.

comment:4 Changed 3 years ago by reneeotten (Renee Otten)

as I asked before, please give the exact command of what you tried to install...

The port ansible doesn't install because it is replaced by py-ansible. So I am assuming for now that you did sudo port install py39-ansible. That port will automatically install its dependency (py39-ansible-base), which contains the executables.

There are indeed two sets of them: one in the Python.framework directory and the others in ${prefix}/bin, the latter ones have the postfix -3.9 or something else depending on which Python version you installed them for. So you can run the program by doing ansible-3.9 or, as the instructions tell you when installing the port you can select the version that you want to run when just typing ansible. Admittedly, these instruction sometimes get buried in the full MacPorts output so you might have missed them; you can look at them again by doing port notes py39-ansible-base.

This is the way it is supposed to work in MacPorts; since you often can install packages for different Python versions at the same time the Python version gets added to the files installed in bin. For the most commonly used packages there is often a select option that can be used to select the version you would like to run without specifying the version.

I hope this helps! If it doesn't answer your question you will have to be more specific about what you exactly did and what the (unexpected) result is, as I said above as well.

Last edited 3 years ago by reneeotten (Renee Otten) (previous) (diff)
Note: See TracTickets for help on using tickets.