0

I'm new to python and trying to add python 3 for kernal of Jupyter by using this command

python3 -m pip install ipykernel

but got

Exception:
Traceback (most recent call last):
  File "/usr/share/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2482, in _dep_map
    return self.__dep_map
  File "/usr/share/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2344, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 1266, in prepare_files
    req_to_install.extras):
  File "/usr/share/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2291, in requires
    dm = self._dep_map
  File "/usr/share/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2484, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/usr/share/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2508, in _compute_dependencies
    parsed = next(parse_requirements(distvers))
  File "/usr/share/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2605, in parse_requirements
    line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
  File "/usr/share/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py", line 2583, in scan_list
    "Expected ',' or end-of-list in",line,"at",line[p:]
ValueError: ("Expected ',' or end-of-list in", 'pytest ==3.2.*', 'at', '*')

i have python2 and python3 but command

 python --version

gave me

 Python 3.4.3

and command

 jupyter kernelspec list

gave me

 Available kernels:
  python2    /usr/local/share/jupyter/kernels/python2
Claudio
  • 10,614
  • 4
  • 31
  • 71
  • I think you're installing it the wrong way. Have you tried `pip3 install ipykernel` and `ipython3 kernel install` later? Also check https://stackoverflow.com/q/28831854/2550932. – hygorxaraujo Aug 17 '18 at 00:05
  • thanks for replying . no i tried the first command you wrote and got pkg_resources.DistributionNotFound: The 'pip==9.0.3' distribution was not found and is required by the application .... and i read the link before and got errors too , like when used command ipython3 kernel install got ImportError: IPython.kernel.zmq requires python-zmq >= 2.1.11 –  Aug 17 '18 at 00:13
  • pip 9.0.3 is the pip version for python 2, for python 3 the current version of pip is 18.0. Did you really type `pip3` or only `pip` on the terminal? Check the version with `pip3 --version` or `pip --version`, it should also tell you which python version it's using. – hygorxaraujo Aug 17 '18 at 00:30
  • i typed pip3 --version pip 9.0.3 from /usr/local/lib/python2.7/dist-packages/pip-9.0.3-py2.7.egg (python 2.7) so i upgrade it to 18.0 ? –  Aug 17 '18 at 03:05
  • i upgraded pip to 18.0 now and command pip --version gave pip 18.0 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7) but pip3 --version gave pkg_resources.DistributionNotFound: The 'pip==9.0.3' distribution was not found and is required by the application –  Aug 17 '18 at 03:08

1 Answers1

0

I solved it by this commands

sudo apt-get remove ipython3
ipython3-notebook
sudo apt-get install pip3
sudo pip3 install ipython
sudo ipython kernelspec install-self
sudo ipython3 kernelspec install-self

by @Teque5