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

pipenv: fix dependencies #71656

Merged
merged 1 commit into from Oct 22, 2019
Merged

pipenv: fix dependencies #71656

merged 1 commit into from Oct 22, 2019

Conversation

FRidh
Copy link
Member

@FRidh FRidh commented Oct 22, 2019

  • setup_requires belong in nativeBuildInputs
  • requests is only for Python 2. We offer only a Python 3 version of
    pipenv
  • setting PYTHONPATH is not needed because the magical sed expression
    injects the dependencies in the executables. Otherwise, we would use
    NIX_PYTHONPATH.
  • PIP_IGNORE_INSTALLED was needed because of PYTHONPATH, but since we do
    not set that anymore we can remove.
Motivation for this change

Fixes #71110

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @berdario

- setup_requires belong in nativeBuildInputs
- requests is only for Python 2. We offer only a Python 3 version of
pipenv
- setting PYTHONPATH is not needed because the magical sed expression
injects the dependencies in the executables. Otherwise, we would use
NIX_PYTHONPATH.
- PIP_IGNORE_INSTALLED was needed because of PYTHONPATH, but since we do
not set that anymore we can remove.
@FRidh
Copy link
Member Author

FRidh commented Oct 22, 2019

cc recent contributors @adisbladis @greydot @dgarzon @zimbatm

@FRidh
Copy link
Member Author

FRidh commented Oct 22, 2019

Following works fine:

nix run -f . pipenv
pipenv install pip==18.0
pipenv shell
pip --version

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is incompatible with the current pip package

The PYTHONPATH from my env could be affecting it, but not sure:

pipenv install requests faillure
[nix-shell:/home/jon/.cache/nix-review/pr-71656]$ pipenv shell
Creating a virtualenv for this project…
Pipfile: /home/jon/.cache/nix-review/pr-71656/Pipfile
Using /nix/store/4g2ilwnk4mj4g68rc52kygx7gcqxnjd0-python3-3.7.5/bin/python3.7 (3.7.5) to create virtualenv…
⠴ Creating virtual environment...Already using interpreter /nix/store/4g2ilwnk4mj4g68rc52kygx7gcqxnjd0-python3-3.7.5/bin/python3.7
Using base prefix '/nix/store/4g2ilwnk4mj4g68rc52kygx7gcqxnjd0-python3-3.7.5'
New python executable in /home/jon/.local/share/virtualenvs/pr-71656-dDGjY3Jj/bin/python3.7
Also creating executable in /home/jon/.local/share/virtualenvs/pr-71656-dDGjY3Jj/bin/python
Installing setuptools, pip, wheel...
done.

✔ Successfully created virtual environment!
Virtualenv location: /home/jon/.local/share/virtualenvs/pr-71656-dDGjY3Jj
Creating a Pipfile for this project…
Launching subshell in virtual environment…
 . /home/jon/.local/share/virtualenvs/pr-71656-dDGjY3Jj/bin/activate
[07:43:41] jon@jon-desktop /home/jon/.cache/nix-review/pr-71656
$  . /home/jon/.local/share/virtualenvs/pr-71656-dDGjY3Jj/bin/activate
(pr-71656) [07:43:41] jon@jon-desktop /home/jon/.cache/nix-review/pr-71656
$ pipenv install requests
Installing requests…
Adding requests to Pipfile's [packages]…
✔ Installation Succeeded
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
✔ Success!
Updated Pipfile.lock (444a6d)!
make[4]: Entering directory '/build/gettext-0.19.8.1/gettext-tools/src'
Installing dependencies from Pipfile.lock (444a6d)…
An error occurred while installing certifi==2019.9.11 --hash=sha256:e4f3620cfea4f83eedc95b24abd9cd56f3c4b146dd0177e83a21b4eb49e21e50 --hash=sha256:fd7c7c74727ddcf00e9acd26bba8da604ffec95bf1c2144e67aff7a8b50e6cef! Will try again.
An error occurred while installing chardet==3.0.4 --hash=sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae --hash=sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691! Will try again.
An error occurred while installing idna==2.8 --hash=sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407 --hash=sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c! Will try again.
An error occurred while installing requests==2.22.0 --hash=sha256:11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4 --hash=sha256:9cf5292fcd0f598c671cfc1e0d7d1a7f13bb8085e9a590f48c010551dc6c4b31! Will try again.
An error occurred while installing urllib3==1.25.6 --hash=sha256:3de946ffbed6e6746608990594d08faac602528ac7015ac28d33cee6a45b7398 --hash=sha256:9a107b99a5393caf59c7aa3c1249c16e6879447533d0887f4336dde834c7be86! Will try again.
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 5/5 — 00:00:00
Installing initially failed dependencies…
  ☤  ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 5/5 — 00:00:02
[pipenv.exceptions.InstallError]:   File "/nix/store/1vxmxizk1229sy4dgj4ghhyh9q2vz6aq-pipenv-2018.11.26/lib/python3.7/site-packages/pipenv/cli/command.py", line 254, in install
[pipenv.exceptions.InstallError]:       editable_packages=state.installstate.editables,
[pipenv.exceptions.InstallError]:   File "/nix/store/1vxmxizk1229sy4dgj4ghhyh9q2vz6aq-pipenv-2018.11.26/lib/python3.7/site-packages/pipenv/core.py", line 1992, in do_install
[pipenv.exceptions.InstallError]:       skip_lock=skip_lock,
[pipenv.exceptions.InstallError]:   File "/nix/store/1vxmxizk1229sy4dgj4ghhyh9q2vz6aq-pipenv-2018.11.26/lib/python3.7/site-packages/pipenv/core.py", line 1253, in do_init
[pipenv.exceptions.InstallError]:       pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]:   File "/nix/store/1vxmxizk1229sy4dgj4ghhyh9q2vz6aq-pipenv-2018.11.26/lib/python3.7/site-packages/pipenv/core.py", line 862, in do_install_dependencies
[pipenv.exceptions.InstallError]:       _cleanup_procs(procs, False, failed_deps_queue, retry=False)
[pipenv.exceptions.InstallError]:   File "/nix/store/1vxmxizk1229sy4dgj4ghhyh9q2vz6aq-pipenv-2018.11.26/lib/python3.7/site-packages/pipenv/core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]:       raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: []
[pipenv.exceptions.InstallError]: ['Traceback (most recent call last):', '  File "/home/jon/.local/share/virtualenvs/pr-71656-dDGjY3Jj/bin/pip", line 6, in <module>', '    from pip._internal.main import main', "ModuleNotFoundError: No module named 'pip._internal.main'"]
ERROR: ERROR: Package installation failed...

@FRidh
Copy link
Member Author

FRidh commented Oct 22, 2019

Do not use nix-shell. That exports PYTHONPATH. Use nix run instead.

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nix-review passes on NixOS
executable seems to work (had to unset PYTHONPATH :) )

https://github.com/NixOS/nixpkgs/pull/71656
1 package were build:
pipenv

@jonringer jonringer merged commit 7f63ecf into NixOS:master Oct 22, 2019
@FRidh FRidh deleted the pipenv branch October 22, 2019 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pipenv: do not export PYTHONPATH in wrapper
2 participants