Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install of the CLI tools ignores flags provided to pip #119

Closed
josyoun opened this issue Feb 20, 2022 · 4 comments
Closed

pip install of the CLI tools ignores flags provided to pip #119

josyoun opened this issue Feb 20, 2022 · 4 comments

Comments

@josyoun
Copy link

josyoun commented Feb 20, 2022

It looks like the install script (setup.py) strips and ignores the --user flag from pip. This is important for Gentoo installs as to not corrupt the system Python. Basically, I get the following:

$ pip install --user https://cdn.evilmadscientist.com/dl/ad/public/AxiDraw_API.zip
Collecting https://cdn.evilmadscientist.com/dl/ad/public/AxiDraw_API.zip
  Using cached https://cdn.evilmadscientist.com/dl/ad/public/AxiDraw_API.zip (316 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-wgfoujw5/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-wgfoujw5/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-3q03l2yx
       cwd: /tmp/pip-req-build-wgfoujw5/
  Complete output (19 lines):
  WARNING: Skipping axidrawinternal as it is not installed.
  ERROR: (Gentoo) Please run pip with the --user option to avoid breaking python-exec
  Traceback (most recent call last):
    File "/tmp/pip-req-build-wgfoujw5/setup.py", line 46, in replacement_setup
      subprocess.check_call([sys.executable, '-m', 'pip', 'install', wheel_file])
    File "/usr/lib/python3.9/subprocess.py", line 373, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/usr/bin/python3.9', '-m', 'pip', 'install', 'prebuilt_dependencies/axidrawinternal-3.1.0-py2.py3-none-any.whl']' returned non-zero exit status 1.
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-req-build-wgfoujw5/setup.py", line 58, in <module>
      replacement_setup(
    File "/tmp/pip-req-build-wgfoujw5/setup.py", line 51, in replacement_setup
      raise RuntimeError("Could not install one or more prebuilt dependencies.", err.with_traceback(err.__traceback__))
  RuntimeError: ('Could not install one or more prebuilt dependencies.', CalledProcessError(1, ['/usr/bin/python3.9', '-m', 'pip', 'install', 'prebuilt_dependencies/axidrawinternal-3.1.0-py2.py3-none-any.whl']))
  WARNING: It looks like you might be attempting to install this in a non-pip way. This is discouraged. Use `pip install .` (or `pip install -r requirements.txt` if you are a developer with access to the relevant private repositories).
  ----------------------------------------
WARNING: Discarding https://cdn.evilmadscientist.com/dl/ad/public/AxiDraw_API.zip. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

That said, if I download the scripts by hand (AxiDraw_API_310r1) and modify setup.py to change:

                subprocess.check_call([sys.executable, '-m', 'pip', 'install', wheel_file])

to

                subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--user', wheel_file])

Everything works fine. Basically, I believe this call needs to include any command line flags provided to pip, such as --user, for some systems like Gentoo to install properly.

@oskay
Copy link
Contributor

oskay commented Feb 22, 2022

We don't want to implement that directly as stated here ( subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--user', wheel_file])) because we don't want that to be the default. However, I'm glad that you note the workaround, and we'll look into passing through additional flags.

@josyoun
Copy link
Author

josyoun commented Feb 23, 2022

Yes, I completely agree this flag should not be hard coded. Mostly, I wanted to document the issue and potential work around for others. I think feature request for passing through the flags is the right option. Thanks for having a look!

@oskay
Copy link
Contributor

oskay commented Apr 4, 2022

This is implemented in development builds and should be available by default in near-future releases.

@oskay
Copy link
Contributor

oskay commented Jun 13, 2022

The --user flag should be passed through as of the 3.3.0 release.

@oskay oskay closed this as completed Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants