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

"nix-shell -p pythonPackages.setuptools" not working #24011

Closed
bjornfor opened this issue Mar 18, 2017 · 5 comments
Closed

"nix-shell -p pythonPackages.setuptools" not working #24011

bjornfor opened this issue Mar 18, 2017 · 5 comments

Comments

@bjornfor
Copy link
Contributor

Issue description

nix-shell -p pythonPackages.setuptools doesn't create an environment where "setuptools" can be imported.

Steps to reproduce

$ NIX_PATH=nixpkgs=$PWD nix-shell -p pythonPackages.setuptools --run "python -c 'import setuptools'"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named setuptools

However, if I replace pythonPackages.setuptools above with something random like pythonPackages.mechanize, the "import setuptools" statement runs just fine!

Technical details

  • System: NixOS
  • Nix version: 1.11.7
  • Nixpkgs version: 17.09.git.beb3493 (master as of today). Also happens on release-16.09 branch.
@FRidh
Copy link
Member

FRidh commented Mar 18, 2017

Add the --pure flag and see what happens.

Spoiler: setuptools doesn't propagate python so you're using your system Python.

@FRidh
Copy link
Member

FRidh commented Mar 18, 2017

We can add python to propagatedBuildInputs for consistency. Note that unstable will have #22210 soon.

@bjornfor
Copy link
Contributor Author

@FRidh: You're absolutely right.

Adding --pure:

NIX_PATH=nixpkgs=$PWD nix-shell --pure -p pythonPackages.setuptools --run "python -c 'import setuptools'"
/run/user/1000/nix-shell.HQesmE/rc: line 1: python: command not found

Adding python:

NIX_PATH=nixpkgs=$PWD nix-shell --pure -p pythonPackages.setuptools -p python --run "python -c 'import setuptools'"
(no error)

Thank you!

I find it weird that it worked with 'mechanize' (arbitrary package) but not 'setuptools' though...

@bjornfor
Copy link
Contributor Author

We can add python to propagatedBuildInputs for consistency.

Yes please :-)

@FRidh
Copy link
Member

FRidh commented Mar 18, 2017

I find it weird that it worked with 'mechanize' (arbitrary package) but not 'setuptools' though...

mechanize uses buildPythonPackage which adds python. setuptools is build differently.

We can add python to propagatedBuildInputs for consistency.
Yes please :-)

Let's wait till Hydra has catched up since this is a mass-rebuild.

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