Rpy2 import rpy2.robjects as robjects fails - rpy2

I've installed rpy2 through pip install rpy2. After this in a Jupyter notebook the import works fine:
import rpy2
print(rpy2.__version__)
which returns 3.1.0.
However when I type this import rpy2.robjects as robjects, I get the following error:
ValueError: The system "%s" is not supported.
Does someone know where this error comes from and how to solve it?

I had exactly the same problem.
I uninstalled the package and reinstalled it with conda (as I use Jupyter notebook through Anaconda):
conda install rpy2
Doing this it worked just fine.
The version installed was 2.9.4. There may be an issue with the version 3.1.0 I believe.

I have a similar problem. I had previously installed rpy2 2.9.5 withpip3 install rpy2 and it worked fine. However, today I tried updating it with pip3 install --upgrade rpy2 and got the following error:
Collecting rpy2
Using cached https://files.pythonhosted.org/packages/62/bc/d43df0d9e96a38985a97d1cbdb5722e10cd8fa0da45686972f0b8fd18a67/rpy2-3.2.4.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-irk23ljv/rpy2/setup.py", line 21, in <module>
from rpy2 import situation
File "/tmp/pip-build-irk23ljv/rpy2/rpy2/situation.py", line 98
raise ValueError(f'The system {system} is currently not supported.')
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-irk23ljv/rpy2/
I can't just stick to the older version because what I'm actually trying to do is to install another Python package that has rpy2 listed as a dependency. The install fails with the same error message.
Any update on the subject?
Edit
It looks like this might be a compatibility issue with Python 3.5 -- see https://bitbucket.org/rpy2/rpy2/issues/580/installing-rpy2-on-travis-with-pip. I've just opened an issue here: https://github.com/rpy2/rpy2/issues/356

Related

When importing tensorflow, I get the following error: No module named 'numpy.core._multiarray_umath'

I have installed Ancaconda3 and Tensorflow. When I try to import Tensorflow in python shell I receive the following error:
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "", line 980, in _find_and_load SystemError:
<class '_frozen_importlib._ModuleLockManager'> returned a result with
an error set ImportError: numpy.core._multiarray_umath failed to
import ImportError: numpy.core.umath failed to import
I am not sure what the problem is as numpy is installed on my system and can be successfully imported in python.
I am using Windows10.
I also had the same issue.
It got resloved once I upgraded the numpy from 1.15.4 to 1.16.1.
If you're using pip:
pip install numpy --upgrade
Numpy that came with Anaconda3 is of version 1.15.4. so i upgraded and it worked.
Side note: if you're also using scikit-image in your script, be aware that numpy 1.16.3 has a conflict with old versions of scikit-image (e.g. you may get ImportError: cannot import name '_validate_lengths'). In that case, pip install --upgrade scikit-image from terminal solved the issue for me.
Kindly check whether you have installed the numpy package from pip. Because if you are running on conda evironment, then all packages need to be downloaded from there.
Please use the below mentioned statement for this purpose
conda install -c anaconda numpy
Also make sure that the numpy version supports the Python version you are using.
You can use two options in python 3.6
Install
py pip -m install numpy==1.14.5
Upgrade
py pip install numpy --upgrade
Note: the version most recently is 1.14.5
I also had this issue with python 3.8.9 and Numpy 1.24.1.
Downgrading to Numpy 1.21.0 fixed the issue.

ImportError: cannot import name 'etree' on Python 3.6

I am getting error while running "from lxml import tree" on python3.6
>>> import lxml
>>> from lxml import etree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'etree'
The same working on python3.4, I have tried many things to troubleshoot as below but didn't success.
python -m pip uninstall lxml
python -m pip install lxml==3.6.0
pip install -t /usr/local/lib/python3.6/dist-packages lxml==3.6.0
Just in case anybody has similar issue.
I also encountered this problem using Python3.6.
Just by uninstalling lxml and installing it again with pip the issue is resolved.
Got this working in Lambda with python 3.6
Turns out lxml wraps c libraries that are compiled for a certain processor architecture (I think)
Use precompiled binaries for lambda here: https://github.com/JFox/aws-lambda-lxml
For Windows:
After having the same problem at the instance of my Windows 2019 server, Python 3.8 and Anaconda, I downloaded the corresponding whl package, installed it with
pip install lxml-4.6.3-cp38-cp38-win_amd64
It now works without problem.
I have the same issue when deploying an Azure python function using version 3.9. I redeployed with 3.6 in Azure an everything worked fine.
Had the same while running the code in VS code.For me I got it resolved by changing the interpreter in VS code from 32-bit to 64-bit.

python3 "ModuleNotFoundError: No module named 'OpenGL'"

I am running python3. I've installed OpenGL (pip install OpenGL PyOpenGL_accelerate). When I run my program (python3 opengltest1.py) I get this error:
Traceback (most recent call last):
File "opengltest1.py", line 4, in <module>
from OpenGL.GL import *
The solution was to install OpenGL with pip3 instead of pip, i.e.
pip3 install pyopengl
#eyllanesc Thanks for the help. In following up on your suggestion, I found the solution.
This worked for me! You must download every package with pip3. All things are separated because the syntax is different from Python 2 to Python 3.

Error: "To build a Debian Package you must install stdeb (pip install std eb)" when installing dpkt (Python 3.5.2)

I'm trying to install dpkt package using pip (Python 3.5.2):
pip install dpkt
The installation fails giving this error:
Collecting dpkt
Using cached dpkt-1.8.8.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ic21328\AppData\Local\Temp\pip-build-e0wstmu2\dpkt\setup.py
", line 26
print 'To build a Debian Package you must install stdeb (pip install std
eb)'
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\ic21328\
AppData\Local\Temp\pip-build-e0wstmu2\dpkt\
I've successfully installed the stdeb package using pip, but the same error still occurs.
How can I install dpkt?
I got this same error. If you look more closely you can actually see that it is producing a syntax error on the dpkt package and not printing the error asking for you to install stdeb.
My solution was not ideal and involved using python 2.7 which worked fine for my particular use case.

pip isn't working when importing something

To install pymongo for pypy3 2.1 Beta 1, I installed pip using the following commands:
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
./pypy ez_setup.py --user
where pypy is the executable of pypy3 2.1 Beta 1. After that, pip and pip-3.2 will come to the current directory. But when running pip or pip-3.2, I get the error:
Traceback (most recent call first):
File "pip-3.2", line 5, in <module>
from pkg_resources import load_entry_point
zipimport.ZipImportError: pip==1.4.1
It seems that the problem comes from from pkg_resources import load_entry_point of the pip/pip-3.2. But this statement runs OK when I put it in pypy or python3 IDLE. What's the matter? How to solve this problem and proceed to install pymongo for pypy3 2.1 Beta 1? Thank you.
PS: I'm using Ubuntu. python3 is installed in the system. If u need any other information pertaining to solving the question, please comment.

Resources