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

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.

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 ?

wxPython installation on ubuntu 16.04 taking very long time

I am trying to install wxPython on ubuntu 16.04 for python3 using pip3, but after downloading the requirements it stuck in installing it. I have installed the required development packages and their dependencies as mentioned here.
It takes a long time to build, be patient and it will probably make it through if the needed library dependencies are installed. You can use the --verbose flag on pip to see what it is doing along the way.
Alternatively, there are already wheel files available for Ubuntu 16.04, see https://wxpython.org/pages/downloads/
As suggested by RobinDunn use Linux Wheels:
pip install -U \
-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 \
wxPython
sudo apt install python3-wxgtk4.0
package in Ubuntu 20.04 which will get you version 4.0.7. Works also 22.04

How to install packages in Python 2.7 without internet connections in Windows machine?

I have a machine which is a Windows server, where installation by downloading packages from internet is prohibited. Before that I tried to set up Python 2.7 on my windows machine with internet.I have downloaded and installed pysftp, paramiko, bcrypt, cryptography, pyasn, PyNaCl etc. and also have installed Microsoft visual c++ which was required for pyasn. I have updated pip to 9.0.1 as well. But when I tried to set up on another Windows machine with the help of all packages (unzipped and copied to that machine),installation failed always.
I have tried with
python setup.py install
and
pip install
So can we install packages without internet connection?
Please help me on this.
Thanks and regards,
Shreeram
Can't you just copy the source and execute "pip install ." in the directory ?
To answer the specific question "Can you install packages withou tthe internet" then asnwer is yes.
For example, armed with a wheel somewhere the machine can see, and pip
pip install some-dir/some-file.whl
or
python -m pip install some-dir/some-file.whl
There are other options than wheels, however, the same idea applies.

Python package installation via yum

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.

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