When trying to import xgboost with the following:
import pandas as pd, numpy as np, psycopg2, xgboost as xgb, os, shutil, pickle, random
I get the following error:
File "/opt/virtual_environments/ml_venv/lib/python3.6/site-packages/xgboost/__init__.py", line 9, in <module>
from .core import DMatrix, DeviceQuantileDMatrix, Booster, DataIter
File "/opt/virtual_environments/ml_venv/lib/python3.6/site-packages/xgboost/core.py", line 203, in <module>
_LIB = _load_lib()
File "/opt/virtual_environments/ml_venv/lib/python3.6/site-packages/xgboost/core.py", line 194, in _load_lib
""")
xgboost.core.XGBoostError:
XGBoost Library (libxgboost.so) could not be loaded.
Likely causes:
* OpenMP runtime is not installed
- vcomp140.dll or libgomp-1.dll for Windows
- libomp.dylib for Mac OSX
- libgomp.so for Linux and other UNIX-like OSes
Mac OSX users: Run `brew install libomp` to install OpenMP runtime.
* You are running 32-bit Python on a 64-bit OS
Error message(s): ['dlopen: cannot load any more object with static TLS']
Switching the import of xgboost in front of psycopg2 like so:
import pandas as pd, numpy as np, xgboost as xgb, psycopg2, os, shutil, pickle, random
The code imports, finds the shared libraries and runs fine.
I know this could be dependent on the setup of the server/environment, but is there some reason why its working when xgboost is imported first? Is psycopg2 potentially changing system paths or environment variables?
Cheers