dlopen: cannot load any more object with static TLS

Problem

I had a Python script that used Caffe2. It worked fine on one computer. On another computer with same setup, it would fail at the import caffe2.python line with this error:

WARNING:root:This caffe2 python run does not have GPU support. Will run in CPU only mode.
WARNING:root:Debug message: dlopen: cannot load any more object with static TLS
CRITICAL:root:Cannot load caffe2.python. Error: dlopen: cannot load any more object with static TLS

As I mentioned above, the GPU support warning is a red herring cause this Caffe2 Python was built with GPU support. The real error is the dlopen.

Solution

The only solution from Googling that gave a clue was this. As suggested there, I placed the import caffe2.python line at the top above all other imports. The error disappeared.

Tried with: Ubuntu 14.04

Advertisements

Could not load OGRE dynamic library

Problem

I had an binary compiled on Ubuntu 14.04. I tried to run it on Ubuntu 16.04 and got this error:

OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library /usr/lib/x86_64-linux-gnu/OGRE-1.8.0/RenderSystem_GL

Solution

From the error, I could see that it was looking for an OGRE library file. I installed the OGRE library available on Ubuntu 16.04:

$ sudo apt install libogre-1.9-dev

The error still persisted, because Ubuntu 16.04 only has OGRE 1.9, while this binary was looking for OGRE 1.8 library files.

I tried to create a symbolic link of an OGRE 1.8 directory to the existing OGRE 1.9 directory:

$ cd /usr/lib/x86_64-linux-gnu/
$ ln -s OGRE-1.9.0 OGRE-1.8.0

This worked! The executable ran without problems. This saved me from having to build OGRE 1.8 from source on this computer.

Could not create logging file error

Problem

I tried to train a model using Caffe on a remote computer. The training proceeded without any problems, but this error would show up in the console output occasionally:

Could not create logging file: No such file or directory
COULD NOT CREATE A LOGGINGFILE 20170221-111719.33617!I0221 11:17:19.399444 33617 solver.cpp:243] Iteration 86860, loss = 3.38734

Solution

This error turned out to be from GLog, the Google logging module. Caffe uses GLog for its logging. On this particular remote computer, the GLOG_log_dir environment variable had been set, but to a non-existent path! This was the reason GLog was complaining. Once I removed this environment variable and restarted the training, I no longer saw the error.

Tried with: Ubuntu 14.04

Blank display on installing Kubuntu

Problem

I had a computer with Ubuntu 16.04 running the Unity desktop. I wanted to switch to Kubuntu, so I installed it using this command:

$ sudo apt install kubuntu-desktop

Everything installed fine, except this error at the end:

kde-telepathy-minimal : Depends: kde-config-telepathy-accounts (>= 0.9.0) but it is not installed

After this, there is an error about kaccounts-provider whenever I login into Unity. If I try to login into the KDE desktop, I get a blank display!

Solution

This error seems to be hitting lots of people as seen here. This seems to be caused by a conflict between packages required by Unity and KDE. Apparently, Unity (Ubuntu) and KDE (Kubuntu) cannot be installed on the same computer!

Following some clues given by other users, I forcefully removed Telepathy since I did not need it anyway:

$ sudo dpkg --remove kde-telepathy
$ sudo apt update
$ sudo apt dist-upgrade

After this the Unity error on login and the black display in KDE went away. I was able to switch to using KDE as my primary desktop.

So, if you intend to use Kubuntu, you are better off installing a Kubuntu ISO directly instead of installing it from inside Ubuntu.

ACPI_BIOS_ERROR on installing Windows 8

Problem

I had a new notebook computer with no operating system installed on it. I had a Windows 8 license and a Windows 8 ISO which I wanted to use to install on this notebook. I prepared a Windows installer USB thumbdrive using the ISO and booted the notebook from it.

The computer would throw this error and keep restarting:

Your PC ran into a problem and needs to restart.
If you'd like to know more you can search online later for this error: ACPI_BIOS_ERROR

Solution

