Cannot load `swrast` and `iris` drivers in Fedora 35 - python

Essentially, trying to write the following code results in the error below:
Code
from matplotlib import pyplot as plt
plt.plot([1,2,3,2,1])
plt.show()
Error
libGL error: MESA-LOADER: failed to open iris: /home/xxx/.conda/envs/stat/lib/python3.8/site-packages/pandas/_libs/window/../../../../../libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/lib64/dri/iris_dri.so) (search paths /usr/lib64/dri, suffix _dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open swrast: /home/xxx/.conda/envs/stat/lib/python3.8/site-packages/pandas/_libs/window/../../../../../libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/lib64/dri/swrast_dri.so) (search paths /usr/lib64/dri, suffix _dri)
libGL error: failed to load driver: swrast
I found similar errors on StackOverflow but none were what is needed here.

The solution proposed by Mahyar Mirrashed is working for me.
On my system (Ubuntu 22.04) the libstdc++.so.6 file is located in /usr/lib/x86_64-linux-gnu/libstdc++.so.6
To know where to find this file I suggest to run the following command :
find / -name libstdc++.so.6 2>/dev/null
which resulted with files from miniconda, snap and /usr/lib/...
I added the export LD_PRELOAD to my .bashrc file and it's working fine.
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6

Installing libstdcxx-ng from conda-forge should solve this problem.
Command:
conda install -c conda-forge libstdcxx-ng

Short answer: export LD_PRELOAD=/usr/lib64/libstdc++.so.6
Long answer:
The underlying problem is that we have a piece of software that was built with an older C++ compiler. Part of the compiler is its implementation of libstdc++ which becomes part of the runtime requirements for anything built by the compiler. The software in question has, evidently, brought its own, older implementation of libstdc++ along for the ride, and given its libstdc++ precedence over the system's libstdc++. Typically, this is done via the $LD_LIBRARY_PATH environment variable. Unfortunately, /usr/lib64/dri/swrast_dri.so is a piece of system software built by the native compiler for that system, and it's more recent than the compiler that built the other software in question. The result of this is that the older compiler's libstdc++ gets loaded first, with its older, more limited symbol set. When it then wants to load swrast, this fails because swrast insists on having the level of compiler/runtime with which it was built. The solution to this whole mess is the force the system's (newer) libstdc++ into use and prevent the older libstdc++ from being brought into play. This is achieved via the code snippet export LD_PRELOAD=/usr/lib64/libstdc++.so.6 where we set the preload environment variable.

Related

"jaxDecomp installation error" Run setup.py,command execution error #3

error message:
CMake Error at CMakeLists.txt:5 (find_package):
By not providing "FindNVHPC.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "NVHPC", but
CMake did not find one.
Could not find a package configuration file provided by "NVHPC" with any of
the following names:
NVHPCConfig.cmake
nvhpc-config.cmake
Add the installation prefix of "NVHPC" to CMAKE_PREFIX_PATH or set
"NVHPC_DIR" to a directory containing one of the above files. If "NVHPC"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
provide FindNVHPC.cmake or NVHPCConfig.cmake/nvhpc-config.cmake
Resolve this problem by reinstall the nvidia hpc sdk, attend to select the single cuda version (not nvhpc_..._cuda_multi.tar.gz)

LINK : fatal error LNK1104: cannot open file 'python38.lib' with CMake finding library

I'm trying to link a python library to a CMake target and build a module from it (using Boost.Python3). CMake correctly finds Boost.Python3 and Python3, but when linking, I get the error LINK : fatal error LNK1104: cannot open file 'python38.lib'
I have added the correct python38.lib to my PATH (and LIBPATH), and CMake correctly finds the library:
message(STATUS "Python3_LIBRARIES = ${Python3_LIBRARIES}")
results in
-- Python3_LIBRARIES = optimized;C:/Program Files/Python38/libs/python38.lib;debug;C:/Program Files/Python38/libs/python38_d.lib
and I link all the libraries:
target_link_libraries(trgt PRIVATE
${Boost_LIBRARIES}
${Python3_LIBRARIES}
Python3::Python # tried with and without this line
trgtCore)
I'm compiling with $ cmake .. "-GVisual Studio 16 2019" -A x64 which matches my x64 installation of Python 3.8.
I had this same problem when installing opencv version 4 from github, I solved it by copying the .lib file into the visual studio project.
Hope it helps,
Amar.
The same problem occurs for me only when building Debug configuration. Release cfg is been built without this problem.
Debug cfg was been built normally until I installed debug symbols package. Maybe the problem somewhere in there.
Based on this discussion https://github.com/microsoft/vcpkg/issues/10649

