3

I installed python 3 and pip3 into in Windows System for Linux shell that uses Ubuntu, but it appears I have to find and specify site-packages or $HOME/.local/bin directory manually if I want to run any python package executables.

The package I want to use is cheat, but the problem is the same for any other package.

My chain of commands was:

  1. install WSL - Ubuntu 18.04
  2. sudo apt-get update (because sudo apt-get install pip3 will not work on fresh installation)
  3. sudo apt-get -y install python3-pip (installs python too) - edited
  4. sudo pip3 install cheat
  5. cheat not recognised as a command, while python3 runs fine from /usr/bin/python3
  6. find locations where cheat is found, they are:

    $HOME/.local/bin/cheat 
    $HOME/.local/lib/python3.6/site-packages/cheat
    
  7. When I add any of these directories to path, I'm able to run python executables, cheat ls works.

Is there something I can change in the installation process so that I mustn't search for directories and add them manually to path?

Evgeny
  • 141

1 Answers1

1

@muru provided proper diagnostics: the issue with local directories arises only when running pip3 install cheat.

When running sudo pip3 install cheat the package executable installs to /usr/local/bin/ which is on path.

For the rest of the question "Why did my local version of python package install to a directory which is not in path", the overall answer is close to "You have to know your system and folder structure", which equates to "Put ~/.local/bin/on path.

So reiterating to conclude - if you are installing a package with pip and you are not in sudo mode, you have to add ~/.local/bin/ to path to make package executable run.

Evgeny
  • 141