I'm struggling installing GDAL on ubuntu 16.04 to work with GeoDjango (Django 2.1, python3), so I need to understand what I'm actually installing.
What is the rĂ´le of each library/package/module ?
apt
gdal-bin (A 'C' library containing the actual functions ?)
python-gdal (The same in python, or just some kind of bridge ?)
python3-gdal (see above, but for python3. Does it need python-gdal ?)
pip
gdal
pygdal
What is the link between pip modules and apt packages here ?
Every piece of info is available, if one is willing to search for it.
DEBs (installed system-wide):
gdal-bin ([Ubtu]: Package: gdal-bin) - a collection of gdal related binaries (tools and utilities)
python3-gdal ([Ubtu]: Package: python3-gdal) - Python 3 bindings, extensions (.sos) and some wrapper scripts, which enable gdal usage from Python
python-gdal - the same thing, but for Python 2 (totally unrelated to previous item)
WHLs (installed as Python modules to the interpreter used to launch pip):
GDAL ([PyPI]: GDAL) - the sources (.tar.gz) for #2. (and / or #3.). During pip install phase, they are built and installed for current Python
pygdal ([PyPI]: pygdal) - same thing (but for VEnv?) as previous item. It seems to be a lighter version (it doesn't contain the scripts)
But, all of the above depend on libgdal ([Ubtu]: Package: libgdal1i), which is the gdal library.
Related
I'm having trouble installing packages and using them in Pycharm. I've followed various threads (I'm new to Macs and seem to have tried everything) now I'm stuck.
In this case, I want to use the package xgboost.
I have brew installed, after launching a terminal using Rosetta:
%brew install xgboost
Warning: xgboost 1.3.3 is already installed and up-to-date.
It appears installed OK here:
/opt/homebrew/Cellar/xgboost
I also have Python installed here:
/opt/homebrew/Cellar/python#3.9
But no matter how I configure an Interpreter in Pycharm, I can't seem to get the package recognised.
Where have I gone wrong?
I am very unsure exactly how, but I've got this working.
Following: https://abbasegbeyemi.me/blog/homebrew-python-apple-m1
I changed the order of elements in my path:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin
then a new interpreter in Pycharm using:
usr/local/Cellar/Python#3.9/3.9.2_2/bin/python3.9
Now I can install packages just using pip in pycharm and it works.
This has been 6 hours of pain - warning to anyone who isn't well versed in macs, setting up an M1 for python dev was a complete nightmare for me.
Docs: https://xgboost.readthedocs.io/en/latest/build.html
Pre-built binary wheel for Python
If you are planning to use Python, consider installing XGBoost from a pre-built binary wheel, available from Python Package Index (PyPI). You may download and install it by running
# Ensure that you are downloading one of the following:
# * xgboost-{version}-py2.py3-none-manylinux1_x86_64.whl
# * xgboost-{version}-py2.py3-none-win_amd64.whl
pip3 install xgboost
I was looking at the Python Package Index (PyPi) and noticed 2 very similar packages: opencv-contrib-python and opencv-python and wondering what the difference was. I looked at them and they had the exact same description and version numbers.
As per PyPi documentation:
There are four different packages (see options 1, 2, 3 and 4 below):
Packages for standard desktop environments:
Option 1 - Main modules package: pip install opencv-python
Option 2 -
Full package (contains both main modules and contrib/extra modules):
pip install opencv-contrib-python (check contrib/extra modules listing
from OpenCV documentation)
Packages for server (headless) environments:
Option 3 - Headless main modules package: pip install opencv-python-headless
Option 4 - Headless full package (contains both main modules and contrib/extra modules): pip install opencv-contrib-python-headless
Do not install multiple different packages in the same environment
Opencv has two compilations for each version, the "regular" one that is functional and well tested and the compilation with the extra components (contribs package) in their github's page they put:
This repository is intended for the development of so-called "extra" modules, contributed functionality. New modules quite often do not have stable API, and they are not well-tested. Thus, they shouldn't be released as a part of the official OpenCV distribution, since the library maintains binary compatibility, and tries to provide decent performance and stability.
Also in contribs package there are several non-free computer vision algorithms (for features) such as SURF, BRIEF, Censure, Freak, LUCID, Daisy, BEBLID, TEBLID.
I am following the commands here to install PyViz.
I get the error:
~$ sudo apt-get install python-gnome2-desktop
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-gnome2-desktop is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
python-wnck:i386 python-rsvg:i386 python-gnomekeyring:i386 python-wnck python-rsvg python-gnomekeyring
E: Package 'python-gnome2-desktop' has no installation candidate
I tried to search the solutions for the problem but all give the same error.
I have Ubuntu 15.04.
It is just python-gnome2:
python-gnome2
You can see with an apt-cache search:
$apt-cache search python-gnome2
python-gnome2 - Python bindings for the GNOME desktop environment
python-gnome2-desktop-dev - Python bindings for the GNOME desktop environment
python-gnome2-dev - Python bindings for the GNOME desktop environment - development files
python-gnome2-doc - Python bindings for the GNOME desktop environment
You actually need to install python-gnome2-desktop-dev, python-gnomedesktop will be installed with the dev package.
python-gnomedesktop (>= 2.32.0+dfsg-1)
Python bindings for the GNOME desktop library
I'm trying to install numpy 1.7 via an RPM on an older Linux machine with Python 2.4. The numpy release notes and the RPM page say it is supposed to be compatible with 2.4 (or <= 2.7), but when I try to install it on the machine with the command
rpm -i /tmp/python-numpy-1.7.0-2.1.i586.rpm
I get a number of missing dependency notes, including:
libc.so.6(GLIBC_2.11) is needed by python-numpy-1.7.0-2.1.i586
libc.so.6(GLIBC_2.4) is needed by python-numpy-1.7.0-2.1.i586
liblapack.so.3 is needed by python-numpy-1.7.0-2.1.i586
libpython2.7.so.1.0 is needed by python-numpy-1.7.0-2.1.i586
python >= 2.7 is needed by python-numpy-1.7.0-2.1.i586
python = 2.7 is needed by python-numpy-1.7.0-2.1.i586
python(abi) = 2.7 is needed by python-numpy-1.7.0-2.1.i586
rpmlib(PayloadIsLzma) <= 4.4.6-1 is needed by python-numpy-1.7.0-2.1.i586
So now at least Python 2.7 is needed, rather than up to 2.7. Is this a real discrepancy or am I using rpm incorrectly? I'm used to higher-level Linux package managers that report dependencies correctly and install them automatically, so I'm unsure how to proceed here.
Are you sure your distribution does not provide numpy already? It looks like numpy is part of epel.
If for some reason you are unwilling to use the version in the distribution, you're likely going to have to build the RPM yourself. I was able to build 1.7.1 on CentOS 5.7 like so:
sudo yum install rpm-build gcc python-devel
wget 'https://pypi.python.org/packages/source/n/numpy/numpy-1.7.1.tar.gz'
tar -xf numpy-1.7.1.tar.gz
cd numpy-1.7.1/
python setup.py bdist_rpm
sudo yum localinstall dist/numpy-1.7.1-1.i386.rpm
the generated RPM (in ./dist) should be useable without rebuilding on all of the machines with similar hardware and OS.
If all the machines have identical versions of Python, glibc, etc., then it would probably be easier to get the numpy source and build it yourself, assuming you have gcc (and perhaps gfortran) installed, along with dependencies like BLAS and LAPACK. Once it's installed on one machine, you can copy the numpy folder (and any .egg file) from /usr/lib/python2.4/site-packages (or whichever directory) and distribute that around the world. Make sure to create static libraries when you build so you don't need all the dependencies everywhere.
I'd also get numpy 1.7.1, as it fixes some issues with 1.7.0.
I need to install PIL (python imaging library) on my Ubunto10.4-32bit (EDIT:64bit) machine on my python2.5.4-32bit.
This question is also relevant to any other source package I guess (among those that I need are RPyC,psyco and numpy).
I downloaded the source-code since I can't find any neat package to do the job and did
a sudo python2.5 setup.py install.
output:
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Traceback (most recent call last):
File "setup.py", line 9, in <module>
import glob, os, re, struct, string, sys
File "/usr/lib/python2.5/struct.py", line 30, in <module>
from _struct import Struct, error
ImportError: No module named _struct
but
echo $PYTHONHOME
/usr
Well, in the file struct.py theres the line from _struct import Struct, error
This is part of the python source code itself so I really wonder whats wrong with the python installation, since the code fails to import the module.
I installed py2.5.4 by doing:
./configure --prefix=/usr
make altinstall
(using make altinstall since I need py26 as default python interpreter)
EDIT: This issue might have risen from mistakenly using a 64bit platform :) and 32bit python2.5 . So anyhow problem solved by reducing unnecessary complexities - switching to 32bit machine and porting app to python 2.6.
In short:
Try using the Ubuntu repository first. If the package isn't there, use easy_install. If all fails, download the package directly to your source folder.
Ubuntu repository (the apt-get approach)
Ubuntu (10.04 and newer) has most mainstream packages are available with apt-get. The naming convention is python-NAME, e.g. python-imaging or python-scipy.
This is the best way to go, since the native package manager will handle any dependencies and updates issues.
Run apt-cache search python | grep "^python-" | less to see a list of packages available for your system (I have over 1,200 in my 10.04 machine).
Setuptools
For packages that are not part of the Ubuntu repository, you can use the python easy-install tool. First, install the setup tool:
sudo apt-get install python-setuptools
And you can install any Python package, e.g. colorworld, using easy-install:
sudo easy_install colorworld
This gives you some degree of protection (e.g., handles dependencies) but updates are generally manual, and it's a real pain to reinstall all these packages in a new computer.
Manual download
You can always download the source code to some directory and add it to your PYTHONPATH. It's the best approach when you just need to evaluate a package or apply some quick-and-dirty solution.
sudo aptitude install python-imaging
This will install PIL library.
sudo aptitude install python-imaging
That will install PIL. But I'm not really sure how to help with your other packages. Maybe try searching for them in synaptic.