0

I am trying to install the chat-replay-downloader python package onto a ubuntu 16.04LTS system. I have very very little knowledge about Pyton, and consequently, attempts to find a cause for this through search has not been helpful.

> pip install chat-replay-downloader
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==21.1.1', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 1, in <module>
    from typing import List, Optional
ImportError: No module named typing
delovelady@web:/home/delovelady   05/20 19:27:05
> pip install typing
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==21.1.1', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 1, in <module>
    from typing import List, Optional
ImportError: No module named typing

You might also find it useful to know what Python modules are installed, so here is that list:

> apt list --installed|grep '^python'

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

python/xenial-updates,now 2.7.12-1~16.04 amd64 [installed,automatic]
python-apt-common/xenial-updates,xenial-updates,xenial-security,xenial-security,now 1.1.0~beta1ubuntu0.16.04.11 all [installed,automatic]
python-minimal/xenial-updates,now 2.7.12-1~16.04 amd64 [installed,automatic]
python-pkg-resources/xenial,xenial,now 20.7.0-1 all [installed,automatic]
python-setuptools/xenial,xenial,now 20.7.0-1 all [installed]
python2.7/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.18 amd64 [installed,automatic]
python2.7-minimal/xenial-updates,xenial-security,now 2.7.12-1ubuntu0~16.04.18 amd64 [installed,automatic]
python3/xenial,now 3.5.1-3 amd64 [installed]
python3-apt/xenial-updates,xenial-security,now 1.1.0~beta1ubuntu0.16.04.11 amd64 [installed,automatic]
python3-blinker/xenial,xenial,now 1.3.dfsg2-1build1 all [installed,automatic]
python3-cffi-backend/xenial,now 1.5.2-1ubuntu1 amd64 [installed,automatic]
python3-chardet/xenial,xenial,now 2.3.0-2 all [installed,automatic]
python3-commandnotfound/xenial-updates,xenial-updates,now 0.3ubuntu16.04.2 all [installed]
python3-configobj/xenial,xenial,now 5.0.6-2 all [installed,automatic]
python3-cryptography/xenial-updates,xenial-security,now 1.2.3-1ubuntu0.3 amd64 [installed,automatic]
python3-dbus/xenial,now 1.2.0-3 amd64 [installed,automatic]
python3-distupgrade/xenial-updates,xenial-updates,now 1:16.04.32 all [installed]
python3-gdbm/xenial,now 3.5.1-1 amd64 [installed]
python3-gi/xenial,now 3.20.0-0ubuntu1 amd64 [installed,automatic]
python3-idna/xenial,xenial,now 2.0-3 all [installed,automatic]
python3-jinja2/xenial-updates,xenial-updates,xenial-security,xenial-security,now 2.8-1ubuntu0.1 all [installed,automatic]
python3-json-pointer/xenial,xenial,now 1.9-3 all [installed,automatic]
python3-jsonpatch/xenial,xenial,now 1.19-3 all [installed,automatic]
python3-jwt/xenial-updates,xenial-updates,xenial-security,xenial-security,now 1.3.0-1ubuntu0.1 all [installed,automatic]
python3-markupsafe/xenial,now 0.23-2build2 amd64 [installed,automatic]
python3-minimal/xenial,now 3.5.1-3 amd64 [installed]
python3-oauthlib/xenial,xenial,now 1.0.3-1 all [installed,automatic]
python3-pkg-resources/xenial,xenial,now 20.7.0-1 all [installed,automatic]
python3-pyasn1/xenial,xenial,now 0.1.9-1 all [installed,automatic]
python3-pycurl/xenial,now 7.43.0-1ubuntu1 amd64 [installed,automatic]
python3-pyinotify/xenial,xenial,now 0.9.6-0fakesync1 all [installed,automatic]
python3-requests/xenial-updates,xenial-updates,xenial-security,xenial-security,now 2.9.1-3ubuntu0.1 all [installed,automatic]
python3-serial/xenial,xenial,now 3.0.1-1 all [installed]
python3-six/xenial,xenial,now 1.10.0-3 all [installed,automatic]
python3-software-properties/xenial-updates,xenial-updates,xenial-security,xenial-security,now 0.96.20.10 all [installed,automatic]
python3-systemd/xenial,now 231-2build1 amd64 [installed,automatic]
python3-update-manager/xenial-updates,xenial-updates,now 1:16.04.17 all [installed]
python3-urllib3/xenial-updates,xenial-updates,xenial-security,xenial-security,now 1.13.1-2ubuntu0.16.04.4 all [installed,automatic]
python3-yaml/xenial,now 3.11-3build1 amd64 [installed,automatic]
python3.5/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.13 amd64 [installed]
python3.5-minimal/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.13 amd64 [installed]
python38/now 3.8.6-1 amd64 [installed,local]

