import rpy2.ipython meet error ModuleNotFoundError: No module named 'IPython' - python-3.x

My python version is 3.6. my OS is windows. After install rpy2 module, when I type import rpy2, got no issue. But when type import rpy2.ipython, got error as below:
>>> import rpy2.ipython
Warning (from warnings module):
File "D:\Soft_app\Python\lib\site-packages\rpy2\ipython\rmagic.py", line 76
"either.")))
UserWarning: The Python package 'pandas' is strongly recommended when using `rpy2.ipython`. Unfortunately it could not be loaded, and we did not manage to load 'numpy' either.
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import rpy2.ipython
File "D:\Soft_app\Python\lib\site-packages\rpy2\ipython\__init__.py", line 1, in <module>
from .rmagic import load_ipython_extension
File "D:\Soft_app\Python\lib\site-packages\rpy2\ipython\rmagic.py", line 81, in <module>
from IPython.core.displaypub import publish_display_data
ModuleNotFoundError: No module named 'IPython'
Can help to figure out what's issue??

It seems that you are missing Ipython and pandas. Installing them should resolve your issue.
Run "pip install ipython" to install Ipython and run "pip install pandas" to install pandas.
Hopefully, this will solve your problem.
Happy Coding ~

Related

ModuleNotFoundError: No module named 'six' - python 3.8.5

When trying to open jupyter notebook from my terminal in Visual Studio Code, I keep getting the error below. I have tried uninstalling and reinstalling six using conda install but the same issue persists. It was working fine yesterday so I don't know what happened between now and then. I'm using Python 3.8.5 in my virtual environment. Any ideas what could be the issue?
(dreams) C:\Users\jacks\Documents\dreams_project>jupyter notebook
Traceback (most recent call last):
File "C:\Users\jacks\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\jacks\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 83, in <module>
from .services.kernels.kernelmanager import MappingKernelManager, AsyncMappingKernelManager
File "C:\Users\jacks\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 18, in <module>
from jupyter_client.session import Session
File "C:\Users\jacks\Anaconda3\lib\site-packages\jupyter_client\session.py", line 41, in <module>
from jupyter_client.jsonutil import extract_dates, squash_dates, date_default
File "C:\Users\jacks\Anaconda3\lib\site-packages\jupyter_client\jsonutil.py", line 10, in <module>
from dateutil.parser import parse as _dateutil_parse
File "C:\Users\jacks\Anaconda3\lib\site-packages\dateutil\parser\__init__.py", line 2, in <module>
from ._parser import parse, parser, parserinfo, ParserError
File "C:\Users\jacks\Anaconda3\lib\site-packages\dateutil\parser\_parser.py", line 42, in <module>
import six
ModuleNotFoundError: No module named 'six'
I had the same issue, six was showing as installed by conda and loading fine when imported manually in python. The base version of Jupyter Notebook would load, but Jupyter Notebook wouldn't load in my virtual environment.
Running pip3 install six from a terminal with my environment activated seemed to solve the issue but I don't know why!
Also make sure the path to Conda in the VS Python extension settings is correct.

Cannot import installed python package (MacOS)

I cannot import any python package when running python on Visual Studio code or on my Terminal. I can still do this if I were to code on a Jupyter notebook. However, when I tried other environment that doesn't use the notebook server. It returns me ModuleNotFound Error like this
Traceback (most recent call last):
File "/Users/truongminh/Desktop/DataScience/Datasets/CityU Text/test_PreprocessText.py", line 1, in <module>
import PreprocessText
File "/Users/truongminh/Desktop/DataScience/Datasets/CityU Text/PreprocessText.py", line 1, in <module>
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
Most of my packages was download via anaconda. I don't know if it might be the cause of this.

How to deal with "ModuleNotFoundError: No module named 'setup' "

I installed the module "pyunicorn" in Ubuntu 16.04 LTS and all the dependencies but when I import the module in python 3.7.3 i get this error :
>>> import pyunicorn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/anaconda3/lib/python3.7/site-packages/pyunicorn/__init__.py", line 43, in <module>
from setup import __version__
ModuleNotFoundError: No module named 'setup'
What should i do to make it run properly???
I had this problem. I wanted to install it on Google Colab. I tried installing pyunicorn directly from Github and it worked for me. Try using following instruction:
pip install git+https://github.com/pik-copan/pyunicorn.git#egg=pyunicorn

ModuleNotFoundError: No module named 'torch._C'

I want to import the torch,but then the interpreter return this result,i have no idea how to deal with it
Traceback (most recent call last):
File "D:/Programing/tool/Python/learn_ml_the_hard_way/ML/scipy1.py", line 1, in <module>
import torch
File "D:\Programing\python\Anaconda3.5\lib\site-packages\torch\__init__.py", line 84, in <module>
from torch._C import *
ModuleNotFoundError: No module named 'torch._C'
I had the same problem and followed the instructions in this link
You can also find the torch path with this command if needed:
sudo find / -iname torch
In my case it was issue with python version, created python 3.7 environment and re-installed it. worked just fine
Initially I was running in a Conda environment got this error. Just deactivated the environment now it works.

ModuleNotFoundError: No module named 'cassandra'

After installing cassandra driver by running the command:
sudo pip3 install cassandra-driver, I am getting the error ModuleNotFoundError: No module named 'cassandra' when I try to import the module by running the line cassandra.
I then tried to see what all modules are installed in pip3 by running the command pip3 freeze:
astroid==2.1.0
cassandra-driver==3.16.0
isort==4.3.4
lazy-object-proxy==1.3.1
mccabe==0.6.1
pylint==2.2.2
six==1.12.0
wrapt==1.10.11
Seeing no cassandra, I tried to import the visible module: cassandra-driver and then I ended up with the error:
File "<stdin>", line 1
import cassandra-driver
^
SyntaxError: invalid syntax
Also, when I do correct the hyphen issue with this:
__import__("cassandra-driver"), I get the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cassandra-driver'
My which python3 is: /usr/local/bin/python3 and my which pip3 is: /usr/local/bin/pip3
My OS is MacOS
How to install cassandra?
Note: I am following this documentation.
Did you try to run these demos (from those docs)?
"If successful, you should be able to build and install the extension (just using setup.py build or setup.py install) and then use the libev event loop by doing the following:"
>>> from cassandra.io.libevreactor import LibevConnection
>>> from cassandra.cluster import Cluster
>>> cluster = Cluster()
>>> cluster.connection_class = LibevConnection
>>> session = cluster.connect()
There is a probability that actual module is named differently, e.g. there is another external package called Pillow, but you import it with name "PIL".
In docs they are importing from cassandra.cluster
Docs I'm referring to
$ echo 'import cassandra.cluster' > cassandra.py && python3 cassandra.py
Traceback (most recent call last):
File "./cassandra.py", line 3, in <module>
import cassandra
File "/home/xxx/cassandra.py", line 4, in <module>
import cassandra.cluster
ModuleNotFoundError: No module named 'cassandra.cluster'; 'cassandra' is not a package
Using a different filename, the error disappears:
echo 'import cassandra.cluster' > tmp.py && python3 cassandra.py
So, for me, the error was that my own program overrode the package. O.o

Resources