I have installed r2py via pip on a Mac OS.
python3 -m pip install rpy2
If I try to call it I get an error
import os
os.environ['R_HOME'] = '/Library/Frameworks/R.framework/Resources/bin/R'
from rpy2.robjects.packages import importr
OSError: cannot load library '/Library/Frameworks/R.framework/Resources/bin/R/lib/libR.dylib': dlopen(/Library/Frameworks/R.framework/Resources/bin/R/lib/libR.dylib, 2): no suitable image found. Did find:
/Library/Frameworks/R.framework/Resources/bin/R/lib/libR.dylib: stat() failed with errno=20
Related
I'm trying to import montage2d module from scikit-image:
from skimage.util.montage import montage2d
But this error popped up:
ModuleNotFoundError: No module named 'skimage.util.montage'
I'm pretty sure I installed the scikit-image package as:
pip install scikit-image (0.18.1)
I'm trying pip install scikit-image==0.13.1 but it failed
enter image description here
Try:
from skimage.util import montage
Or, with older versions:
pip install scikit-image==0.13.1
from skimage.util.montage import montage2d
I am trying to create an image processing program using convolutions. I need the package scikit-image, specifically this:
from skimage.exposure import rescale_intensity
I have repeatedly installed scikit-image using pip install scikit-image in my terminal (Mac). I did this in the folder where my convolutions.py file is located (is this what is meant by the PYTHONPATH?). However, I always get an error message:
Traceback (most recent call last):
File "Convolutions.py", line 6, in <module>
from skimage.exposure import rescale_intensity
ImportError: No module named skimage.exposure
How do I solve the problem?
make sure you are installing the package on the same version of python which you are running. On a mac, python by default runs python-2.7, and the command python3 runs python-3.x. Also, pip by default installs packages to python-2.7. To install them on python3 try running
python3 -m pip install scikit-image
or simply
pip3 install scikit-image
According to documentation http://rpy2.readthedocs.io/en/version_2.8.x/robjects_oop.html it shows how to import R packages that is not standard in python. To my luck they do the example I need which is lme4
import rpy2.robjects as ro
from rpy2.robjects import FloatVector
from rpy2.robjects.packages import importr
import rpy2.rinterface as rinterface
stats = importr('stats')
base = importr('base')
lme4 = importr('lme4')
getmethod = ro.baseenv.get("getMethod")
StrVector = ro.StrVector
No matter what I did I got the error
RRuntimeError: Error in loadNamespace(name) : there is no package called 'lme4'
I'm in windows environment and I know that this package is installed under
"C:/Users/me/Documents/R/win-library/3.4" not the standard "C:/Program Files/R/R-3.4.3/library"
Please any help is greatly appreciated.
Note that the error message is coming from the R kernel (RRuntimeError). This suggests that the R kernel can't find the package lme4. I think you have two options here:
Launch the R kernel and install lme4 there (install.packages('lme4'))
IF you used pip/conda to install rpy2, it should have also installed R in your environment (you can confirm via pip freeze or conda list). In this case, you can use pip/conda to install lme4 via the package r-lme (conda install r-lme)
I have install opencv via pip by pip install opencv-python and it have been successfully installed but when I try to import it is show The specific module could not be found.
This is the opencv's init.py code
import sys
import os
#FFMPEG dll is not found on Windows without this
os.environ["PATH"] += os.pathsep + os.path.dirname(os.path.realpath(file))
from . import cv2
sys.modules['cv2'] = cv2
I have followed this blog and it worked for me
I have installed pycurl via pip on OS X 10.9. When I run python file with import pycurl python tells me next error:
ImportError:
dlopen(/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pycurl.so,
2): Symbol not found: _PyFile_AsFile Referenced from:
/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pycurl.so
Expected in: flat namespace in
/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pycurl.so
UPD: python3 installed via brew