Loading rpy2 : ImportError: version `GOMP_4.0' not found - python

Loading rpy2 on a Jupyter Notebook or in the console brought me the following error :
Traceback (most recent call last):
File "/home/louis/anaconda3/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/home/louis/anaconda3/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/tests.py", line 23, in <module>
import rpy2.tests_rpy_classic
File "/home/louis/anaconda3/lib/python3.5/site- packages/rpy2/tests_rpy_classic.py", line 3, in <module>
import rpy2.rpy_classic as rpy
File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/rpy_classic.py", line 5, in <module>
import rpy2.rinterface as ri
File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/rinterface/__init__.py", line 92, in <module>
from rpy2.rinterface._rinterface import (baseenv,
ImportError: /home/louis/anaconda3/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /usr/lib/R/lib/libR.so)
R version : 3.2.3
Python version : 3.5.2 :: Anaconda custom (64-bit)
OS : ubuntu 16.04 LTS 64 bit
rpy2 version : 2.8.5
I don't know how relevant it may be, but I have gcc installed, and I can import rpy2 in python.
Any help or hint would be greatly appreciated.
Following omri_saadon's comment, I set LD_LIBRARY_PATH to all paths that led to a libgomp directory, which are :
$HOME/anaconda3/pkgs/gcc-4.8.5-7/lib
$HOME/anaconda3/pkgs/libgcc-4.8.5-2/lib
$HOME/anaconda3/pkgs/lib
but each time got the same error :
ImportError: path_to_libgomp/libgomp.so.1: version `GOMP_4.0' not found (required by /usr/lib/R/lib/libR.so)
So my quest goes on ^^ (I must admit I don't really know the ins and outs of what I am doing).
When I succeed in setting export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu (found in root mode) I have another kind of error :
import rpy2.rinterface as ri
File "/home/louis/anaconda3/lib/python3.5/site- packages/rpy2/rinterface/__init__.py", line 92, in <module>
from rpy2.rinterface._rinterface import (baseenv,
ImportError: /home/louis/anaconda3/bin/../lib/libreadline.so.6: undefined symbol: PC
and when I then try to import first the readline package (as it seems to have worked with some) I get :
import rpy2.rinterface as rinterface
File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/rinterface/__init__.py", line 92, in <module>
from rpy2.rinterface._rinterface import (baseenv,
ImportError: /usr/lib/libblas.so.3: undefined symbol: gotoblas

It appears I finally succeeded in installing and using rpy2.
What I did ?
I installed it with the conda package manager, and not pip. With just conda install rpy2, I was done.

Have you tried
RUN conda install -y gcc
That seems to work for people with similar issues -- Missing GOMP_parallel or GOMP_4.0 in (Docker) jupyter/all-spark-notebook: both R and Python

Related

Anaconda navigator not launching, not even through terminal

I installed the latest version of Anaconda on my Windows 10. After installing i tried to launch it but it wouldn't launch even after trying several times. I also tried to launch the jupyter notebook and spider shortcut that was created but even that didn't work. So I tried to run it using the terminal and this is the error I recieved:
UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
warnings.warn(
Traceback (most recent call last):
File "C:\Users\capta\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\capta\anaconda3\lib\site-packages\notebook\notebookapp.py", line 49, in <module>
from zmq.eventloop import ioloop
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\capta\anaconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed while importing error: The specified module could not be found.
I also encountered this problem after I uninstalled the Microsoft Visual Studio C++ redistributable. It fixed (DLL error) after I installed Visual Studio 2015, 2017, and 2019.
You can find it on The latest supported Visual C++ downloads

Python import command not finding module that exists

I presently have Python 2.7 installed, and have been attempting to get my pygeoprocessing module to work correctly (which appears to have been installed correctly). This is the version of Idle Python I am running:
"Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on win32"
When I type in "import pygeoprocessing" from the Idle command line, this is the error message . . .
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import pygeoprocessing
File "C:\Python27\ArcGISx6410.4\lib\site-packages\pygeoprocessing\__init__.py", line 10, in <module>
from geoprocessing import *
File "C:\Python27\ArcGISx6410.4\lib\site-packages\pygeoprocessing\geoprocessing.py", line 25, in <module>
import scipy.interpolate
File "C:\Python27\ArcGISx6410.4\lib\site-packages\scipy\interpolate\__init__.py", line 160, in <module>
from .interpolate import *
File "C:\Python27\ArcGISx6410.4\lib\site-packages\scipy\interpolate\interpolate.py", line 15, in <module>
import scipy.linalg
File "C:\Python27\ArcGISx6410.4\lib\site-packages\scipy\linalg\__init__.py", line 161, in <module>
from .misc import *
File "C:\Python27\ArcGISx6410.4\lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
from . import blas
***File "C:\Python27\ArcGISx6410.4\lib\site-packages\scipy\linalg\blas.py", line 155, in <module>
from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.
When I navigated to the folder mentioned ( . . . scipy\linalg\blas.py) I found that both blas.py and _fblas were present. Therefore I don't know why I got that last import error.
Is there something I can check?
Thanks!
Since you are on a windows box you may want to verify whether you have the 64-bit or the 32-bit version of python installed. That has caused problems for me in the past.
If the above listed methods do not work, try installing the module with pip.
And then try importing it.
C.f. How do I install pip on Windows?

Stuck on error loading scipy, using Homebrew install, on macOS Sierra

This happens when I try to do:
import scipy.io
Another scipy module, such as scipy.sparse, seems to be OK.
The root error is:
packages/scipy/special/__init__.py", line 636, in <module>
from ._ufuncs import *
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/scipy/special/_ufuncs.so, 2): Symbol not found: ___addtf3
The full stack trace:
Traceback (most recent call last):
File "HistogramClassifier.py", line 3, in <module>
import scipy.io
File "/usr/local/lib/python2.7/site-packages/scipy/io/__init__.py", line 97, in <module>
from .matlab import loadmat, savemat, whosmat, byteordercodes
File "/usr/local/lib/python2.7/site-packages/scipy/io/matlab/__init__.py", line 13, in <module>
from .mio import loadmat, savemat, whosmat
File "/usr/local/lib/python2.7/site-packages/scipy/io/matlab/mio.py", line 12, in <module>
from .miobase import get_matfile_version, docfiller
File "/usr/local/lib/python2.7/site-packages/scipy/io/matlab/miobase.py", line 22, in <module>
from scipy.misc import doccer
File "/usr/local/lib/python2.7/site-packages/scipy/misc/__init__.py", line 51, in <module>
from scipy.special import comb, factorial, factorial2, factorialk
File "/usr/local/lib/python2.7/site-packages/scipy/special/__init__.py", line 636, in <module>
from ._ufuncs import *
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/scipy/special/_ufuncs.so, 2): Symbol not found: ___addtf3
Referenced from: /usr/local/lib/python2.7/site-packages/scipy/special/../.dylibs/libquadmath.0.dylib
Expected in: /usr/lib/libSystem.B.dylib
in /usr/local/lib/python2.7/site-packages/scipy/special/../.dylibs/libquadmath.0.dylib
That's pretty much it. Google returns quite a few hits, but they're either very old, or not the same lib, or things that I've tried. The rest of this post is all the stuff I found/tried so far that didn't work.
Double checking python:
which python
/usr/local/bin/python
ls -l /usr/local/bin/python
lrwxr-xr-x ... /usr/local/bin/python -> ../Cellar/python/2.7.13/bin/python
I'm not currently using virtual env.
I think Homebrew is OK:
brew doctor
Your system is ready to brew.
This is after trying this:
brew update
brew upgrade
I've also tried uninstalling and reinstalling the scipy package, both with brew and with pip.
I've tried various other things, but don't want to mess up a working Homebrew setup.
Older posts that Google brought back talk about "cobra", as far as I know I'm not using that. "which cobra" doesn't return anything.
Other things from Google talk about the order of the library path, but that seemed to be if you were using the built-in python, which I don't don't think is applicable since I believe I'm using Homebrew's version.
Clearly it has something to do with a library, maybe fortran related, but what to type in to fix it... don't know where to start.
Try this: remove /usr/lib/libSystem.B.dylib temporarily and then reinstall scipy.

PYTHON DLL load failed

I usually code in Matlab but I found a nice piece of PYTHON code that I would like to use. However having downloaded the package it is proving difficult to run. I'm getting the following error:
Traceback (most recent call last):
File "C:\launch.py", line 29, in <module>
from src.smcsquare import SMCsquare
File "C:\src\smcsquare.py", line 32, in <module>
from scipy.stats import norm
File "C:\Python34\lib\site-packages\scipy\stats\__init__.py", line 338, in <module>
from .stats import *
File "C:\Python34\lib\site-packages\scipy\stats\stats.py", line 184, in <module>
import scipy.special as special
File "C:\Python34\lib\site-packages\scipy\special\__init__.py", line 586, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.
The _ufuncs.pyd is there in the C:\Python34\lib\site-packages\scipy\special\ directory. I tried adding this to my PYTHONPATH but it made no difference. I have also tried so dll fixers but these have not helped.
Has anyone encountered this and did you find a solution?
As other have said, make sure your .whl file matches the version and 32/64bit of the python distribution you're using.
Next, the problem I was having was I forgot to download and install the extra "numpy+mkl" package per the instruction: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
So for me it was numpy-1.11.0+mkl-cp35-cp35m-win_amd64.whl, which I downloaded and then:
python -m pip install numpy-1.11.0+mkl-cp35-cp35m-win_amd64.whl
I had already installed the regular numpy package via pip, but I just installed this one over it and everything started working and has been fine so far.

ImportError: No module named 'threading' in Python?

I have Linux Mint 17 and Python 3.4.0. I had downloaded python3.4 package for utopic so I can get Python 3.4.2. I downloaded its dependencies as well as IDLE and python3-tk for 3.4.2. After install, I did not find anything of my liking. So, with the help of Synaptic, I downgraded the packages back to the original 3.4.0 packages. I experienced no problem until I had a problem in a program I was making for time-pass. I tried to debug my app in PyCharm could no longer debug my apps in PyCharm. In the Console section, this error came up:-
/usr/bin/python3.4 /opt/pycharm-community-3.4.1/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port 37770 --file "/home/ibrahim/Documents/Python/Team Rocket.py"
Traceback (most recent call last):
File "/opt/pycharm-community-3.4.1/helpers/pydev/pydevd.py", line 4, in <module>
from django_debug import DjangoLineBreakpoint
File "/opt/pycharm-community-3.4.1/helpers/pydev/django_debug.py", line 2, in <module>
from django_frame import DjangoTemplateFrame, get_template_file_name, get_template_line
File "/opt/pycharm-community-3.4.1/helpers/pydev/django_frame.py", line 1, in <module>
from pydevd_file_utils import GetFileNameAndBaseFromFile
File "/opt/pycharm-community-3.4.1/helpers/pydev/pydevd_file_utils.py", line 44, in <module>
from pydevd_constants import * ##UnusedWildImport
File "/opt/pycharm-community-3.4.1/helpers/pydev/pydevd_constants.py", line 80, in <module>
import threading
ImportError: No module named 'threading'
Process finished with exit code 1
Then I opened IDLE to debug my program to get at least some information from its underpowered debugger and neither did it work! So I started it directly by python3 -m idlelib.idle and it gave me the same error (but different references). Here is the error.
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.4/idlelib/idle.py", line 10, in <module>
import idlelib.PyShell
File "/usr/lib/python3.4/idlelib/PyShell.py", line 10, in <module>
import threading
ImportError: No module named 'threading'
I think including the program code is trivial but if you want it then I can give it to you. I have just confirmed I have downgraded all packages.
Version numbers for Python:-
python3.4 = 3.4.0-2ubuntu1
python3.4-minimal = 3.4.0-2ubuntu1
python3-tk = 3.4.0-0ubuntu1
idle-python3.4 = 3.4.0-2ubuntu1
PyCharm Community Edition = 3.4.1; Build = 135.1057; Running on Oracle Java 1.8.0 aka Java 8 for amd64 systems. Not running on OpenJDK.

Categories

Resources