Jupyter notebook kernels do not launch in notebook's directory - linux

I run:
Jupyter 4.2.0
notebook 4.2.3
Linux Mint 18
The notebook application starts correctly and in the correct directory. But when I open a notebook, the python kernel is launched in ~/user and not in the notebooks directory (as it used to be). This problems seems to be happening since I encrypted my home folder.
Could this be a permission issue ?

Related

How to have dedicated Jupyter notebook configuration files on one machine

I am running a Windows 10 machine, where I have a Python installation installed from one of the programs I am working with. This leads to dependencies of this program to specific versions of Python packages, including Jupyter and Jupyterlab, and I cannot update/upgrade them without breaking the functionality in the original program.
Hence, I decided to install a more recent version of Python in addition to the one I already have on my machine. That was also not the issue, and installing all the packages I was after went fine so far.
However, even though I installed nodejs and npm within the new version of Python, when attempting to install a widget in Jupyterlab, it still does not recognize the packages.
In addition, wen running jupyter-lab.exe --generate-config, I am getting asked, if I want to override the existing configuration file.
I have no intention to do so, but would like to be able to configure the different jupyter notebook environments separate from each other.
Is there a possibility to do so?

pyspark to open directly in jupyter-lab

Installed below apps on windows 10
Install apache spark 3.1.3
Installed Hadoop 3.3.2
Installed Jupyter-lab
When i execute pyspark or spark-shell from command line. I get the below output which mean apache spark got installed/configured correctly
When in execute pyspark from command line, i want jupyter-lab interface to be opened automatically.
When i set the below environment variable jupyter notebook opens automatically
PYSPARK_DRIVER = C:\Users\xxxx\AppData\Local\Programs\Python\Python39\Scripts\jupyter.exe
PYSPARK_DRIVER_PYTHON_OPTS = notebook
I tried below setting, but no luck
PYSPARK_DRIVER = C:\Users\xxxx\AppData\Local\Programs\Python\Python39\Scripts\jupyter-lab.exe
PYSPARK_DRIVER_PYTHON_OPTS = lab
What environment variables, i need to set in order to open jupyter-lab directly. How to specify the kernel in jupyter kernels ?

Jupyter not working in VSCode Virtual Envirronemnt

I am new to jupyter and right from start I am trying to run it in VSCode and that too with a virtual environment. I hope that is not too much for you guys.
So here are steps I did;
I installed python and vscode
Added Paths in windows and all virtual environment things work fine
For data processing I created new virtual environment 'DataProcessingVenv'
I opened this venv in Terminal in VSCode and installed Pandas
I did pip install Jupyter
I did pip install ipykernel
next did ipython kernel install --user --name=DataProcessingVenv
In VSCode I created new notebook
pressed Ctrl+Shift+P and selected interpreter as /DataProcessingVenv/Scripts/Python.exe
Now I am trying to read a csv present in same fodler where notebook is present but somehow it is not working. I really don't know what is wrong and where, even don't know if I have provided all required info to solve the issue. Please guide me it some more info is required or if I can do something to solve the issue. I am attaching the current image in VSCode with error at the end.
So at the end the solution was simple. But it took time to learn. I just had to run all previous cells in Jupyter to make the current cell work.

VSCode remote Python virtual environment

Here is how the thing doesn't work:
The project source code is located on a remote machine. The Python virtual environment is installed in the project's root directory (using venv).
I sshfs the project folder and start local VSCode. It detects the virtual environment, but doesn't see pylint or other packages installed in it.
Python 3.6.7
VS Code - latest version
OSs - Debian 9 remote, Linux Mint 19 local
Both sshfs connection and venv installation are performed under the same account.
Is there some special way a virtual environment should be set up to be usable remotely?
There were problems with sshfs in early VSCode versions, but recent distrib has Remote Development extension that lets you develop your code via ssh.
Since you have activated your virtual environment, just get venv python path with which python command and copy it to the Select Interpreter menu.
Activate your python environment:
source venv/bin/activate
Find which python path you are using:
which python
Usually it is in :
venv/bin/python
Go to the bottom of VS Code, and click on the version number :
Click on Enter interpreter path... :
Enter the path you found above with the which python command.

Jupyter notebook will not open from command prompt

I am trying to work with Jupyter notebook on Windows 10 (64-bit). I downloaded Anaconda3 5.0.1. Now I should be able to open the jupyter notebook from the command prompt by typing jupyter notebook. However I get the following error:
The only way I am able to open jupyter notebook is from the Anaconda navigator. However, I would like to change the directory from which the notebook opens and none of the solutions here How to change the Jupyter start-up folder work if I cannot open jupyther from the command prompt. I have already tried uninstalling and reinstalling anaconda, but that did not change anything.
This error is because you didn't set environment after installing Anaconda.
Go through following steps to solve this issue
Search in start "Edit the system environment variable" and open it.
Click environment variables button
Go to there and add 2 directory path where you installed Anaconda
i.e. 1. C:\ProgramData\Anaconda3
2. C:\ProgramData\Anaconda3\Scripts
Hope this will solve your error :)
If you have:
Jupiter installed directly from Python (not anaconda)
PATH already configured (in case of not, you can do it manually from Windows system advanced menu)
try with: py -m jupyter notebook
It should work ;)

Resources