Searching online for this error, I found that this occurred to most people when they were updating or upgrading. Mine was neither, I was installing on a fresh computer. In any case, their solutions were either inapplicable or did not work.

While looking up solutions for this error, I discovered that I could use my Windows 8 license to install the newer Windows 10. I decided to give this a try, since Windows 10 ISO is easily available for download here. I made a Windows installer USB thumbdrive and surprise, it booted up normally and I was able to install Windows 10 Pro without any further problems!

Pip uninstall error

Problem

I had installed a package using Pip. However, when I tried to uninstall it, I got this error:

$ sudo pip uninstall h5py
Can't uninstall 'h5py'. No files were found to uninstall.

Solution

You first want to make sure that you are using the pip version that matches the package. That is, if you installed a Python 2.x package, that can only be uninstalled using pip. A Python 3.x package can only be uninstalled using pip3.

In my case, I could not discover the real reason for this error, I resorted to finding the deleting the installed directory for this package. I found the directory h5py-2.6.0-py2.7.egg-info under /usr/local/lib/python2.7/dist-packages and deleted that. If this was a Python 3.x package, I would similarly have looked under the /usr/local/lib/python3.x/ directory.

Tried with: Ubuntu 14.04

Invalid version number error with Python

Problem

I tried to import a Python package that I had installed from source. The import failed with this error:

File "/usr/lib/python2.7/distutils/version.py", line 40, in __init__
  self.parse(vstring)
File "/usr/lib/python2.7/distutils/version.py", line 107, in parse
  raise ValueError, "invalid version number '%s'" % vstring
ValueError: invalid version number '2.7.0rc3'

Solution

It turns out that package version number has to be in the x.y.z format. Else Python throws this error.

Since I had the source code of this package, I found all instances of 2.7.0rc3 and changed it to 2.7.0. Typically, this will be in the setup.py and version.py files. I removed the previously installed package and reinstalled this changed source code. I was able to import after this successfully.

Tried with: Ubuntu 14.04

CMake error building with Python libraries

Problem

I got this error from CMake when building a project that needs to link with Python 3.4 libraries:

-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.4.3", minimum required is "3.0")
-- Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is at least version "3.0")

Solution

Turns out that the CMake available on my system only supported finding Python 3 packages upto version 3.3. To change it to support Python 3.4 was possible by editing two files:

  • In file /usr/share/cmake-3.4/Modules/FindPythonInterp.cmake find the line containing _PYTHON3_VERSIONS and prepend 3.4 to the versions already listed there.

  • In file /usr/share/cmake-3.4/Modules/FindPythonLibs.cmake find the line containing _PYTHON3_VERSIONS and prepend 3.4 to the versions already listed there.

I was able to build with Python 3.x libraries after that.

Error building Caffe with Python 3 support

Caffe can be built with support for Python 2.x. This allows you to invoke Caffe easily from Python code. However, I wanted to call Caffe from Python 3.x code.

  • I built Boost with Python 3.x support. I could see that libboost_python3 library files were generated.

  • I added this to the normal CMake command that I use to build Caffe: -Dpython_version=3

Sadly, this popped up errors of this type:

libboost_python.so: undefined reference to `PyClass_Type'

This type of error indicates that the Python 2.x Boost library was being used to compile with Python 3.x libraries.

Loader not finding shared library in same directory

Problem

I had an executable file that executed correctly on a computer. On a different computer with same setup, the dynamic loader that tries to load the shared libraries required by this executable would fail with this error:

error while loading shared libraries: libmatrixio.so: cannot open shared object file: No such file or directory

The surprising part is that the libmatrixio.so shared library file was always present in the same directory as the executable in both computers! It executed on one, but failed to find that file on another computer!

Solution

It turns out that the dynamic loader ld.so on Linux does not look in the current working directory by default. To make it look in the current directory, you need to add . to LD_LIBRARY_PATH. More information on this can be found in the ld.so manpage, look for LD_LIBRARY_PATH. After making this change to the shell environment variable, the executable loaded correctly on the other computer.

Tried with: Ubuntu 14.04