Unable to install library due to error with hdf5

I tried installing python library tables through: pip install tables
This results in an error
Collecting tables Using cached https://files.pythonhosted.org/packages/4d/53/8f34ce887c2a2ad80518980419a5f6f41defc85a287a355987e559ce9385/tables-3.4.4.tar.gz
Complete output from command python setup.py egg_info:
H5closeplbq5iz8.c
C:\Users\tkim1\AppData\Local\Temp\H5closeplbq5iz8.c(2): warning C4013: 'H5close' undefined; assuming extern returning int
LINK : fatal error LNK1181: cannot open input file 'hdf5.lib'
* Using Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
* USE_PKGCONFIG: False
.. ERROR:: Could not find a local HDF5 installation.
You may need to explicitly state where your local HDF5 headers and
library can be found by setting the ``HDF5_DIR`` environment
variable or by using the ``--hdf5`` command-line option.
This issue with HDF5 not being found seems to be a common one: https://github.com/PyTables/PyTables/issues/219, https://github.com/PyTables/PyTables/issues/385. But as a newcomer to coding, I am having a hard time following the discussion.
One of the most baffling thing I have encountered in trying to fix this is many of the terminal codes that are being discussed is just not taken by my terminal.
sudo python setup.py build_ext --inplace --hdf5=/opt/local --lzo=/opt/local --bzip2==opt/local
output: 'sudo' is not recognized as an internal or external command,operable program or batch file.
env HDF5_DIR=$PWD pip install tables
output:'env' is not recognized as an internal or external command,operable program or batch file.
Any help in regard to fixing this installation issue or regarding how I can apply these different terminal commands will be super appreciated. Thanks everyone.
I found a solution works on Windows 10 with Visual Studio 2019 Community and Python 3.9.1.
Download HDF5 and install.
Set two environment variables, change the version if necessary.
HDF5_DIR=C:\Program Files\HDF_Group\HDF5\1.12.0
LIB=C:\Program Files\HDF_Group\HDF5\1.12.0\lib
The HDF5_DIR is not equale to the HDF5's README, it tells you to set it to C:\Program Files\HDF_Group\HDF5\1.12.0\cmake to working with Cmake, but it is not compatiable with pyTables setup.py.
LIB environment variable tells the link.exe where to find hdf5.lib, if this variable is not set, it shows a link error complain it can't find hdf5.lib on my system.
After the two environment variables set, I can install pyTables via pip install tables.
You can verify these settings in powershell by $env:HDF5_DIR and $env:LIB.
As hinted in this duplicate question, if using conda is an option, conda install pytables will most likely fix the issue in a Windows environment (tested on Windows 10, python 3.9, tables 3.6.1)

Installing Mapnik 2.2.0 in windows 7 with Python 2.7

