Because debian stretch have old package of gobject-introspection,i needed to update this.
But when i tryed to build, i got next message:
FAILED: gir/GLib-2.0.gir
/home/user/gobject-introspection-1.70.0/_build/tools/g-ir-scanner --output=gir/GLib-2.0.gir --no-libtool --quiet --reparse-validate --add-include-path /home/user/gobject-introspection-1.70.0/_build/gir --add-include-path /home/user/gobject-introspection-1.70.0/gir --identifier-prefix=G --symbol-prefix=g --symbol-prefix=glib --c-include=glib.h --namespace=GLib --nsversion=2.0 --library=glib-2.0 --library=gobject-2.0 --external-library --pkg=glib-2.0 --cflags-begin -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -DGLIB_COMPILATION -D__G_I18N_LIB_H__ -DGETTEXT_PACKAGE=Dummy --cflags-end /usr/include/glib-2.0/gobject/glib-types.h /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h /usr/include/glib-2.0/glib-unix.h /usr/include/glib-2.0/glib/galloca.h /usr/include/glib-2.0/glib/garray.h /usr/include/glib-2.0/glib/gasyncqueue.h /usr/include/glib-2.0/glib/gatomic.h /usr/include/glib-2.0/glib/gbacktrace.h /usr/include/glib-2.0/glib/gbase64.h /usr/include/glib-2.0/glib/gbitlock.h /usr/include/glib-2.0/glib/gbookmarkfile.h /usr/include/glib-2.0/glib/gbytes.h /usr/include/glib-2.0/glib/gcharset.h /usr/include/glib-2.0/glib/gchecksum.h /usr/include/glib-2.0/glib/gconvert.h /usr/include/glib-2.0/glib/gdataset.h /usr/include/glib-2.0/glib/gdate.h /usr/include/glib-2.0/glib/gdatetime.h /usr/include/glib-2.0/glib/gdir.h /usr/include/glib-2.0/glib/genviron.h /usr/include/glib-2.0/glib/gerror.h /usr/include/glib-2.0/glib/gfileutils.h /usr/include/glib-2.0/glib/ggettext.h /usr/include/glib-2.0/glib/ghash.h /usr/include/glib-2.0/glib/ghmac.h /usr/include/glib-2.0/glib/ghook.h /usr/include/glib-2.0/glib/ghostutils.h /usr/include/glib-2.0/glib/gi18n-lib.h /usr/include/glib-2.0/glib/gi18n.h /usr/include/glib-2.0/glib/giochannel.h /usr/include/glib-2.0/glib/gkeyfile.h /usr/include/glib-2.0/glib/glib-typeof.h /usr/include/glib-2.0/glib/glist.h /usr/include/glib-2.0/glib/gmacros.h /usr/include/glib-2.0/glib/gmain.h /usr/include/glib-2.0/glib/gmappedfile.h /usr/include/glib-2.0/glib/gmarkup.h /usr/include/glib-2.0/glib/gmem.h /usr/include/glib-2.0/glib/gmessages.h /usr/include/glib-2.0/glib/gnode.h /usr/include/glib-2.0/glib/goption.h /usr/include/glib-2.0/glib/gpattern.h /usr/include/glib-2.0/glib/gpoll.h /usr/include/glib-2.0/glib/gprimes.h /usr/include/glib-2.0/glib/gprintf.h /usr/include/glib-2.0/glib/gqsort.h /usr/include/glib-2.0/glib/gquark.h /usr/include/glib-2.0/glib/gqueue.h /usr/include/glib-2.0/glib/grand.h /usr/include/glib-2.0/glib/grcbox.h /usr/include/glib-2.0/glib/grefcount.h /usr/include/glib-2.0/glib/grefstring.h /usr/include/glib-2.0/glib/gregex.h /usr/include/glib-2.0/glib/gscanner.h /usr/include/glib-2.0/glib/gsequence.h /usr/include/glib-2.0/glib/gshell.h /usr/include/glib-2.0/glib/gslice.h /usr/include/glib-2.0/glib/gslist.h /usr/include/glib-2.0/glib/gspawn.h /usr/include/glib-2.0/glib/gstdio.h /usr/include/glib-2.0/glib/gstrfuncs.h /usr/include/glib-2.0/glib/gstring.h /usr/include/glib-2.0/glib/gstringchunk.h /usr/include/glib-2.0/glib/gstrvbuilder.h /usr/include/glib-2.0/glib/gtestutils.h /usr/include/glib-2.0/glib/gthread.h /usr/include/glib-2.0/glib/gthreadpool.h /usr/include/glib-2.0/glib/gtimer.h /usr/include/glib-2.0/glib/gtimezone.h /usr/include/glib-2.0/glib/gtrashstack.h /usr/include/glib-2.0/glib/gtree.h /usr/include/glib-2.0/glib/gtypes.h /usr/include/glib-2.0/glib/gunicode.h /usr/include/glib-2.0/glib/guri.h /usr/include/glib-2.0/glib/gurifuncs.h /usr/include/glib-2.0/glib/gutils.h /usr/include/glib-2.0/glib/guuid.h /usr/include/glib-2.0/glib/gvariant.h /usr/include/glib-2.0/glib/gvarianttype.h /usr/include/glib-2.0/glib/gversion.h /usr/include/glib-2.0/glib/gversionmacros.h /usr/include/glib-2.0/glib/gwin32.h ../gir/glib-2.0.c
Traceback (most recent call last):
File "/home/user/gobject-introspection-1.70.0/_build/tools/g-ir-scanner", line 98, in <module>
from giscanner.scannermain import scanner_main
File "/home/user/gobject-introspection-1.70.0/_build/giscanner/scannermain.py", line 35, in <module>
from giscanner.ast import Include, Namespace
File "/home/user/gobject-introspection-1.70.0/_build/giscanner/ast.py", line 29, in <module>
from .sourcescanner import CTYPE_TYPEDEF, CSYMBOL_TYPE_TYPEDEF
File "/home/user/gobject-introspection-1.70.0/_build/giscanner/sourcescanner.py", line 34, in <module>
from giscanner._giscanner import SourceScanner as CSourceScanner
ImportError: /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0: undefined symbol: g_date_copy
I know about required version glib >= 2.56.
I build it too and install from latest(2.70) source, but the error remains.
user#debian-stretch:/usr/lib/x86_64-linux-gnu$ cat /usr/lib/x86_64-linux-gnu/pkgconfig /gobject-2.0.pc
prefix=/usr
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include
Name: GObject
Description: GLib Type, Object, Parameter and Signal Library
Version: 2.70.0
Requires: glib-2.0
Requires.private: libffi >= 3.0.0
Libs: -L${libdir} -lgobject-2.0
Cflags: -I${includedir}
user#debian-stretch:/usr/lib/x86_64-linux-gnu$ cat /usr/lib/x86_64-linux-gnu/pkgconfig /glib-2.0.pc
prefix=/usr
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include
bindir=${prefix}/bin
glib_genmarshal=${bindir}/glib-genmarshal
gobject_query=${bindir}/gobject-query
glib_mkenums=${bindir}/glib-mkenums
Name: GLib
Description: C Utility Library
Version: 2.70.0
Requires.private: libpcre >= 8.31
Libs: -L${libdir} -lglib-2.0
Libs.private: -pthread -lm
Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include
Can you help with it trouble?
UPD
i read again this post and i had seen next thing:
default libglib2.0-0 package install some libs on to another path, in: /lib/x86_64-linux-gnu/
After that i tryed find it's on my instance, and got next out:
user#debian-stretch:~$ sudo find / -iname '*glib-2.0.*'
/usr/lib/x86_64-linux-gnu/libglib-2.0.so
/usr/lib/x86_64-linux-gnu/girepository-1.0/GLib-2.0.typelib
/usr/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc
/usr/lib/x86_64-linux-gnu/libglib-2.0.a
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7000.0
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7000.0-gdb.py
/usr/share/gir-1.0/GLib-2.0.gir
/usr/share/aclocal/glib-2.0.m4
/usr/local/share/gdb/auto-load/usr/local/lib/x86_64-linux-gnu/libglib-2.0.so.0.7000.0-gdb.py
/usr/local/share/aclocal/glib-2.0.m4
/lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.3
/lib/x86_64-linux-gnu/libglib-2.0.so.0
/home/user/glib-2.70.0/m4macros/glib-2.0.m4
/home/user/glib-2.70.0/_build/glib/libglib-2.0.so.0.7000.0.p
/home/user/glib-2.70.0/_build/glib/libglib-2.0.so
/home/user/glib-2.70.0/_build/glib/libglib-2.0.so.0.7000.0-gdb.py
/home/user/glib-2.70.0/_build/glib/libglib-2.0.so.0
/home/user/glib-2.70.0/_build/meson-private/glib-2.0.pc
/home/user/gobject-introspection-1.70.0/gir/glib-2.0.c
/home/user/gobject-introspection-1.70.0/subprojects/glib/m4macros/glib-2.0.m4
/home/user/packaging-glib/glib-2.70.0/usr/lib/x86_64-linux-gnu/libglib-2.0.so
/home/user/packaging-glib/glib-2.70.0/usr/lib/x86_64-linux-gnu/pkgconfig/glib-2.0.pc
/home/user/packaging-glib/glib-2.70.0/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.7000.0
/home/user/packaging-glib/glib-2.70.0/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
/home/user/packaging-glib/glib-2.70.0/usr/share/aclocal/glib-2.0.m4
After remove this libs:
/lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.3
/lib/x86_64-linux-gnu/libglib-2.0.so.0
building continue.
Definitely don't delete the GLib libraries in /lib. Since your package manager installed them there, other packages may expect to find them there, and so this may break your system down the line. (And since Debian Stretch is so old, with a GLib version of 2.50, it may even cause problems if you install GLib 2.70 systemwide.)
If you must install 2.70 systemwide, then I'd recommend building it with exactly the same configuration as the system version would. You can find the standard configuration options here and the options specific to GLib here. The options for gobject-introspection you can find in a similar place.
Even better, if you need to develop something using a GLib and gobject-introspection version that is not supported on your host system, would be to use some form of container technology. Either a runtime like Flatpak, or a "pet container" with a development environment, like Toolbox.
Related
I get this error with a pytorch import python -c "import torch":
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/afs/cs.stanford.edu/u/brando9/ultimate-utils/ultimate-utils-proj-src/uutils/__init__.py", line 13, in <module>
import torch
File "/dfs/scratch0/brando9/miniconda/envs/metalearning_gpu/lib/python3.9/site-packages/torch/__init__.py", line 191, in <module>
_load_global_deps()
File "/dfs/scratch0/brando9/miniconda/envs/metalearning_gpu/lib/python3.9/site-packages/torch/__init__.py", line 153, in _load_global_deps
ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
File "/dfs/scratch0/brando9/miniconda/envs/metalearning_gpu/lib/python3.9/ctypes/__init__.py", line 382, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /dfs/scratch0/brando9/miniconda/envs/metalearning_gpu/lib/python3.9/site-packages/torch/lib/../../nvidia/cublas/lib/libcublas.so.11: symbol cublasLtHSHMatmulAlgoInit, version libcublasLt.so.11 not defined in file libcublasLt.so.11 with link time reference
how does one fix it?
related:
Could not load dynamic library 'libcublasLt.so.11'; dlerror: libcublasLt.so.11: cannot open shared object file: No such file or directory
https://github.com/pytorch/pytorch/issues/51080
The error is from dlopen libcublas.so from .../python3.9/site-packages/torch/lib/nvidia/cublas/lib/, which is the pip package "nvidia-cuda-runtime" install location.
libcublasLt.so.11 is dynamically linked to libcublas.so.11. The problem is that when you have a different cuda runtime installation (usually in /usr/local/cuda), dlopen probably gets the wrong one. You can run ldd .../python3.9/site-packages/torch/lib/nvidia/cublas/lib/libcublas.so to check the actual path of libcublasLt.so.11, which is supposed to be the one under .../python3.9/site-packages/torch/lib/nvidia/cublas/lib/
Workarounds:
Set env LD_LIBRARY_PATH=.../python3.9/site-packages/torch/lib/nvidia/cublas/lib/:$LD_LIBRARY_PATH when launching python. So that dlopen can firstly look for .so files in that directory.
Using older torch. It was since 1.13.0 torch pip install started using pip nvidia-* packages. Before that cuda libs are statically linked. That's why older torch pip install has no problem even if you have existing cuda install.
like eval said, it is because pytorch1.13 automatically install nvidia_cublas_cu11,nvidia_cuda_nvrtc_cu11,nvidia_cuda_runtime_cu11 and nvidia_cudnn_cu11. While I have my own CUDA toolKit already installed, I have the same problem.
In my case, I used pip uninstall nvidia_cublas_cu11 and solved the problem.
I think the pytorch team should solve this, since users often have their own CUDAtoolkit installed.
I don't know why this works but this worked for me:
source cuda11.1
# To see Cuda version in use
nvcc -V
pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html
but if you look through the git issue these might also work:
conda install -y -c pytorch -c conda-forge cudatoolkit=11.1 pytorch torchvision torchaudio
pip3 install torch+cu111 torchvision torchaudio -f https://download.pytorch.org/whl/torch_stable.html
I think the conda one looks like the most robust because you can specify exactly the cudatoolkit you need, so I'd recommend that one.
I wanted to work on an images detection problem using yolov7, and I installed default dependencies as provided by yolov7 https://github.com/WongKinYiu/yolov7/blob/main/requirements.txt, but when I tried even to check the help manual I got this error
OSError: .../yolov7_env/lib/python3.8/site-packages/torch/lib/../../nvidia/cublas/lib/libcublas.so.11: undefined symbol: cublasLtGetStatusString, version libcublasLt.so.11
Then I tried to install some other dependencies using the following command:
pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113
this's how I solved the problem.
I'm using Python3 bindings for virtualbox (pyvbox). It works with the initial python3 version of my system which is 3.7. Now, I would like to use the very same bindings with python3.8. I have installed all needed python3.8 packages, but i get this error:
$ python3
Python 3.8.0 (default, Oct 28 2019, 16:14:01)
[GCC 9.2.1 20191008] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import virtualbox
>>> _vbox = virtualbox.VirtualBox()
m=VBoxPython3_8 x=No module named 'VBoxPython3_8'
m=VBoxPython3 x=No module named 'VBoxPython3'
m=VBoxPython x=/usr/lib/virtualbox/VBoxPython.so: undefined symbol: _Py_ZeroStruct
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home//.local/lib/python3.8/site-packages/virtualbox/library_ext/vbox.py", line 22, in __init__
manager = virtualbox.Manager()
File "/home//.local/lib/python3.8/site-packages/virtualbox/__init__.py", line 145, in __init__
self.manager = vboxapi.VirtualBoxManager(mtype, mparams)
File "/usr/local/lib/python3.8/dist-packages/vboxapi/__init__.py", line 989, in __init__
self.platform = PlatformXPCOM(dPlatformParams)
File "/usr/local/lib/python3.8/dist-packages/vboxapi/__init__.py", line 750, in __init__
import xpcom.vboxxpcom
File "/usr/lib/virtualbox/sdk/bindings/xpcom/python/xpcom/vboxxpcom.py", line 78, in <module>
raise Exception('Cannot find VBoxPython module (tried: %s)' % (', '.join(_asVBoxPythons),))
Exception: Cannot find VBoxPython module (tried: VBoxPython3_8, VBoxPython3, VBoxPython)
I have found that these modules have to be in /usr/lib/virtualbox, which currently contains only these files:
$ ls /usr/lib/virtualbox/ | grep VBoxPython
VBoxPython2_7.so
VBoxPython3_7m.so
VBoxPython.so
These .so files are installed via the virtualbox package. However, I cannot manage to have neither VBoxPython3.so nor VBoxPython3.8.so by reinstalling. I have looked at the virtualbox code and it seems that the c macro PY_VERSION_HEX indicates 3.7 instead of 3.8, which would be caused by the wrong Python.h header being included.
How can I force virtualbox package to include /usr/include/python3.8/Python.h instead of /usr/include/python3.7/Python.h ?
Uninstalling python3.7 is not an option.
The pyvbox package docs (redirected from pyvbox) imply that the .so files aren't installed by it. But, they do note that the Python package is dependent on the VirtualBox SDK. Which, in turn, recommend installing the SDK to the system Python manually. That latest seems irky, especially when done outside a package manager but maybe they know better.
Digging around, I found the .so files are owned by the OS package virtualbox. In other words, virtualbox must be installed with Python3.8 support.
# Who owns/provides this file (use your dist equivalent or duckduckgo)
$ yay -Fy /usr/lib/virtualbox/VBoxPython3_8.so
...
usr/lib/virtualbox/VBoxPython3_8.so is owned by community/virtualbox 6.1.6-1
I suggest you reinstall the virtualbox package for your distribution. Installing the latest version will provide the latest .so library files Virtualbox supports.
Let's test the theory
# Install Virtualbox and the Virtualbox SDK
yay -S virtualbox virtualbox-sdk python-virtualbox
# Assert we aren't getting an error
$ python -c "import virtualbox; _vbox = virtualbox.VirtualBox(); print('Success!')"
Success!
Otherwise, if the package doesn't include 3.8 support, you'll have to compile it yourself while making sure LD_LIBRARY_PATH points to your Python 3.8 dev libraries. But, I strongly recommend against this. It is infinitely better to work along with your package manager and benefit from upstream work.
Good luck!
I am trying to build cython from source with icc compiler on Ubuntu 14.04 as my python is compiled with Intel icc compiler.
When I tried to install cython using pip3 install cython and then ran cython I got following error
Traceback (most recent call last):
File "/usr/local/bin/cython", line 9, in <module>
load_entry_point('Cython==0.24', 'console_scripts', 'cython')()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 351, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2363, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2088, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python3.4/dist-packages/Cython/Compiler/Main.py", line 28, in <module>
from .Scanning import PyrexScanner, FileSourceDescriptor
ImportError: /usr/local/lib/python3.4/dist-packages/Cython/Compiler/Scanning.cpython-34m.so: undefined symbol: __intel_sse2_strchr
How does one go about installing cython from source using icc compiler ?
I tried this and it does not work
From the cython directory(downloaded from github)
python3.4 setup.py CC=icc
I get the following message -
/home/aa/libPython/cython/Cython/Distutils/build_ext.py:20: UserWarning:
Cython.Distutils.build_ext does not properly handle dependencies and is deprectated. Use Cython.Build.build_ext instead.
"Cython.Distutils.build_ext does not properly handle dependencies "
Unable to find pgen, not compiling formal grammar.
invalid command name 'CC=icc'
CC=icc is not enough to build with icc. You should also link with icc (https://stackoverflow.com/a/10891764/196561; icc will add its internal libraries to ELF file), so find name of linker variable for your setup.py, probably LD and set it to icc too LD=icc (default is probably gcc).
Actually it is LINKCC - https://github.com/cython/cython/blob/970c2fc0e676ca22016e14147ada0edba937dc6b/Cython/Build/BuildExecutable.py
CC = get_config_var('CC', os.environ.get('CC', ''))
CFLAGS = get_config_var('CFLAGS') + ' ' + os.environ.get('CFLAGS', '')
LINKCC = get_config_var('LINKCC', os.environ.get('LINKCC', CC))
So, correct build for cython with icc should be with CC=icc LINKCC=icc, don't know how variables should be passed into setup.py, check How to tell distutils to use gcc? or try
CC=icc LINKCC=icc python3.4 setup.py
Update: According to message from gansub, "LDSHARED=icc" env. variable will help to build cython: "You need to set the environment variable LDSHARED=icc" - https://chat.stackoverflow.com/transcript/message/31231907#31231907 and https://stackoverflow.com/a/37914227
Update from Syrtis Major: There is article "Thread Parallelism in Cython*" https://software.intel.com/en-us/articles/thread-parallelism-in-cython by Nguyen, Loc Q (Intel), December 15, 2016 with recommendation of LDSHARED="icc -shared" CC=icc:
To explicitly use the Intel icc to compile this application, execute the setup.py file with the following command:
$ LDSHARED="icc -shared" CC=icc python setup.py build_ext --inplace
I'm having a python-3 project that uses the plot-directive to generate and embed matplotlib's diagrams on the fly, and i'm using ReadTheDocs for auto-generating the project's documentation.
The plot-directive indeed works ok in python-2, but it currently fails in python-3.
Specifically the failure i'm getting on the logs of RTD is this:
Build Standard Error
html
-----
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/wltp/envs/master/lib/python3.4/site-packages/sphinx/application.py", line 325, in setup_extension
mod = __import__(extension, None, None, ['setup'])
ImportError: No module named 'matplotlib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/wltp/envs/master/lib/python3.4/site-packages/sphinx/cmdline.py", line 253, in main
warningiserror, tags, verbosity, parallel)
File "/home/docs/checkouts/readthedocs.org/user_builds/wltp/envs/master/lib/python3.4/site-packages/sphinx/application.py", line 119, in __init__
self.setup_extension(extension)
File "/home/docs/checkouts/readthedocs.org/user_builds/wltp/envs/master/lib/python3.4/site-packages/sphinx/application.py", line 328, in setup_extension
err)
sphinx.errors.ExtensionError: Could not import extension matplotlib.sphinxext.plot_directive (exception: No module named 'matplotlib')
Extension error:
Could not import extension matplotlib.sphinxext.plot_directive (exception: No module named 'matplotlib')
And the culprit can be traced to matplotlib not being compiled due to mnissing 'freetype' C lib:
Setup Output
...
requirements
-----
...
BUILDING MATPLOTLIB
matplotlib: yes [1.4.2]
python: yes [3.4.0 (default, Apr 11 2014, 13:05:11) [GCC
4.8.2]]
platform: yes [linux]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [not found. pip may install it below.]
six: yes [six was not found.]
dateutil: yes [dateutil was not found. It is required for date
axis support. pip/easy_install may attempt to
install it after matplotlib.]
pytz: yes [pytz was not found. pip will attempt to install
it after matplotlib.]
tornado: yes [tornado was not found. It is required for the
WebAgg backend. pip/easy_install may attempt to
install it after matplotlib.]
pyparsing: yes [pyparsing was not found. It is required for
mathtext support. pip/easy_install may attempt to
install it after matplotlib.]
pycxx: yes [Official versions of PyCXX are not compatible
with matplotlib on Python 3.x, since they lack
support for the buffer object. Using local copy]
libagg: yes [pkg-config information for 'libagg' could not
be found. 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.]
OPTIONAL LATEX DEPENDENCIES
dvipng: yes [version 1.14]
ghostscript: yes [version 9.10]
latex: yes [version 3.1415926]
pdftops: no
============================================================================
* The following required packages can not be built:
* freetype
To make the doc-generation pass, I'm forced to "disable" plot-directive by mocking it out, as instructed in the RTD FAQ, using the following code in the ./conf.py file.
I've tried with various combinations of virtualenv (with or without site-package visibility), rtd-specific requirements.txt, with no success.
Has anybody found a way to do it?
These are some hints for those willing to dig further into the issue:
The "official" list of pre-installed native libraries on RTD
The actual pip-requirements.txt file used to setup the build-server, as found from RTD's sources.
Since today, the problem is officially solved, according to rtfd issue #896.
All required dependencies (matplotlib, scipy and numpy) are also installed for python-3, so mocking is not necessary anymore.
To make use of it, in the Advanced settings make the following choices:
Check: Install Project: Install your project inside a virtualenv using setup.py install
Select: Python interpreter: CPython 3.x
Check: Use system packages: Give the virtual environment access to the global site-packages dir.
...although with a little training, it is easy to write python-2/3 compatible code.
I have this same problem and it seems to have to do with the RTD interpreter. My project is in Python 3, and I selected as much in RTD Settings and it fails (can't find matplotlib). I was able to work around it by using selecting the Python 2.x interpreter (in Advanced Settings; also allow the global site packages), as opposed to Python 3.x. I use a RTD-specific requirements file (which only has what I need beyond the global site packages: sphinxcontrib-napoleon). Matplotlib is now seen, but now I have issues from Python 2 backwards compatibility. But at least that issue is sorta solved.
I am trying to test whether matplotlib installed properly in python3. I am following this basic tutorial: http://www.scipy.org/Plotting_Tutorial
This question is similar to one asked previously but unfortunately did not report the final solution explicitly and this is a different operating system.
The operating system for this is Mac OS X 10.6.8. Running the script in Python 3.2 does not work, but running it in Python 2.7 does. Unfortunately I need 3.2.
When the savefig line is commented out, it works fine.
"""
Example: simple line plot.
Show how to make and save a simple line plot with labels, title and grid
"""
import numpy
import pylab
t = numpy.arange(0.0, 1.0+0.01, 0.01)
s = numpy.cos(2*2*numpy.pi*t)
pylab.plot(t, s)
pylab.xlabel('time (s)')
pylab.ylabel('voltage (mV)')
pylab.title('About as simple as it gets, folks')
pylab.grid(True)
pylab.savefig('/Users/USERNAME/Documents/simple_plot.png', format='png')
pylab.show()
The code above returned the same error regardless of whether the path was set explicitly. I tried the following in addition to the above:
pylab.savefig('simple_plot.png', format='png')
pylab.savefig('simple_plot')
I tried setting the path explicitly as the other question said (as in the longer example above), but that resulted in the following errors. Note: mplex.py is the name of the script.
libpng warning: Application was compiled with png.h from libpng-1.2.44
libpng warning: Application is running with png.c from libpng-1.4.11
libpng warning: Incompatible libpng version in application and library
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mplex.py", line 16, in <module>
pylab.savefig('/Users/USERNAME/Documents/simple_plot.png', format='png')
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/matplotlib/pyplot.py", line 474, in savefig
return fig.savefig(*args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/matplotlib/figure.py", line 1225, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/matplotlib/backend_bases.py", line 2075, in print_figure
**kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/matplotlib/backend_bases.py", line 1846, in print_png
return agg.print_png(*args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/matplotlib/backends/backend_agg.py", line 497, in print_png
filename_or_obj, self.figure.dpi)
RuntimeError: Could not create write struct
Ideas? Is there another way to explicitly set the destination aside from what I tried in the savefig line?
I'm not sure what package manager you're using, and I'm on Python 2.7 (not 3.2.3), but I'm using Fink and had a similar problem (with different libpng version numbers).
In iPython --pylab, I was seeing this:
In [3]: savefig('foo.png')
libpng warning: Application is running with png.c from libpng-1.4.11
libpng warning: Incompatible libpng version in application and library
libpng warning: Application was compiled with png.h from libpng-1.5.11
Checking my Fink installations of libpng, I saw this:
$ fink list libpng
Information about 6268 packages read in 0 seconds.
i libpng14 1.4.11-1 PNG image format handling library
i libpng14-shlibs 1.4.11-1 Shared libraries for libpng14 package
libpng15 1.5.10-1 PNG image format handling library
libpng15-32bit 1.5.10-1 PNG library (32-bit)
libpng15-32bit-shli 1.5.10-1 Shared libraries for libpng15 package
i libpng15-shlibs 1.5.10-1 Shared libraries for libpng15 package
libpng3 1:1.2.49-1 PNG image format handling library
libpng3-shlibs 1:1.2.49-1 Shared libraries for libpng3 package
i system-pkgconfig-li 1.5.11-1 [virtual pkgconfig package representing libpng]
i system-pkgconfig-li 1.5.11-1 [virtual pkgconfig package representing libpng15]
After running "fink install libpng15", my libpng package versions looked like this:
$ fink list libpng
Information about 6268 packages read in 1 seconds.
libpng14 1.4.11-1 PNG image format handling library
i libpng14-shlibs 1.4.11-1 Shared libraries for libpng14 package
i libpng15 1.5.10-1 PNG image format handling library
libpng15-32bit 1.5.10-1 PNG library (32-bit)
libpng15-32bit-shli 1.5.10-1 Shared libraries for libpng15 package
i libpng15-shlibs 1.5.10-1 Shared libraries for libpng15 package
libpng3 1:1.2.49-1 PNG image format handling library
libpng3-shlibs 1:1.2.49-1 Shared libraries for libpng3 package
i system-pkgconfig-li 1.5.11-1 [virtual pkgconfig package representing libpng]
i system-pkgconfig-li 1.5.11-1 [virtual pkgconfig package representing libpng15]
As you can see, libpng14 is no longer installed and libpng15 is installed.
Next, "pip uninstall matplotlib" and "pip install matplotlib" yields a matplotlib build summary like this:
$ pip install matplotlib
Downloading/unpacking matplotlib
Downloading matplotlib-1.2.0.tar.gz (36.9Mb): 36.9Mb downloaded
Running setup.py egg_info for package matplotlib
basedirlist is: ['/usr/local/', '/usr', '/usr/X11', '/opt/local']
============================================================================
BUILDING MATPLOTLIB
matplotlib: 1.2.0
python: 2.7.3 (default, Jul 27 2012, 16:40:57) [GCC 4.2.1
Compatible Apple Clang 3.1
(tags/Apple/clang-318.0.61)]
platform: darwin
REQUIRED DEPENDENCIES
numpy: 1.6.2
freetype2: 15.0.9
OPTIONAL BACKEND DEPENDENCIES
libpng: 1.5.10
Tkinter: Tkinter: 81008, Tk: 8.5, Tcl: 8.5
Gtk+: no
* Building for Gtk+ requires pygtk; you must be able
* to "import gtk" in your build/install environment
Mac OS X native: yes
Qt: no
Qt4: no
PySide: no
Cairo: no
OPTIONAL DATE/TIMEZONE DEPENDENCIES
dateutil: 1.5
pytz: 2012b
OPTIONAL USETEX DEPENDENCIES
dvipng: no
ghostscript: 9.05
latex: no
You can see that the build will now pick up libpng 1.5.10. Previously, it was picking up 1.4.11 for the build.
Avoid using the standard console and the error will not appear by double clicking the yourcode.py or yourcode.pyw file.