8

i have installed many python modules plugins and libraries in my centos system. Now i don't want to install each thing again on separate computers.

Is there any way i can make the package like rpm or any other thing so that when i install in in new location all the modules, dependencies also gets installed and everytime i install new thing i can update the install package

2 Answers 2

10

If you have installed the packages with pip (an improved easy_install), you can just do pip freeze > my-reqs.txt to get a list and versions of the installed packages. There is also some option to install using the reqs file:

pip install -r my-reqs.txt

Pip is meant to companion virtualenv, which can be used to handle per project requirements of dependent packages.

9
  • 1
    Pip may also work when the packages are installed by other tools.
    – peterhil
    Jun 3, 2011 at 6:55
  • so u mean it will get all the list of things installed either by pip , easy install , rpm or tar.gz
    – Mirage
    Jun 3, 2011 at 8:01
  • Apparently it finds out the installed packages from the shell environment variable $PYTHONPATH that you can set in your shell’s startup file – eg. .bashrc for Bash or .zshrc or .zshenv for Zsh. There is also PYTHONSTARTUP env variable where you can set Python specific stuff.
    – peterhil
    Jun 3, 2011 at 8:15
  • 1
    You can also do pip install --install-option="--prefix=$PREFIX_PATH" package_name to install into different lib. See stackoverflow.com/questions/2915471/…
    – peterhil
    Jun 3, 2011 at 8:22
  • 1
    I think you don't necessarily need to set the paths on the new machine, just do pip install -r my-reqs.txt, IF you only have one Python installation. You could set the paths just to be sure, especially, if you later decide to install Python somewhere else.
    – peterhil
    Jun 3, 2011 at 18:22
1

If you are not using Pip, then you should check what packages you have in your global and/or user site-packages directories.

The solutions below are from:
How do I find the location of my Python site-packages directory?

Global site packages:

python -m site

or more concisely:

python -c "import site; print(site.getsitepackages())"

User site packages:

python -m site --user-site

The latter do not however show the site-packages of the current virtual environment – use distutils.sysconfig.get_python_lib() for that:

python -c "from distutils.sysconfig import get_python_lib;
print get_python_lib()"

Note! You can not just copy over the packages that have C++-extensions or other compiled binaries in them. These have to be reinstalled on other machines.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.