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

manual: "python modules using pip in a virtualenv" example don't work #43737

Open
davidak opened this issue Jul 18, 2018 · 4 comments
Open

manual: "python modules using pip in a virtualenv" example don't work #43737

davidak opened this issue Jul 18, 2018 · 4 comments
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: python

Comments

@davidak
Copy link
Member

davidak commented Jul 18, 2018

Issue description

[davidak@nixos:~/test]$ nix-shell 
these paths will be fetched (10.58 MiB download, 52.88 MiB unpacked):
  /nix/store/51zrpaysgqxr2m40h6qg4jhibzgpw09j-libxslt-1.1.32-py
  /nix/store/85nxa2jwgj3wqzyvc3wy8172fpml78qj-python-2.7.15
  /nix/store/8rf3qalbykr0y4l6wnmjgm9crgb82w52-python2.7-pip-9.0.1
  /nix/store/c8xna3dajanqz84jphwg08nca18cmfx0-libzip-1.3.0-dev
  /nix/store/ddcp1awgbcnkbg4crkqv6pqmawqa61vj-libzip-1.3.0
  /nix/store/gjqbxhyjsvn1j0z3m3ld7l5v6kczib2c-python-recursive-pth-loader-1.0
  /nix/store/m9d4pfi6kag8mc0i1zxl1zzsnwzc6x8y-python2.7-virtualenv-15.1.0
copying path '/nix/store/gjqbxhyjsvn1j0z3m3ld7l5v6kczib2c-python-recursive-pth-loader-1.0' from 'https://cache.nixos.org'...
copying path '/nix/store/51zrpaysgqxr2m40h6qg4jhibzgpw09j-libxslt-1.1.32-py' from 'https://cache.nixos.org'...
copying path '/nix/store/85nxa2jwgj3wqzyvc3wy8172fpml78qj-python-2.7.15' from 'https://cache.nixos.org'...
copying path '/nix/store/8rf3qalbykr0y4l6wnmjgm9crgb82w52-python2.7-pip-9.0.1' from 'https://cache.nixos.org'...
copying path '/nix/store/ddcp1awgbcnkbg4crkqv6pqmawqa61vj-libzip-1.3.0' from 'https://cache.nixos.org'...
copying path '/nix/store/m9d4pfi6kag8mc0i1zxl1zzsnwzc6x8y-python2.7-virtualenv-15.1.0' from 'https://cache.nixos.org'...
copying path '/nix/store/c8xna3dajanqz84jphwg08nca18cmfx0-libzip-1.3.0-dev' from 'https://cache.nixos.org'...
New python executable in /home/davidak/test/venv/bin/python2.7
Also creating executable in /home/davidak/test/venv/bin/python
Installing pip, wheel...done.
Traceback (most recent call last):
  File "/home/davidak/test/venv/bin/pip", line 7, in <module>
    from pip._internal import main
ImportError: No module named _internal

Same with Python 3:

...
Traceback (most recent call last):
  File "/home/davidak/code/mein/venv/bin/pip", line 7, in <module>
    from pip._internal import main
ImportError: No module named 'pip._internal'

related to #26876 #33713 #39558

cc @domenkozar

Steps to reproduce

  1. copy example into default.nix as is https://nixos.org/nixpkgs/manual/#how-to-consume-python-modules-using-pip-in-a-virtualenv-like-i-am-used-to-on-other-operating-systems
  2. create requirements.txt with "requests" as content
  3. nix-shell

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.14.55, NixOS, 18.03.132865.411cc559c05 (Impala)
  • multi-user?: no
  • sandbox: yes
  • version: nix-env (Nix) 2.0.4
  • channels(root): "nixos-18.03, nixos-hardware, nixos-unstable-18.09pre143771.a8c71037e04"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs
@FRidh
Copy link
Member

FRidh commented Jul 18, 2018

Was added in #21837 by @Azulinho who may help.

@Azulinho
Copy link
Contributor

yeap, I had that problem a few weeks ago, think it was related to some pip update
this is what I have on my default.nixs for python

┌─[azul][w520][~/nix-shell-profiles]
└─▪ cat python.nix 
with import <nixpkgs> {};
with pkgs.python27Packages;

buildPythonPackage { 
  name = "impurePythonEnv";
  buildInputs = [
    taglib
    openssl
    git
    libxml2
    libxslt
    libzip
    python27Full
    python27Packages.virtualenv
    python27Packages.pip
    stdenv
    libffi
    zlib ];
  src = null;
  # When used as `nix-shell --pure`
  shellHook = ''
  unset http_proxy
  export GIT_SSL_CAINFO=/etc/ssl/certs/ca-bundle.crt
  virtualenv --no-wheel --no-setuptools venv 
  wget -c https://bootstrap.pypa.io/get-pip.py
  venv/bin/python get-pip.py
  venv/bin/pip install -r requirements.txt --no-use-wheel
  venv/bin/pip install jedi
  venv/bin/pip install ipython==5.2.0
  venv/bin/pip install pylint
  venv/bin/pip install flake8
  export PATH=$PWD/venv/bin:$PATH
  '';
}

@FRidh
Copy link
Member

FRidh commented Jul 18, 2018

think it was related to some pip update

Correct, pip 10 moved some private modules which certain tools were using.

@stale
Copy link

stale bot commented Jun 4, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: python
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants