Skip to content

python modules install methods

  • apt (yum)
  • easy_install
  • pip

apt

This works fine most of the time, just look if the package you need is available, like : "python-yourpackage" in aptitude and install.

pip

Probably means Python Install Package ? Anyway it says that this is a replacement for easy_install (see next). So it can probably install eggs as well, i have none to try at the moment. Basic usage :

pip
sudo pip install package_name

It will download and install automatically, sudo will be needed to write in the python installation directories. Other useful options are listing the installed packages :

list packages
pip freeze

And searching for packages :

search packages
pip search autobahn

Gives a list like this :

output
1
2
3
4
5
6
7
autobahn                  - AutobahnPython - WebSocket/WAMP implementation for
                            Python/Twisted.
autobahntestsuite         - AutobahnTestSuite - WebSocket/WAMP protocol
                            implementation test suite.
wsaccel                   - Accelerator for ws4py and AutobahnPython
autobahn_rce              - AutobahnPython - Optimised and modified for the
                            RoboEarth Cloud Engine.

So it searches where autobahn appears in the name or description.

eggs

Maybe easy_install can do lots more, but this is the only time i needed it and that was to install the autobahn egg.

Eggs are to pythons what jars are to java. You can install an .egg with the easy_install module that is part of setuptools which most likely is already installed on your system.An example :

easy_install
easy_install autobahn-0.6.5-py2.7.egg

Should do the trick.

npm

Node package manager.

Npm comes with python, and you can use it to install packages. If you get any permission errors when installing globally (with -g) install node and npm with nvm see next:

nvm

See nvm_link

Node version manager. Using this to install node and npm will make sure the packages go into a writable and reachable directory. First install nvm, then open a new shell and reinstall node and npm:

nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
bash - # untested, i started a new xterm 
command -v nvm # test if it works
nvm install node
nvm use node
node -v # v9.5.0
npm -v  # 5.6.0
nvm use system # you could switch back !
node -v # v6.12.3
npm -v  # 3.10.10
nvm use node # and back again

Now issue the npm -g command from before, it will succeed.