Eye of Gnome Python plugins won't autogen because check for PYGTK fails - pygtk

Presenting symptom: autogen disables the build of slideshowshuffle and pythonconsole, reporting "no python support." Platform is Ubuntu 9.04, Jaunty Jackalope; Gnome 2.26.1.
Log extract:
checking for a Python interpreter with version >= 2.3... python
checking for python... /usr/bin/python
checking for python version... 2.6
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.6/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.6/site-packages
checking for PYGTK... no
configure: WARNING: Python not found, disabling python support
Evidence that both python and pygtk are installed:
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygtk
>>>
I note the capitalization of PYGTK, which is common for environment variables. There is no PYGTK environment variable.
Your search - "PYGTK environment
variable" - did not match any
documents.
A grep for PYGTK in the tree rooted from /usr/share/doc/python-gtk2-doc/html returned no rows.

Try installing "python-gtk2-dev" package. You can make sure you have it with
pkg-config --list-all | grep pygtk-2.0
I think, the one you're using from python is "python-gtk2".

Related

`conda search PKG --info` shows different dependencies than what conda wants to install?

I'm building a new conda environment using python=3.9 for the
osx-arm64 architecture.
conda create -n py39 python=3.9 numpy
conda list
...
numpy 1.21.1 py39h1a24bff_2
...
python 3.9.7 hc70090a_1
So far so good: numpy=1.21.1 is the one i want. Now I want to add
scipy, and the first one seems to fit the bill:
conda search scipy --info
scipy 1.7.1 py39h2f0f56f_2
--------------------------
file name : scipy-1.7.1-py39h2f0f56f_2.conda
name : scipy
version : 1.7.1
build : py39h2f0f56f_2
build number: 2
size : 14.8 MB
license : BSD 3-Clause
subdir : osx-arm64
url : https://repo.anaconda.com/pkgs/main/osx-arm64/scipy-1.7.1-py39h2f0f56f_2.conda
md5 : edbd5a5399e973d1d0325147b7118f79
timestamp : 2021-08-25 16:12:39 UTC
dependencies:
- blas * openblas
- libcxx >=12.0.0
- libgfortran 5.*
- libgfortran5 >=11.1.0
- libopenblas >=0.3.17,<1.0a0
- numpy >=1.19.5,<2.0a0
- python >=3.9,<3.10.0a0
in particular, python >=3.9 and numpy >=1.19 seems just right.
but when i try the install
conda install scipy
...
The following packages will be DOWNGRADED:
numpy 1.21.1-py39h1a24bff_2 --> 1.19.5-py39habd9f23_3
(I have bumped into various constraints with numpy=1.19 (numba,
pandas,) and am trying to avoid it.)
Why isn't the scipy package happy with the numpy=1.21 version I
have?!
The only possible clue is that conda reports a different python
version (3.8.11) than the v3.9 I specified for this environment:
conda info
active environment : py39
active env location : .../miniconda3/envs/py39
shell level : 1
user config file : .../.condarc
populated config files : .../.condarc
conda version : 4.11.0
conda-build version : not installed
python version : 3.8.11.final.0 <-------------------
virtual packages : __osx=12.1=0
...
but all the environment's pointers seem to be set correctly:
(py39) % which python
.../miniconda3/envs/py39/bin/python
(py39) % python
Python 3.9.7 (default, Sep 16 2021, 23:53:23)
[Clang 12.0.0 ] :: Anaconda, Inc. on darwin
Thanks, any hints as to what's broken will be greatly appreciated!
I now have things working, but I'm afraid I can't point to a satisfying "answer." Others (eg #merv) seem to not be having the same problems and I can't identify the difference.
The one thing that I did find that seemed to create issues in my install was what seems to be some mislabeling of the pandas package: pandas v1.3.5 breaks a numpy==1.19.5 requirement that is the only way i've been able to push it thru. i posted a pandas issue comment

Matplotlib 2.2.2 installation error on High Sierra

I'm running Mac OS 10.13.5 and struggling to install Matplotlib on Python 3.7 any help is greatly appreciated.
Here is the error that I get when I use pip3 install matplotlib:
BUILDING MATPLOTLIB
matplotlib: yes [2.2.2]
python: yes [3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018,
23:26:24) [Clang 6.0 (clang-600.0.57)]]
platform: yes [darwin]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.14.5]
install_requires: yes [handled by setuptools]
libagg: yes [Requires patches that have not been merged
upstream. Using local copy.]
freetype: no [The C/C++ header for freetype2 (ft2build.h)
could not be found. You may need to install the
development package.]
png: yes [version 1.6.34]
However I have already installed and linked freetype via Homebrew:
Ocean-Gypsys-MacBook-Pro:~ Aysegul$ more /usr/X11/lib/pkgconfig/freetype2.pc
prefix=/opt/X11
exec_prefix=/opt/X11
libdir=/opt/X11/lib
includedir=/opt/X11/include
Name: FreeType 2
URL: http://freetype.org
Description: A free, high-quality, and portable font engine.
Version: 18.6.12
Requires:
Requires.private:
Libs: -L${libdir} -lfreetype
Libs.private: -lz -lbz2
Cflags: -I${includedir}/freetype2
/usr/X11/lib/pkgconfig/freetype2.pc (END)

import tensorflow in a Jython session?

