Python is installed in Linux, as shown in terminal, but why does jupyter notebook on vscode always say not Python is installed?
Thanks a lot.
Have you selected a python environment which has jupyter notebook installed.
Install jupyter notebook in environment:
pip install jupyter notebook
Select environment in VSCode:
https://code.visualstudio.com/docs/python/environments#_select-and-activate-an-environment
Related
I'm using Ubuntu, installed Vs Code and anaconda. I've also installed python extension in VS Code, which brings Jupyter Notebook extension. Now, whenever I'm trying to run code from the Jupyter extension, its throwing error as if it requires ipykernel.
Now, my conda 'base' environment has already ipykernel. Why cant Jupyter extension look for ipykernel from the current activated environment?
Is there any explicit settings to be made, to make VS Code Jupyter extension use ipykernel from the current active environment? Please provide it.
Click here to switch the environment of Jupyter Notebook.
Possible solution python -m ipykernel install --user --name=conda_env_name
I noticed that in my Anaconda Navigator, the system shows that Python 3.8.3 has been installed, but as I checked the version on Jupiter notebook, it's 3.7.6. I'm wondering is there a way I can update the latest Python on the notebook? Thanks:)
In the Jupyter Notebook, select KERNEL >> CHANGE KERNEL and choose the Conda virtual environment with Python 3.8.
I'm trying to import the Tensorflow module in my Jupyter notebook in a conda environment, but I get the following error:
AttributeError: type object 'h5py.h5.H5PYConfig' has no attribute '__reduce_cython__'
However, if I open Anaconda Prompt, activate the same enviroment and import tensorflow in the shell, it does work.
Versions:
tensorflow-gpu: 2.2
h5py: 2.10
I tried downgrading to different versions (h5py 2.7 and tf-gpu 2.1), but that resulted in a lot more errors of conflicting versions of packages.
Does anyone have an idea why Jupyter is not loading the module and why it is working within the Anaconda shell?
Thanks
Your jupyter notebook is probably running from the base environment. This can happen if jupyter notebook is installed in base but not in your current env.
Open Anaconda Navigator with anaconda-navigator, navigate to Environments and active your env, navigate to Home and install jupyter notebook, then lunch jupyter notebook from the navigator.
After doing this for the first time, you can just do:
source activate your_env
jupyter-notebook
the next time.
Also you can check the python running inside jupyter with command:
!which python
I have Python 3.7 and 3.8 on my system.
I have run pip install on both 3.7 and 3.8 for jupyter notebook, however when trying to create a new notebook, the kernel list only shows one value for "Python 3"
How do I get both Python 3.7 and 3.8 to show up here?
You have to install the kernel on jupyter.
You can do this in command prompt/bash terminal:
jupyter kernelspec list
This will return all the currently installed kernels for jupyter notebooks.
It's best to run a virtual environment for each project you have. Activate your venv, and then you can install the Python kernel for use within a jupyter notebook with this bash command:
ipython kernel install --user --name=projectname
Note this installed kernel will also be available to jupyter when from outside the venv.
You can uninstall kernels with the following:
jupyter kernelspec uninstall <name of kernel>
See here for more details: https://ipython.readthedocs.io/en/stable/install/kernel_install.html
There are also instructions in there for installing multiple python kernels without using a virtual environment.
I installed jupyter notebook along with anaconda python as the only python on my PC (Windows 10). However I recently installed python 3.6.2 and I wonder if I can somehow add it to jupyter so as I can use them changeably.
I remember having both on my other machine when I installed python first and then after that I installed the whole anaconda package with the jupyter notebook (so I had python 3 and python(conda) option for kernels).
So how can I add to jupyter?
To install a Jupyter kernel for a different version of Python, run:
conda create -n py36 'python=3.6' ipykernel # Replace `3.6` with desired version
To enable the newly installed Jupyter kernel in all conda environments, run:
source activate py36
python -m ipykernel install --user
Now, when you start Jupyter from your root environment, you will have the option to choose a different Python kernel when you click on 'Kernel -> Change kernel':
source deactivate
jupyter notebook
For more info, see Installing the IPython kernel.
Simple, just find where the script jupyter-notebook resides, for example ~/.local/bin if you installed it locally.
Then just edit the first line to: #!/usr/bin/python3 will be fine.