I've been trying to install mapnik on my computer for hours but what i always get when I import mapnik is ImportError: DLL load failed: The specified procedure could not be found.
I'm using Windows 7. The currently installed software is Geoserver from Opengeo suite.
Here is my path
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\Java\jre7\bin;C:\Program Files\Java\jdk1.7.0_45\bin;C:\Python27;C:\mapnik-v2.2.0\lib
My python path:
C:\Python27;C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\Program Files\ArcGIS\bin;C:\\mapnik-v2.2.0\python\2.7\site-packages\;C:\mapnik-v2.2.0\bin\;
Follow the install instructions
First ensure you have 32 bit python 27 installed.
You can do this by typing the following into a python shell
>>> import platform
>>> platform.architecture()
('32bit', 'WindowsPE')
If you see '64bit', try reinstalling python with the 32bit version (look for the "Python 2.7.5 Windows Installer" link).
After that,
Download the mapnik package (I tested it with the full SDK version)
Extract the archive to C:\mapnik-v2.2.0
Add C:\mapnik-v2.2.0\lib; and C:\mapnik-v2.2.0\bin; to your PATH
Add C:\mapnik-v2.2.0\python\2.7\site-packages; to your PYTHONPATH
import mapnik
I had the same issue on WinServewr 2008 R2. The solution I found is to install Microsoft Visual C++(x86) redistributable package 10.0.40219, because mapnik depends on it. This package comes with postgreSQL 9.3 x86, so when you install only Postgre x64 version you can have this error.
I had this problem as well, even after I installed a 32-bit Python. I was getting the same error:
ImportError: DLL load failed: The specified procedure could not be found.
What fixed it in the end was copying all the DLLs to my python executable directory. I assume there was some DLL-hell type action going on and it was linking to a DLL somewhere with the same name but without that entrypoint. What entrypoint it was looking for I do not know.
In the end it was all useless though because it turns out that there is no OSM (OpenStreetMaps) plugin for the 2.2.0 version, so I decided to do this on Linux instead.
See the table at https://github.com/mapnik/mapnik/wiki/WindowsInstallation for the reference of a missing OSM plugin - execution results in a runtime error indicating the plugin could not be loaded.
I think Windows binary support for mapnik has been dropped so I don't expect much change here.

unable to install graph-tool in windows 7

I'd like to use graph-tool on windows 7, but I'm having trouble installing it.
All the requirements listed here are successfully installed. Python 2.7 is installed in C:\python27. Boost 1.49.0 was successfully compiled with mingw, installed in C:\boost and the BOOST_ROOT environment variable is pointing to it. Boost is compiled in debug and release mode and both static and dynamic.
Invoking configure from within MSyS leads to the following error.
configure: error:
Could not link test program to Python. Maybe the main Python library has been
installed in some non-standard library path. If so, pass it to configure,
via the LDFLAGS environment variable.
Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
============================================================================
ERROR!
You probably have to install the development version of the Python package
for your distribution. The exact name of this package varies among them.
============================================================================
Calling configure LDFLAGS="-LC:/python27/libs" fixed this error, but lead to the following error
checking for boostlib >= 1.38.0... configure: error: We could not detect the boo
st libraries (version 1.38 or higher). If you have a staged boost library (still
not installed) please specify $BOOST_ROOT in your environment and do not give a
PATH to --with-boost option. If you are sure you have boost installed, then ch
eck your version number looking in <boost/version.hpp>. See http://randspringer.
de/boost for more documentation.
This is weird, since BOOST_ROOT is clearly defined (checked it with printenv command).
The next command I tried was configure --with-boost="C:/boost" LDFLAGS="-LC:/python27/libs"
checking for boostlib >= 1.38.0... yes
checking whether the Boost::Python library is available... no
configure: error: No usable boost::python found
Alright it detects boost, but It can't find boost::python. Due to its size I'm unable to post the config.log on stackoverflow but you can find it here.
I'm really confused right now and would appreciate any help.
I have zero experience with compiling graph-tool (or anything else) for windows, but the following part of your config.log stands out:
configure:17224: checking whether the Boost::Python library is available
configure:17254: g++ -c -Wall -ftemplate-depth-150 -Wno-deprecated -Wno-unknown-pragmas -O99 -fvisibility=default -fvisibility-inlines-hidden -Wno-unknown-pragmas -Ic:\python27\include conftest.cpp >&5
conftest.cpp:32:36: fatal error: boost/python/module.hpp: No such file or directory
compilation terminated.
Note how the boost path you passed is not being used! Try to pass CXXFLAGS="-IC:\boost\include" to configure as well.
May be something like this would help:
./configure --prefix=/usr/
for windows path is different, try it yourself.

Categories