How to call easy_install argparse after installation

Kubilay Kocak koobs at FreeBSD.org
Sun Apr 30 04:40:14 UTC 2017


On 4/28/17 7:06 PM, Hongjiang Zhang via freebsd-ports wrote:
> Hi all,
> 
> I'm trying to create a new ports app, which is a python application
> and depends on argparse. For python 2.7, argparse is builtin. 
> Unfortunately, when the app is starting, it complains:
> 
> pkg_resources.DistributionNotFound: The 'argparse' distribution was
> not found and is required by XXX
> 
> According to the argparse document, the fix is one of the followings.
> My question is how can I invoke "easy_install argparse" in my
> Makefile? By the way, argparse has already been removed from ports.
> 
> 1.  python setup.py install 2.  easy_install argparse 3.  pip install
> argparse 4.  putting argparse.py in some directory listed in sys.path
> should also work

Hi Hongjiang,

If the application or its author(s) need or want to maintain Python 2.6,
3.0, 3.1, 3.2 compatibility, the application needs to be fixed
(upstream) to only add the install_requires=['argparse'] dependency (in
setup.py) for versions ( < 2.7 OR ( > 3 AND < 3.2)). ie; only those
Python versions that *don't* contain argparse in their standard library.

In no cases should a FreeBSD port/package call easy_install, pip or
other respective setuptools/distutils functionality itself.

What I would try instead is to remove (patch out) the unconditional
install_requires=['argparse'] entry from setup.py, and test the
application functionality without it, as import argparse should "just
work" whether using the standard library or the package, and in
FreeBSD's case for all supported Python versions, argparse is available
built-in.

./koobs


More information about the freebsd-ports mailing list