Background
I was trying to install Jupyter Lab using
pip3 install jupyterlab
, and it threw the same error.I did not figure it out. Found a workaround using
pip2 install jupyterlab
-- it worked, but clearly was a bandaid fix.tried running
import pandas as pd
in the python3 notebook (inside jupyter lab); module was not found.I am using Cygwin as my linux emulator on a PC.
I prefer python3.x over python 2.7.
My attempts to resolve the issue
Similar reported JupyterLab post - I found this post here: Import pandas on jupyter ipython notebook fails, but I believe the author is using anaconda (which I am not) and the Type Error is different.
I found a post relevant to my TypeError, but that's for a code he's writing: Getting a TypeError: expected string or bytes-like object.
I have a hard time interpreting the Traceback, but here it is below:
$ pip install --upgrade pip
Exception:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 487, in _prepare_file
req_to_install, finder)
File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 428, in _check_skip_installed
req_to_install, upgrade_allowed)
File "/usr/lib/python3.6/site-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python3.6/site-packages/pip/index.py", line 427, in find_all_candidates
self._package_versions(page.links, search)
File "/usr/lib/python3.6/site-packages/pip/index.py", line 595, in _package_versions
v = self._link_package_versions(link, search)
File "/usr/lib/python3.6/site-packages/pip/index.py", line 667, in _link_package_versions
support_this_python = check_requires_python(link.requires_python)
File "/usr/lib/python3.6/site-packages/pip/utils/packaging.py", line 34, in check_requires_python
return python_version in requires_python_specifier
File "/usr/lib/python3.6/site-packages/packaging/specifiers.py", line 698, in __contains__
return self.contains(item)
File "/usr/lib/python3.6/site-packages/packaging/specifiers.py", line 703, in contains
item = parse(item)
File "/usr/lib/python3.6/site-packages/packaging/version.py", line 31, in parse
return Version(version)
File "/usr/lib/python3.6/site-packages/packaging/version.py", line 200, in __init__
match = self._regex.search(version)
TypeError: expected string or bytes-like object
Why is the version returned not a string or byte? Is there a bug in my python 3.6 package itself? I am thinking about opening up those files in the traceback to see if I can debug it, but I thought I should ask for help before attempting something that sounds a little ridiculous, imo.
Other things I have tried
pip2 install --upgrade pip
- this returns a message saying pip in python2.7 is up-to-date.
Traceback (pip2):
$ pip2 install --upgrade pip
Requirement already up-to-date: pip in /usr/lib/python2.7/site-packages
pip3 install --upgrade pip
- this returns the same TypeError above
Traceback (pip3): see the first Traceback
pip version and python site output
$ pip2 --version
pip 9.0.1 from /usr/lib/python2.7/site-packages (python 2.7)
$ python -m site
sys.path = [
'/home/jennings/Documents/hpv/hpv_missed_clinics',
'/usr/lib/python2.7/site-packages/logilab_common-1.3.0-py2.7.egg',
'/usr/lib/python2.7/site-packages/six-1.9.0-py2.7.egg',
'/usr/lib/python27.zip',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-cygwin',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/lib/python2.7/site-packages',
'/usr/lib/python2.7/site-packages/gtk-2.0',
'/usr/lib/python2.7/site-packages/wx-3.0-gtk3',
]
USER_BASE: '/home/jennings/.local' (exists)
USER_SITE: '/home/jennings/.local/lib/python2.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: True
$ pip --version
pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6)
$ python3 -m site
sys.path = [
'/home/jennings/Documents/hpv/hpv_missed_clinics',
'/usr/lib/python36.zip',
'/usr/lib/python3.6',
'/usr/lib/python3.6/lib-dynload',
'/usr/lib/python3.6/site-packages',
'/home/jennings/Documents/kaggle/SQL_scavenger/src/bq-helper',
'/usr/lib/python3.6/site-packages/linkgrammar',
]
USER_BASE: '/home/jennings/.local' (exists)
USER_SITE: '/home/jennings/.local/lib/python3.6/site-packages' (doesn't exist)
ENABLE_USER_SITE: True