Python package installation via yum - python

What could be the difference of installing python packages via yum vs. via pipon Centos in terms of security? Is it even possible to install a python package only via yum?

yum can be used to install Python on CentOS.
pip is used to install Python libraries (packages). Not Python itself.
No "security" issue. But with yum you could overwrite your native Python installation, which can be a problem.
Instead of that, it is recommended to use virtualenv.

Related

How can I check if pip can find python dev headers?

I'm trying to install Mujoco on a Ubuntu server and have a problem which very much looks like this: https://github.com/openai/mujoco-py/issues/265
The solution in that issue thread is to install the devel version of python3. Apparently that brings in python.h which is needed by Mujoco.
But things are complicated: I don't have root access on the machine. Pip comes from a conda environment and even on conda-forge, I don't see any dev version of python (Equivalent of apt-get install python3.6-dev for conda)
The installation guide for the server installs some packages with linuxbrew. There is a python package on brew and apparently it automatically ships with the python devel version: how to install python-devel in Mac OS?
Now I have anaconda python and brew python. How can I see which paths are picked up by pip and verify if it sees the python dev headers ?

Force pip to install in system site-packages?

When I install packages with python 3 on ubuntu 16.04, they get installed to my local user ~/.local/lib/python3.5/site-packages. How do I force pip to install to the system-wide site packages?
I'm trying by using pip3 install <pkg>
Thanks.
This is NOT a duplicate of How to make my Python module available system wide on Linux? - because that is about creating your own module, not a a strange way that pip is working for a Pypi module. Not even close, actually, other than they both deal with modules.

Python - install Pillow and MySQL-python on 1and1 hosting

I've created python virtual environment, installed django using pip and now I would like to install Pillow and MySQL-python using pip but it fails during compile process.
(starting with python.h no such file or directory)
Has anyone tried intall some of these on 1and1 hosting ?
Maybe compile it on different machine or other solution ?
There's not really enough detail here to help. But one possibility is that you don't have the development package for python installed. If you are using Debian or Ubuntu, you can do sudo apt-get install python-dev to install it.

How to install python-devel when using virtualenv

Before asking my question, let me introduce my computing environment first.
OS: Red Hat Enterprise Linux Server 6.5.
Python: Python 2.6 (by rpm install), Python 2.7 (based on virtualenv)
Question:
I want to install a library that requires python-devel. However, when using
yum install python-devel
The system installs python-devel-2.6.*, because the installed (yum-packaged) python is version 2.6. My question is , how to install python-devel that matches the version of the python in virtualenv (which is version 2.7 in my case).
Thanks!
This question has nothing to do with pip or virtualenv. python-dev is a Linux system package, not something you install with pip. You just need to explicitly install python-devel-2.7 - you can search your distribution's package repository for the exact package name.

how to install python distutils

I just got some space on a VPS server(running on ubuntu 8.04), and I'm trying to install django on it. The server has python 2.5 installed, but I guess its non standard installation. When I run install script for django, I get
amitoj#ninja:~/Django-1.2.1$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 1, in <module>
from distutils.core import setup
ImportError: No module named distutils.core
I'm stumped. All the articles on internet tell me how to install modules using distutils. But how do I get distutils itself? Can anyone point me to the archive for distutils? I looked in /usr/lib/local/python2.5, /usr/lib/python2.5 etc, and as expected there is no distutils to be found.
I know this is an old question, but I just come across the same issue using Python 3.6 in Ubuntu, and I am able to solve it using the following command (this works in Ubuntu 18.04, 20.04 and 22.04):
sudo apt-get install python3-distutils
If you are unable to install with either of these:
sudo apt-get install python-distutils
sudo apt-get install python3-distutils
Try this instead:
sudo apt-get install python-distutils-extra
Ref: https://groups.google.com/forum/#!topic/beagleboard/RDlTq8sMxro
you can use sudo apt-get install python3-distutils by root permission.
i believe it worked here
You can install the python-distutils package. sudo apt-get install python-distutils should suffice.
I ran across this error on a Beaglebone Black using the standard Angstrom distribution. It is currently running Python 2.7.3, but does not include distutils. The solution for me was to install distutils. (It required su privileges.)
su
opkg install python-distutils
After that installation, the previously erroring command ran fine.
python setup.py build
The simplest way to install setuptools when it isn't already there and you can't use a package manager is to download ez_setup.py and run it with the appropriate Python interpreter. This works even if you have multiple versions of Python around: just run ez_setup.py once with each Python.
Edit: note that recent versions of Python 3 include setuptools in the distribution so you no longer need to install separately. The script mentioned here is only relevant for old versions of Python.
The module not found likely means the packages aren't installed.
Debian has decided that distutils is not a core python package, so it is not included in the last versions of debian and debian-based OSes. You should be able to do
sudo apt-get install python3-distutils
sudo apt-get install python3-apt
If you are in a scenario where you are using one of the latest versions of Ubuntu (or variants like Linux Mint), one which comes with Python 3.8, then you will NOT be able to have Python3.7 distutils, alias not be able to use pip or pipenv with Python 3.7, see:
How to install python-distutils for old python versions
Obviously using Python3.8 is no problem.
This didn't work for me: sudo apt-get install python-distutils
So, I tried this: sudo apt-get install python3-distutils
If the system Python is borked (i.e. the OS packages split distutils in a python-devel package) and you can’t ask a sysadmin to install the missing piece, then you’ll have to install your own Python. It requires some header files and a compiler toolchain. If you can’t have those, try compiling a Python on an identical computer and just copying it.
By searching all python-distutils related package:
apt-cache search x
I get python3-distutils-extra - enhancements to the Python3 build system
Then just try:
sudo apt-get install python3-distutils-extra

Categories