Pip: The --target option clashes with other command line flags and config files

Created on 30 Mar 2017  路  21Comments  路  Source: pypa/pip

The --target option clashes with several other command like flags and config files like --user and distutils setup. Ideally we should handle this far more gracefully.

See also #3826, #4106, #562, #4139

editable target triage

Most helpful comment

Is there an update for this? its pretty essential for creating zips to deploy on aws lambda

All 21 comments

I have made an attempt to fix the behavior of --target in PR #4111.

4111 was rebased to #4557

Current pull request is: https://github.com/pypa/pip/pull/4557 isn't it?

The bug disappears with the latest pip 18.0.

This related issue still appears with pip 18.0
https://github.com/pypa/setuptools/issues/392

Can confirm, this issue still persists.

Getting this error when installing with pipenv a local -e module:

  Running setup.py develop for Flask-Serverless
    Complete output from command /Users/cyber/.virtualenvs/jbwidgets-Jr4Btlt8/bin/python3.7 -c "import setuptools, tokenize;__file__=
'/Users/cyber/dev/flask-serverless/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close(
);exec(compile(code, __file__, 'exec'))" --no-user-cfg develop --no-deps --home=/private/var/folders/n8/rmzyc9yx2zvbc978_p6y_by40000g
n/T/pip-target-1lg_9i3s:
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: option --home not recognized

It still doesn't work.

Does anyone have any advice on how to work around this issue? It's particularly problematic when dealing with private repositories (since the -e flag breaks things), and this issue essentially makes it impossible to work with private repositories on serverless setups.

I have the same issue which breaks the deployment of serverless functions. The workaround with setting the prefix= to blanck in ~/.pydistutils.cfg does not work. Does anyone have another idea?

6008 might fix some of this. Not sure what needs to be done on that or if it just needs to be reviewed?

Is there an update for this? its pretty essential for creating zips to deploy on aws lambda

Solved this for the time being on Ubuntu 18.04.2 LTS with
setting the prefix= to blank in /root/.pydistutils.cfg
and sudo pip install <Package> --target <dir>

any update on this issue? I'm still getting error: option --home not recognize when I run the command

pip install \
  --target . \
  --editable git+ssh://[email protected]/myOrg/myPackage@master#egg=my-package

Is there any workaround? I'm having the same issue. pip install -r requirements with '--target' fails.

@joinsito It is impossible to suggest workarounds without information on your runtime configurations and environment.

@joinsito I was trying to package libraries for AWS Lambda and was getting this issue. Their documentation had a helpful suggestion:

In order for --target to work on Debian-based systems like Ubuntu, you may also need to pass the --system flag to prevent distutils errors.

So by adding the --system flag to the list of arguments, I was able to resolve my particular issue

@lorenzoLectrefy Maybe this could be a workaround for your case:

pip wheel \
  --src . \
  --editable git+ssh://[email protected]/myOrg/myPackage@master#egg=my-package

I just posted (half) a PR that enables at least some of this. Not sure if it's what the team had in mind, but I'm open to making changes.

PR #8555

This is also covered by https://github.com/pypa/pip/pull/7828.

This is also covered by #7828.

Not quite. My change makes it so that --target on the command line will override the PIP_USER environment variable (also --prefix, which now I think about it isn't quite right?).

But #7828 is a good looking change to take _as well_. We'll just have to update the "check for incompatible options" part of it to allow CLI flags to override other defaults.

Was this page helpful?
0 / 5 - 0 ratings