I am wondering whether importing Tensorflow in a jython session is feasible and if so, how shall I configure my environment to get it running.
Of course, using python, importing Tensorflow works as expected. Is Tensorflow compatible with Jython ?
[mata] /home/mata/mlp > python
imPython 2.7.12 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:42:40) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import tensorflow as tf
>>>
whereas with Jython
[mata] /home/mata/mlp > jython
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_101
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tensorflow
>>>
Update:
I tried to load the libtensorflow JAR but still, I seem to be missing something here...
>>> import sys
>>> sys.path.append("libtensorflow-1.2.1.jar")
>>> help(tf) # OK
but I must be missing some obvious step to get the hello Tensorflow case work...
No, Jython won't work with Python modules that use C/C++.
The jar you're trying to use is for the Java API (over JNI), so guess you've already seen https://www.tensorflow.org/install/install_java

Unable to import matplotlib._png (pylab)

I am unable to import matplotlib._png:
import matplotlib._png as _png ImportError:
/home/james/opt/python/virtualenvs/work/lib/python2.7/site-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/_png.so:
undefined symbol: png_set_longjmp_fn
This error prevents me from running import pylab (sincce this ultimately imports matplotlib._png).
I installed matplotlib from source, and made sure to add the path with local installations (/home/james/local) to basedir in setupext.py before running python setup.py install.
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.7.1]
dateutil: yes [using dateutil version 2.1]
tornado: yes [using tornado version 3.0.1]
pyparsing: yes [using pyparsing version 1.5.7]
pycxx: yes [Couldn't import. Using local copy.]
libagg: yes [pkg-config information for 'libagg' could not
be found Using local copy.]
freetype: yes [version 16.0.10]
png: yes [version 1.2.10]
My research so far:
As can be seen above, matplotlib seems to find version 1.2.10 even though the version that I have under /home/james/local is 1.6.2:
$ find . -iname '*libpng*'
./libpng16.so.16.1.0
./libpng16.so
./libpng16.so.16
./libpng16.a
./libpng.a
./libpng.so
./libpng16.la
./pkgconfig/libpng.pc
./pkgconfig/libpng16.pc
./libpng.la
More specifically, I modified the following line in setupext.py with:
return basedir_map.get(sys.platform, ['/home/james/local', '/usr/local', '/usr'])
but matplotlib seems to have found the system version:
$ locate libpng
/usr/lib/libpng.so
/usr/lib/libpng.so.3
/usr/lib/libpng.so.3.10.0
/usr/lib/libpng12.a
/usr/lib/libpng12.so
/usr/lib/libpng12.so.0
/usr/lib/libpng12.so.0.10.0
Could this be the problem? Why am I unable to import matplotlib._png?
Update:
Looking at setupext.py, it looks like python setup install queries pkg-config through the SetupPackage method _check_for_pkg_config to determine the version of libpng I have installed. It turns out that pkg-config is returning the system installation:
$ pkg-config --libs libpng
-lpng12
even though I have updated basedir in matplotlib's setupext.py, and LD_LIBRARY_PATH to make them point to the the more recent version of libpng that I have locally installed.
Any ideas on how to have pkg-config return the right version?
It's a pkg-config issue; matplotlib's installation is (unfortunately, or perhaps not) relying too much on pkg-config's output.
Assuming you have build libpng the normal way, there should be a pkgconfig subdirectory in your /home/james/local/lib, which contains libpng.pc (and libpng16.pc). When setupext.py runs pkg-config, the latter should of course try and pick up the correct .pc file for libpng. For that, use the PKG_CONFIG_PATH variable and point it to the pkgconfig subdirectory:
$ export PKG_CONFIG_PATH=/home/james/local/lib/pkgconfig
Then, install matplotlib again, and see that it now finds the correct libpng version:
$ python setup.py build
basedirlist is: ['/usr/local', '/usr']
============================================================================
BUILDING MATPLOTLIB
matplotlib: 1.1.0
python: 2.7.4 (default, Apr 8 2013, 16:36:47) [GCC 4.4.5]
platform: linux2
REQUIRED DEPENDENCIES
numpy: 1.7.0
freetype2: 12.0.6
OPTIONAL BACKEND DEPENDENCIES
libpng: 1.6.1
Tkinter: Tkinter: 81008, Tk: 8.4, Tcl: 8.4
(For me, with a different PKG_CONFIG_PATH of course. Yes, I may want to upgrade some dependencies.)
Note that I didn't even alter basedirlist; it's just at its default.
In case pkg-config fails to now pick up some other package, just add more directories to PKG_CONFIG_PATH with colons in between. But I guess this should be enough.
Try
export LD_LIBRARY_PATH=/home/james/local/lib
and then execute Matplotlib... that would point matplotlib to your local version.

Mac Lion Python install: Matplotlib ends in mysql error

I am setting up python/numpy/scipy/matplotlib/mysql on my Mac Lion. I first installed Python 2.7.3 and mysqldb. I then updated to XCode 4.3.3 and used the ScipySuperpack to install numpy, scipy, etc.
at this point I am able to import several packages in python without incident but matplotlib dies as follows:
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import scipy
>>> import _mysql
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg/_mysql.py:3:
UserWarning: Module _mysql was already imported from
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages/MySQL_python-1.2.3-py2.7-macosx-10.6-intel.egg/_mysql.pyc, but
/Users/myname/pypy is being added to sys.path
>>> import matplotlib
Error 2002: Can't connect to local MySQL server through socket
'/tmp/mysql.sock' (2)
Sorry if the question is basic but I don't understand the warning, or what it may have to
do with the eventual error...
Strange. There is probably some internal namespace collision going on (given that this doesn't happen if you are in the mysql build directory). Matplotlib does not use mysql in any way, I checked this from a clone of the matplotlib source with:
$> grep -ir mysql *
And got no hits. But I guess the obvious answer is not to import matplotlib from within the mysql build directory...