Hi I've installed python 2.7 but did not remove 2.6. i've added 2.7 to the path and also as an alias but it seems like when I do jupyter notebook it tries to access 2.6
> jupyter notebook
Traceback (most recent call last):
File "jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/usr/lib/python2.6/site-packages/notebook/__init__.py", line 25, in <module>
from .nbextensions import install_nbextension
File "/usr/lib/python2.6/site-packages/notebook/nbextensions.py", line 226, in <module>
from traitlets import Bool, Enum, Unicode
File "/usr/lib/python2.6/site-packages/traitlets/__init__.py", line 1, in <module>
from .traitlets import *
File "/usr/lib/python2.6/site-packages/traitlets/traitlets.py", line 1291
return {n: t for (n, t) in cls.class_traits(**metadata).items()
^
My python version seems to point to 2.7
$ python --version
Python 2.7.6
as well as my which python seems to give the right out put :
$ which python
alias python='/usr/local/bin/python2.7'
/usr/local/bin/python2.7
I have pip installed for both versions of python. I am not sure how to fix this :(
To change the kernel version in Jupyter Python Notebooks follow the steps below : Open the Python Notebook and click on " Kernel " from the menu bar located on top of the python notebook. Click on " Change kernel " from the drop down box that appears and chose the version that is required.
I would recommend Python 3.8 because most of the data science packages are working fine with it. If you install too fresh Python version (at the time of writing it is 3.10 ) then some of the packages (even popular) might not work. On my system (Ubuntu) the pip returned version 20.0.
It could be a problem in your python kernel.json configuration. For example my python kernel is located at:
/usr/local/share/jupyter/kernels/python/kernel.json
and contains:
{
"language": "python",
"display_name": "Python 2.7",
"argv": [
"/usr/local/bin/python2.7",
"-m",
"ipykernel",
"-f",
"{connection_file}"
]
}
Make sure that the path in argv section points to correct version of python.
It looks like you installed jupyter as an extension of /usr/lib/python2.6
. If so, you'd have to uninstall jupyter and reinstall into your desired python.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With