open question on python ...

Joshua Root jmr at macports.org
Fri May 11 21:43:12 UTC 2018


Frederic Dubois wrote:
> Hi, 
> 
> This is an open question concerning the "good" way to manage python "modules". 
> As you probably know python proposes various builtin "module" managers (such as pip). 
> 
> A first question : is it equivalent to use port to manage "python + module" and port to manage "python" and pip to manage "module" ? 
> Since now I tough that the first solution was the best since module compilation is adapted to macos. Am I right ? Any comment ? 

We have ports of python modules for two main reasons: so they can be
used as dependencies of other ports, and so they can use other ports as
dependencies. We don't attempt to provide all modules on PyPI as ports.
So a big difference is that the set of available modules is not the same.

You can install some modules as ports and others with pip. However it's
very much not recommended to use 'sudo pip ...' with the default
installation path, as that will install modules to the same place as the
corresponding ports and will cause conflicts. Running pip as a normal
user and installing to somewhere else like your home directory is fine.

> A second question : python3 proposes builtin virtual environments management (venv) which is deeply related to pip. 
> In case of using port to manage "python + module" how to do it ? 
> 
> I hope I am clear and thanks in advance for your answers. 

Using pip in a virtualenv is fine, and can be very useful if you need a
stable set of modules at specific versions for a project.

- Josh


More information about the macports-users mailing list