I have not intentionally installed any Python stuff; all this must have been pulled in either at installation or due to some dependency.

Again, I cannot begin to guess what might be wrong here; all I can say is that on another (Ubuntu 20.04) system, I downloaded it similarly, and it seems to be operating correctly.

UPDATE based on phd suggestion.

I followed [https://bootstrap.pypa.io/2.7/get-pip.py][1] to downgrade my version of pip. That led me to a newer link as follows:

> curl -O https://bootstrap.pypa.io/2.7/get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   936  100   936    0     0   3742      0 --:--:-- --:--:-- --:--:--  3744

> python get-pip.py

Hi there!

The URL you are using to fetch this script has changed, and this one will no
longer work. Please use get-pip.py from the following URL instead:

    https://bootstrap.pypa.io/pip/2.7/get-pip.py

(etc)

> curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1863k  100 1863k    0     0  7935k      0 --:--:-- --:--:-- --:--:-- 7963k

> python get-pip.py
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting pip<21.0
  Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 19.0 MB/s
Collecting wheel
  Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, wheel
  WARNING: The scripts pip, pip2 and pip2.7 are installed in '/home/delovelady/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script wheel is installed in '/home/delovelady/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.3.4 wheel-0.36.2

> export PATH="${PATH}:/home/delovelady/.local/bin"
> pip install chat-replay-download
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==21.1.1', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 1, in <module>
    from typing import List, Optional
ImportError: No module named typing

UPDATE 2

Thanks again to @phd, I have adjusted the PATH by his below suggestion, and the problem is now a little different.

 pip install chat-replay-download
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement chat-replay-download (from versions: none)
ERROR: No matching distribution found for chat-replay-download

Note, because of the comment about "site-packages" not being writeable, I tried this with sudo pip install chat-replay-download. The old error message resulted.

Dennis
  • 1,071
  • 2
  • 17
  • 38
  • https://stackoverflow.com/search?q=%5Bpip%5D+ImportError%3A+No+module+named+typing – phd May 21 '21 at 10:02
  • You need to downgrade pip for your Python. See https://stackoverflow.com/a/65871131/7976758/ . Your problem is different but the process of downgrading and URLs are the same. – phd May 21 '21 at 10:03
  • Thank you for your reply, phd. I just now tried that option; didn't seem to change anything. See the update in the original post. – Dennis May 21 '21 at 12:16
  • You appended the directory: `export PATH="${PATH}:/home/delovelady/.local/bin"` which means that your still run the old `pip`. You need to prepend the directory: export PATH="/home/delovelady/.local/bin:${PATH}"` — this way the new `pip` can be found first. – phd May 21 '21 at 14:47
  • Thanks. Some progress (meaning at least it's a different set of errors). At some point I'd like to remove the one that needs to be eliminated. But in any case, I'd appreciate if you'd look at UPDATE 2 above. Thanks so much for your help @phd! – Dennis May 21 '21 at 17:42
  • 1. `sudo pip` resets `$PATH` so you use old `pip` again. 2. The package is called [`chat-replay-downloader`](https://pypi.org/project/chat-replay-downloader/), not `chat-replay-download` so the command must be `pip install chat-replay-downloader` – phd May 21 '21 at 17:58
  • Thanks, that got me past it. Sorry for my blunder. I ended up trying to use pip3, got the downloader installed and then I had a new problem now about "docstrng-parser' not being available. And attempt to install that resulted in some syntax error: "File "/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/main.py", line 58 sys.stderr.write(f"ERROR: {exc}") ^ SyntaxError: invalid syntax" ... thanks for all your help @phd but this just feels like a rabbit hole. Clearly python is not happy on this system. – Dennis May 21 '21 at 20:19
  • This `SyntaxError` is solved at the 2nd link I posted above, please return. The problem is not with Python, the problem is `pip`, it's really a problematic program, especially when you have a few different Pythons and a few different `pip` versions. – phd May 21 '21 at 20:41
  • Thanks again @phd. As a completely ignorant python/pip user/victim ... looking at all this python stuff I have (listed above) (especially apparently different versions of the product, which all seem to be outdated)... is there any way to clean up this mess? Is there a way to start over? I'll try to identify the dependencies that caused all this stuff to be pulled in, but from this novice it just seems completely overwhelming. And then there's all this to add to it: /usr/local/bin/pip3.5 /usr/local/bin/pip2.7 /usr/local/bin/pip3 /usr/local/bin/pip2 /usr/local/bin/pip – Dennis May 22 '21 at 23:56

0 Answers0