Macports: ModuleNotFoundError: No module named 'pkg_resources'

root's picture

The error I got today was related to speedtest-cli:

florians-MacBook-Pro$ speedtest
Traceback (most recent call last):
  File "/opt/local/bin/speedtest", line 6, in <module>
    from pkg_resources import load_entry_point
ModuleNotFoundError: No module named 'pkg_resources'

The macports package speedtest-cli is a terminal port for the popular speedtest.net. The source is available here.

I truly do not know after which modification/upgrade I got this error because I do not use this utility often. But I got it, and I had to deal with it.
It turns out I was missing some needed python packages:

florians-MacBook-Pro:fmbpro florian$ sudo port -v install py36-pip  
--->  Computing dependencies for py36-pip..
The following dependencies will be installed:  py36-setuptools
Continue? [Y/n]: y
--->  Fetching archive for py36-setuptools
--->  py36-setuptools-38.5.1_0.darwin_17.noarch.tbz2 doesn't seem to exist in /opt/local/var/macports/incoming/verified
--->  Attempting to fetch py36-setuptools-38.5.1_0.darwin_17.noarch.tbz2 from https://packages.macports.org/py36-setuptools
--->  Installing py36-setuptools @38.5.1_0
--->  Activating py36-setuptools @38.5.1_0
--->  Cleaning py36-setuptools
--->  Removing work directory for py36-setuptools
--->  Fetching archive for py36-pip
--->  py36-pip-9.0.1_0.darwin_17.noarch.tbz2 doesn't seem to exist in /opt/local/var/macports/incoming/verified
--->  Attempting to fetch py36-pip-9.0.1_0.darwin_17.noarch.tbz2 from https://packages.macports.org/py36-pip
--->  Installing py36-pip @9.0.1_0
--->  Activating py36-pip @9.0.1_0
--->  Cleaning py36-pip
--->  Removing work directory for py36-pip
--->  Updating database of binaries
--->  Scanning binaries for linking errors
--->  No broken files found.                             
--->  Some of the ports you installed have notes:
  py36-pip has the following notes:
    To make the Python 3.6 version of pip the one that is run when you execute the commands without a version suffix, e.g. 'pip', run:
    
    port select --set pip pip36

Error gone:

florians-MacBook-Pro:fmbpro florian$ speedtest
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing download speed........................................
Download: 197.49 Mbits/s
Testing upload speed..................................................
Upload: 99.36 Mbits/s

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content

root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root