question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python interpreter is not the same in JupyterLab - Notebook vs Terminal

See original GitHub issue

in notebook:

import pandas 
import sys
print(sys.executable)

(pandas import works)


in terminal

python -c "import pandas" # fails
ls -lah $(which python)

let
  mach-nix = import (builtins.fetchGit {
    url = "https://github.com/DavHau/mach-nix/";
    ref = "refs/heads/master";
    #rev = "1bc3bee2d0eb3acaa4af106d242b8c4bd7ec66a4";
  });

  nixpkgs = import mach-nix.nixpkgs.path {config= { allowUnfree = true; };  };
  py = nixpkgs.python37Packages ;

  py_env = mach-nix.mkPython rec {
    pkgs = nixpkgs;
    python = nixpkgs.python37;
    requirements =  ''  
    ipython
    jupyterlab
    pandas
      '';

    providers = {

    };
  };
in 
nixpkgs.mkShell rec {
  buildInputs = [
    nixpkgs.bash
    nixpkgs.nix-tree

    ( (py_env).override( args:{ignoreCollisions=true; })  )
  ] ;

  shellHook = ''
        # # # install data/pretrained pipes from spark-nlp
        python -c "import pandas"

        jupyter lab 
        '';
}

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
InLawcommented, Sep 3, 2021

on the NixOS system there is no JupyterLab installed

  • only in nix-shells
0reactions
rokroskarcommented, Sep 3, 2021

are you sure the kernel you are using in the notebook is the nix-installed one and some other one found on your system?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change Interpreter in Jupyter notebook - Stack Overflow
When I execute the following code with Jupyter notebook I am getting the python installation within the Anaconda main folder and not the...
Read more >
VS Code does not show correct environment/interpreter in ...
I have this problem while using ipynb notebook, so I opened this issue ... Select Interpreter, or by clicking bottom left and doing...
Read more >
Jupyter Kernel not running same Python version as the Virtual ...
I want to be able to run both Python 3.8 (currrent version) and Python 3.7 in my Jupyter Notebook. I understand creating different...
Read more >
Working with Jupyter Notebooks in Visual Studio Code
To select an environment, use the Python: Select Interpreter command from the Command Palette (Ctrl+Shift+P).
Read more >
Writing and running Python code
Jupyter Notebooks are an application that combines source code with ... Python interpreter, and system terminal flexible and viewable within the same window ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found