modulenotfounderror no module named 'modin' - python

I have created a virtual environment with following syntax in the windows terminal:
conda create --prefix ./modinenv python=3.6 numpy
conda activate e:\modin\modinenv
pip install modin[dask]
jupyter notebook
In a new python file, when i executed this following command:
import modin.pandas as pd
it gives me an error: modulenotfounderror no module named 'modin'
I searched many forum, but got no workable response to this.
I even tried following before import statement:
import os
os.environ["MODIN_ENGINE"] = "dask" # Modin will use Dask
import modin.pandas as pd
This also does not work here. So any help in this regard is appreciated.
Thanks
Gopinath

I have exactly the same environment setting as you.
import os
import modin.pandas as pd
os.environ["MODIN_ENGINE"] = "dask"
Try following:
It seems that your Modin may not install properly, so please try pip install -U modin according to Modin documentation
pip3 install 'modin[dask]'

Related

Networkx & Jupyter Notebook using pip AttributeError

Hi everyone, I'm trying to create a network visualization with python using the networkx package. Unfortunately I'm getting a "AttributeError: module 'scipy.sparse' has no attribute 'coo_array'" at the end of my code. I've tried to fix it but every help in the internet points towards upgrading pip or conda which I've done and still get the same error. I'm using jupyter notebooks - any help would be greatly appreciated!
#Prerequisites
import sys
!{sys.executable} -m pip install --user networkx
!{sys.executable} -m pip install --user numpy
!{sys.executable} -m pip install --user pandas
pip install notebook --upgrade
conda upgrade notebook
import networkx as nx
import numpy as np
import pandas as pd
from pathlib import Path
from pandas import DataFrame
#Read in Source File - NB this must match the schema requirements
df_InputData = pd.read_excel("/Users/paulkruse/Desktop/FR/Fr1.xlsx")
Src_Column = 'Source ID'
Tgt_Column = 'Target ID'
print(df_InputData);
#Nodes are positioned using the Fruchterman-Reingold force-directed algorithm.
Q = nx.Graph()
arr_SrcTgt= np.array(df_InputData[[Src_Column, Tgt_Column]])
print(arr_SrcTgt);
Q.add_edges_from(arr_SrcTgt)
dict_Coords = nx.spring_layout(Q)
It seems that your scipy version is out of date. The most recent version 1.8.1 certainly has coo_array function. One way to resolve this should be to upgrade scipy. If you're doing this from inside jupyter notebook, then use
!pip install --user scipy==1.8.1
Make sure to restart kernel after installation.

Modin - ModuleNotFoundError: No module named 'ray'

I'm trying to use Modin on Databricks and getting this error
I've tried both pip install modin[all] and pip install modin[ray]
Firstly, the installation takes 15 minutes, which is weird.
After installing, I'm doing
import modin.pandas as md
df = md.read_parquet('s3://path/to/file')
Getting this error
ModuleNotFoundError: No module named 'ray'
I have also tried setting os.environ["MODIN_ENGINE"] = "ray"
I followed the below steps to install Modin using Ray execution engine.
Install Modin dependencies and Ray to run on Ray -
pip install modin[ray]
Also, please customize your Ray environment for use in Modin using the below commands.
import ray
ray.init()
import modin.pandas as pd
Please check out Intel Distribution of Modin (https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-of-modin.html#gs.14j7r0) and Modin official page (https://modin.readthedocs.io/en/stable/) for installation issues and to accelerate pandas workflow on Intel architectures.
Try
pip install ray
May be this will help you.

ModuleNotFoundError: No module named 'pycountry' even though it is installed

I got this error from python ModuleNotFoundError: No module named 'pycountry'.
I imported the module using pip and pip3 and I've also tried running my code in terminal using python, python3, and IDLE.
Why doesn't python recognize the module? I'm receiving the same error about plotly and pandas as well.
import pycountry
import plotly.express as px
import pandas as pd
URL_DATASET = r'https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csvā€© '
df1 = pd.read_csv(URL_DATASET)
list_countries = df1['Country'].unique().tolist()
d_country_code = {}
Open your command window and then use this code there.
pip install pycountry
This will install the whole package in your system, so whenever you import the module, it will not show an error.
This worked for me, I was facing the same issue while using it in Jupyter Notebook.
If you want more information please visit this page.
If you have Anaconda, try:
conda install -c conda-forge pycountry

Cannot import or install pandas-profiling in Jupyter Notebook

I have technically already installed pandas-profiling using
pip install pandas-profiling
But when I try to import it, I get the following error:
import numpy as np
import pandas as pd
import pandas_profiling
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-e1a23f2a6f04> in <module>()
1 import numpy as np
2 import pandas as pd
3 import pandas_profiling
ModuleNotFoundError: No module named 'pandas_profiling'
First Error Image
So I tried installing it in Jupyter Notebook and got the following error as well:
import sys
!{sys.executable} -m pip install pandas-profiling
Collecting pandas-profiling
Could not find a version that satisfies the requirement pandas-profiling
(from versions: )
No matching distribution found for pandas-profiling
Second Error Image
I am also unable to install it using conda for both as I am unable to establish a connection to conda.anaconda.org for some reason.
To others who are looking to resolve this issue try these alternate steps :
Run pip install pandas-profiling command in a separate cell in the jupyter notebook.
After this just restart the kernal and run again. This should definitely work. Worked for me.
Based on the comments I was able to figure out the issue. I had to install jupyter notebook outside of the Anaconda root env and open it from the terminal.
pip3 install jupyter notebook
Once I did that it imported properly.
Steps:
Download the ZIP
Open Anaconda Prompt and go to the directory and extract the files to a folder
cd
C:\Users\farah\Downloads\pandas-profiling-master\pandas-profiling-master
Then type python setup.py install
Now you can use:
import pandas_profiling as pp
df = pd.read_csv('1234.csv')
pp.ProfileReport(df)
Reference: Pandas profiling
!pip install pandas_profiling # Run this from Jupytor notebook Ignore the warnings if any
from pandas_profiling import ProfileReport #restart the kernel if throws error
ProfileReport(df)
Note: This worked for me on Windows 10
From Anaconda Prompt:
conda install -c conda-forge pandas-profiling

ImportError: No module named pandas. Pandas installed

I am pretty new to programming and am having issues importing pandas to my program. Hoping someone could point me in the right direction to fix this. I am running OSX
regresson.py
import pandas as pd
import Quandl
df = Quandl.get('WIKI/GOOGL')
print df.head
and am getting the error:
import pandas as pd
ImportError: No module named panda
I have anaconda on my system.
Pandas 0.17.1
Numpy 1.11.1
Scipy 0.18.0
Pytz 2016.6.1
make sure to activate your conda environment
in your terminal-
conda create -n environment_name quandl pandas
cd path_to_env
activate environment_name
(environment_name)conda list (make sure u have the right packages)
(environment_name) your_program.py
# if using pip
pip install pandas
# if using anaconda
conda install pandas
#after this step use
condo update -all
Python imports, and the language itself, is case sensitive. This means that after you fix the pandas installation, you'll also need
import quandl
and not
import Quandl
On another note, it's worth noting that we usually call df.head(), not df.head. This way, when working on a Jupyter notebook, as an example, the formatting is nicer. Also you can specify the number of first rows you want to see, such as df.head(10).

Categories

Resources