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.gdal does not load gdal #50287

Closed
jmettes opened this issue Nov 12, 2018 · 3 comments
Closed

nix-shell -p pythonPackages.gdal does not load gdal #50287

jmettes opened this issue Nov 12, 2018 · 3 comments

Comments

@jmettes
Copy link
Contributor

jmettes commented Nov 12, 2018

Issue description

gdal is not available for importing after running nix-shell -p python3Packages.gdal

Steps to reproduce

$ nix-shell -p python3Packages.gdal
$ python
Python 3.6.3 (default, Oct  3 2017, 07:47:49) 
[GCC 6.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gdal
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'gdal'

It does not seem to be available in the path.

>>> import sys
>>> sys.path
['', '/nix/store/166s7l3yjqfc8dj5hfqjb09dbfvp1850-python3-3.6.3/lib/python36.zip', '/nix/store/166s7l3yjqfc8dj5hfqjb09dbfvp1850-python3-3.6.3/lib/python3.6', '/nix/store/166s7l3yjqfc8dj5hfqjb09dbfvp1850-python3-3.6.3/lib/python3.6/lib-dynload', '/home/jonathan/.local/lib/python3.6/site-packages', '/nix/store/166s7l3yjqfc8dj5hfqjb09dbfvp1850-python3-3.6.3/lib/python3.6/site-packages']

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the
results.

$ nix-shell -p nix-info --run "nix-info -m"
these paths will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/06ix6l8hb9962x5y90hv9lhvd22v0ra2-nix-info
copying path '/nix/store/06ix6l8hb9962x5y90hv9lhvd22v0ra2-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 4.14.61, NixOS, 18.09pre148461.bf1b50cbc8f (Jellyfish)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.0.4`
 - channels(root): `"nixos-19.03pre158246.6141939d6e0, nixpkgs-19.03pre158005.32340793aaf"`
 - channels(jonathan): `"nixos-19.03pre158005.32340793aaf, nixpkgs"`
 - nixpkgs: `/home/jonathan/.nix-defexpr/channels/nixpkgs`
@costrouc
Copy link
Member

Is this due to no propagatedBuildInputs? I checked and I could reproduce.

@matthewbauer
Copy link
Member

You have to include python as well. For example:

$ nix-shell -p python3Packages.python python3Packages.gdal --run 'echo $PYTHONPATH'
/nix/store/rpyns4fjgvdwc2v81xjkyv6d0mz3q6ay-python3-3.6.6/lib/python3.6/site-packages:/nix/store/frqypc141wkph1hxq9ady8w3fwxhbdnd-gdal-2.3.2/lib/python3.6/site-packages:/nix/store/rpyns4fjgvdwc2v81xjkyv6d0mz3q6ay-python3-3.6.6/lib/python3.6/site-packages:/nix/store/frqypc141wkph1hxq9ady8w3fwxhbdnd-gdal-2.3.2/lib/python3.6/site-packages

@FRidh
Copy link
Member

FRidh commented Nov 13, 2018

Yep, it's because Python is not propagated. Note this is not a bug, just a behavior that some expect to work.

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

4 participants