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: add back wrapper #71778

Closed
wants to merge 2 commits into from
Closed

pipenv: add back wrapper #71778

wants to merge 2 commits into from

Conversation

FRidh
Copy link
Member

@FRidh FRidh commented Oct 23, 2019

Turns out that when creating a virtualenv, it ignores what has been injected
into sys.path with the magical sed expression. Also, NIX_PYTHONPATH is
not used.

Likely a subprocess is invoked in which case both are no longer visible.
That's the reason PYTHONPATH needs to be used.

Motivation for this change
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 @Kaali

Turns out that when creating a virtualenv, it ignores what has been injected
into `sys.path` with the magical sed expression. Also, `NIX_PYTHONPATH` is
not used.

Likely a subprocess is invoked in which case both are no longer visible.
That's the reason `PYTHONPATH` needs to be used.
@Kaali
Copy link

Kaali commented Oct 23, 2019

I tested this and now we get ModuleNotFoundError: No module named 'pip._internal.main' error again (related to #71178). But it does fix the missing virtualenv in #71771

@FRidh
Copy link
Member Author

FRidh commented Oct 23, 2019

Let me guess, you are using nix-shell?
Actually, no, that should not matter now since we set PYTHONPATH already.

@Kaali
Copy link

Kaali commented Oct 23, 2019

Let me guess, you are using nix-shell?

No. I'm installing pipenv in my system configuration.

To repeat you can try this Pipfile:

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[packages]
spacy = "~=2.1"

[requires]
python_version = "3.7"

One without any dependencies works fine.

@FRidh
Copy link
Member Author

FRidh commented Oct 23, 2019

Closing in favor of #71800.

@FRidh FRidh closed this Oct 23, 2019
@FRidh FRidh deleted the pipenv branch October 23, 2019 10:36
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.

None yet

2 participants