pypi2nix icon indicating copy to clipboard operation
pypi2nix copied to clipboard

does pypi2nix respect $http_proxy/$https_proxy

Open krey opened this issue 7 years ago • 5 comments

Here's my output

pypi2nix v1.8.1 running ...

Stage1: Downloading wheels and creating wheelhouse ...
|-> nix-shell /nix/store/p1p2g1yq3s4axna8yylqni5c6q0yqzi8-pypi2nix-1.8.1/pkgs/pypi2nix/pip.nix --arg requirements_files [ "/tmp/pypi2nix/607b1e2462c5cd5bca9721e23d2396ae/2692d1fb09ce46a664dd6d1f5e7d214f.txt" ] --argstr project_dir /tmp/pypi2nix/607b1e2462c5cd5bca9721e23d2396ae --argstr download_cache_dir /tmp/pypi2nix/cache/download --argstr wheel_cache_dir /tmp/pypi2nix/cache/wheel --argstr pip_build_dir /tmp/pypi2nix/cache/pip --arg extra_build_inputs [  ] --argstr extra_env  --argstr python_version python36 --arg setup_requires [  ] -I nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/cfg:/nix/var/nix/profiles/per-user/root/channels:nixpkgs-overlays=/cfg/overlays --show-trace --pure --run exit
    warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/cfg:/nix/var/nix/profiles/per-user/root/channels:nixpkgs-overlays=/cfg/overlays' does not exist, ignoring
    Collecting pytesseract (from -r /tmp/pypi2nix/607b1e2462c5cd5bca9721e23d2396ae/2692d1fb09ce46a664dd6d1f5e7d214f.txt (line 1))
      Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fa36c94d898>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pytesseract/
      Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fa36c94dfd0>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/pytesseract/
^C
Aborted!

krey avatar Jul 05 '18 20:07 krey

@krey pypi2nix does not respect $http_proxy/$https_proxy. since - as you can see - we run nix-shell command with --pure flag. I think we should create a whitelist of environment variables which should be passed down to nix-shell. Would you be willing to implement this?

garbas avatar Jul 26 '18 14:07 garbas

I'm not a big fan of reimplementing the same in every app. @krey is tsocks not working?

spinus avatar Sep 09 '18 23:09 spinus

this would be easier to implement now with nix run and its option --ignore-environment and --keep

garbas avatar Dec 02 '18 10:12 garbas

Hello,

What would be the solution to bypass it? I try this :

nix run -i -k https_proxy nixpkgs.pypi2nix -c pypi2nix -V3 -r ../requirements.txt 
pypi2nix v1.8.1 running ...

Stage1: Downloading wheels and creating wheelhouse ...
Traceback (most recent call last):
  File "/nix/store/l209xhy9nbq1xqapq04a19y3vs30nr1v-pypi2nix-1.8.1/bin/.pypi2nix-wrapped", line 3, in <module>
    pypi2nix.cli.main()
  File "/nix/store/l209xhy9nbq1xqapq04a19y3vs30nr1v-pypi2nix-1.8.1/pkgs/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/nix/store/l209xhy9nbq1xqapq04a19y3vs30nr1v-pypi2nix-1.8.1/pkgs/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/nix/store/l209xhy9nbq1xqapq04a19y3vs30nr1v-pypi2nix-1.8.1/pkgs/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/nix/store/l209xhy9nbq1xqapq04a19y3vs30nr1v-pypi2nix-1.8.1/pkgs/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/nix/store/l209xhy9nbq1xqapq04a19y3vs30nr1v-pypi2nix-1.8.1/pkgs/pypi2nix/cli.py", line 320, in main
    extra_env=extra_env,
  File "/nix/store/l209xhy9nbq1xqapq04a19y3vs30nr1v-pypi2nix-1.8.1/pkgs/pypi2nix/stage1.py", line 72, in main
    returncode, output = pypi2nix.utils.cmd(command, verbose != 0)
  File "/nix/store/l209xhy9nbq1xqapq04a19y3vs30nr1v-pypi2nix-1.8.1/pkgs/pypi2nix/utils.py", line 53, in cmd
    stderr=stderr,
  File "/nix/store/96p42644i76jqgdkxjgyl3f0c8n8k16j-python3-3.7.4/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/nix/store/96p42644i76jqgdkxjgyl3f0c8n8k16j-python3-3.7.4/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'nix-shell': 'nix-shell'

apeyroux avatar Aug 20 '19 10:08 apeyroux

I have the same limitation. While all nix-tools work well with the proxy, pypi2nix does not, unfortunately. Why not passing as command line arguments to the underlying libraries as alternative.

zokrezyl avatar Aug 20 '19 16:08 zokrezyl