2

My question is similar to this one... python3-pip installed but pip3 command not found?

I am using Debian 9.6 and python 3.6.

My problem is: I have installed python3-pip with apt-get install python3-pip, but unfortunately I can't get it work.
(As far as I know pip should be preinstalled... anyway)

When I type pip3, I get the output

~#pip3
Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
ModuleNotFoundError: No module named 'pip'

Typing "dpkg -L python3-pip" returns

/.
/usr
/usr/bin
/usr/bin/pip3
/usr/lib
/usr/lib/python3
/usr/lib/python3/dist-packages
/usr/lib/python3/dist-packages/pip
/usr/lib/python3/dist-packages/pip/__init__.py
/usr/lib/python3/dist-packages/pip/__main__.py
/usr/lib/python3/dist-packages/pip/_vendor
/usr/lib/python3/dist-packages/pip/_vendor/__init__.py
/usr/lib/python3/dist-packages/pip/basecommand.py
/usr/lib/python3/dist-packages/pip/baseparser.py
/usr/lib/python3/dist-packages/pip/cmdoptions.py
/usr/lib/python3/dist-packages/pip/commands
/usr/lib/python3/dist-packages/pip/commands/__init__.py
/usr/lib/python3/dist-packages/pip/commands/check.py
/usr/lib/python3/dist-packages/pip/commands/completion.py
/usr/lib/python3/dist-packages/pip/commands/download.py
/usr/lib/python3/dist-packages/pip/commands/freeze.py
/usr/lib/python3/dist-packages/pip/commands/hash.py
/usr/lib/python3/dist-packages/pip/commands/help.py
/usr/lib/python3/dist-packages/pip/commands/install.py
/usr/lib/python3/dist-packages/pip/commands/list.py
/usr/lib/python3/dist-packages/pip/commands/search.py
/usr/lib/python3/dist-packages/pip/commands/show.py
/usr/lib/python3/dist-packages/pip/commands/uninstall.py
/usr/lib/python3/dist-packages/pip/commands/wheel.py
/usr/lib/python3/dist-packages/pip/compat
/usr/lib/python3/dist-packages/pip/compat/__init__.py
/usr/lib/python3/dist-packages/pip/compat/dictconfig.py
/usr/lib/python3/dist-packages/pip/download.py
/usr/lib/python3/dist-packages/pip/exceptions.py
/usr/lib/python3/dist-packages/pip/index.py
/usr/lib/python3/dist-packages/pip/locations.py
/usr/lib/python3/dist-packages/pip/models
/usr/lib/python3/dist-packages/pip/models/__init__.py
/usr/lib/python3/dist-packages/pip/models/index.py
/usr/lib/python3/dist-packages/pip/operations
/usr/lib/python3/dist-packages/pip/operations/__init__.py
/usr/lib/python3/dist-packages/pip/operations/check.py
/usr/lib/python3/dist-packages/pip/operations/freeze.py
/usr/lib/python3/dist-packages/pip/pep425tags.py
/usr/lib/python3/dist-packages/pip/req
/usr/lib/python3/dist-packages/pip/req/__init__.py
/usr/lib/python3/dist-packages/pip/req/req_file.py
/usr/lib/python3/dist-packages/pip/req/req_install.py
/usr/lib/python3/dist-packages/pip/req/req_set.py
/usr/lib/python3/dist-packages/pip/req/req_uninstall.py
/usr/lib/python3/dist-packages/pip/status_codes.py
/usr/lib/python3/dist-packages/pip/utils
/usr/lib/python3/dist-packages/pip/utils/__init__.py
/usr/lib/python3/dist-packages/pip/utils/appdirs.py
/usr/lib/python3/dist-packages/pip/utils/build.py
/usr/lib/python3/dist-packages/pip/utils/deprecation.py
/usr/lib/python3/dist-packages/pip/utils/encoding.py
/usr/lib/python3/dist-packages/pip/utils/filesystem.py
/usr/lib/python3/dist-packages/pip/utils/glibc.py
/usr/lib/python3/dist-packages/pip/utils/hashes.py
/usr/lib/python3/dist-packages/pip/utils/logging.py
/usr/lib/python3/dist-packages/pip/utils/outdated.py
/usr/lib/python3/dist-packages/pip/utils/packaging.py
/usr/lib/python3/dist-packages/pip/utils/setuptools_build.py
/usr/lib/python3/dist-packages/pip/utils/ui.py
/usr/lib/python3/dist-packages/pip/vcs
/usr/lib/python3/dist-packages/pip/vcs/__init__.py
/usr/lib/python3/dist-packages/pip/vcs/bazaar.py
/usr/lib/python3/dist-packages/pip/vcs/git.py
/usr/lib/python3/dist-packages/pip/vcs/mercurial.py
/usr/lib/python3/dist-packages/pip/vcs/subversion.py
/usr/lib/python3/dist-packages/pip/wheel.py
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info/PKG-INFO
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info/dependency_links.txt
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info/entry_points.txt
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info/not-zip-safe
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info/requires.txt
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info/top_level.txt
/usr/share
/usr/share/doc
/usr/share/doc/python3-pip
/usr/share/doc/python3-pip/changelog.Debian.gz
/usr/share/doc/python3-pip/changelog.gz
/usr/share/doc/python3-pip/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/pip3.1.gz

I also tried to reinstall it with apt-get install python3-pip --reinstall, but this changed nothing.

Trying to run pip over python3 -m pip install <package> or python3 -m pip3 install <package> results in "no module named pip/pip3".

I tried to get this working now for weeks, and I would highly appreciate any help I get!

11
  • What does python -c "import sys; print(sys.path)" show? Is there /usr/lib/python3/dist-packages among the paths?
    – mportes
    Jan 9 '19 at 10:08
  • It seems you are running pip3 as root. Have you tried to install and run it as a normal user? In that case, pip should be located within your home directory, for example ~/.local/lib/python3.6/site-packages on Ubuntu (I am not sure about Debian).
    – mportes
    Jan 9 '19 at 10:18
  • First of all, thanks for the quick replies... @myrmica it shows ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/gtk-2.0'] ...I can't see the /usr/lib/python3/dist-packages
    – AlexanderH
    Jan 12 '19 at 19:22
  • Running as normal user tells me to log in as root ... E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
    – AlexanderH
    Jan 12 '19 at 19:27
  • However, python3 -c "import sys; print(sys.path)" Shows ['', '/usr/local/lib/python36.zip', '/usr/local/lib/python3.6', '/usr/local/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/site-packages'] Don't know is this is relevant...
    – AlexanderH
    Jan 12 '19 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.