Jupyter lab: module not found though package already installed - python

This is the complaint that I got:
~\Documents\IT\2020 SUM\32933\Resemblyzer\resemblyzer\audio.py in <module>
4 from typing import Optional, Union
5 import numpy as np
----> 6 import webrtcvad
7 import librosa
8 import struct
ModuleNotFoundError: No module named 'webrtcvad'
After checking solutions, I tried sys.executable and sys.path
then here are the outputs:
C:\Anaconda\python.exe
['C:\\Users\\Jocelyn Huang\\Documents\\IT\\2020 SUM\\32933\\Resemblyzer', 'C:\\Anaconda\\python37.zip', 'C:\\Anaconda\\DLLs', 'C:\\Anaconda\\lib', 'C:\\Anaconda', '', 'C:\\Anaconda\\lib\\site-packages', 'C:\\Anaconda\\lib\\site-packages\\win32', 'C:\\Anaconda\\lib\\site-packages\\win32\\lib', 'C:\\Anaconda\\lib\\site-packages\\Pythonwin', 'C:\\Anaconda\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\Jocelyn Huang\\.ipython']
Then I check the root package, It has "webrtcvad":
I also tried the conda env, though the package is also available, I still received the same complaint in this env:
After many attempts, I still cannot figure out what it going on here,
excuse my poor knowledge about this...

Follow the below steps:
Uninstall webrtcvad
pip uninstall webrtcvad conda uninstall webrtcvad
Take restart of your system
Install webrtcvad again
conda install webrtcvad
Also to check package installed with conda you need to do conda list instead of pip list
I don't really have the answer as to why this happens, but recently it happened with me and steps shared above resolved it.

Related

Unable to import patch sklearn

after importing and installing required packages and libraries I am encountering an import error on patch_sklearn().
from sklearnx import patch_sklearn()
patch_sklearn()
ImportError: cannot import name 'sparse_lsqr' from 'sklearn.utils.fixes' (C:\Users\yogis\AppData\Roaming\Python\Python38\site-packages\sklearn\utils\fixes.py)
Didn't know what you want to do here.
But you can try this:
from sklearn.feature_extraction.image import extract_patches_2d
You must install scikit learn version 1.0 and not 1.1
pip install scikit-learn==1.0
Then after this, restart kernel. If it doesn't work after this, I also had to force reinstall the other packages for conda.
conda install numpy scipy joblib scikit-learn --force-reinstall
and then restart kernel. It worked fine. This is a known bug and is fixed on pypi releases but not yet on conda.

Module Not found when importing PyCaret in Jupyter

I'm trying to learn PyCaret but having a problem when trying to import it in Jupyter Lab.
I'm working in a virtualenv and installed pycaret via pip:
pip install pycaret
I can confirm its installed via pip list:
prompt-toolkit 3.0.7
protobuf 3.13.0
py 1.9.0
pycaret 2.1.2
pycparser 2.20
The very first line in the notebook is:
from pycaret.nlp import *
however this results in:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-7c206b4a9ead> in <module>
----> 1 from pycaret.nlp import *
2 import psycopg2
3 import sys, os
4 import numpy as np
5 import pandas as pd
ModuleNotFoundError: No module named 'pycaret'
I'm pulling my hair out trying to figure this out and can't find anyone else with something similar.
I've tried to import via the python shell as well and that works perfectly.
You should create a seperate environment for installing time series alpha module
after creating a new environment and switching into
pip install pycaret-ts-alpha
and then you will be able to access
https://towardsdatascience.com/announcing-pycarets-new-time-series-module-b6e724d4636c
I forgot that you had to install modules via Jupyter.
Following this guide: http://jakevdp.github.io/blog/2017/12/05/installing-python-packages-from-jupyter/index.html
Installing like so:
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install numpy
Got it working
First Create a new environment conda documentation
Second Download the Pycaret with this instruction
Third check your sklearn version is greater thansklearn>=0.23.2.
Because if it's greater PyCaret is not compatible with that.
Nothing works for you? Download directly from github with this command
pip install git+https://github.com/pycaret/pycaret.git#egg=pycaret
I read on the tutorial page of pycaret that to install it through a Jupyter-notebook you should add an exclamation mark in front of the python command in the Jupyter-cell:
!pip install pycaret

“ImportError: no module named 'bcolz'” after installing with pip

So I'm currently running on Windows 7 and I'm trying to run some jupyter notebook. I use Python 2.7.13 and Anaconda. I did "pip install bcolz" and everything went well, but I still can't import it. I even tried "conda install bcolz" and everything went smooth again but no luck again. I run everything via cygwin and everything just looks good to me.
I've seen many questions like this one here but none really helped me. Reinstall didn't work and other things were too problem specific.
Any idea ? :(
Edit(code):
C:\Users\NyaHo\courses-master\deeplearning1\nbs\utils.py in <module>()
20 from scipy.ndimage import imread
21 from sklearn.metrics import confusion_matrix
---> 22 import bcolz
23 from sklearn.preprocessing import OneHotEncoder
24 from sklearn.manifold import TSNE
ImportError: No module named bcolz
Also:
$ python -V
Python 2.7.13
$ pip --version
pip 8.1.2 from E:\PythonAnaconda\lib\site-packages (python 2.7)
$ conda --version
conda 4.3.22
The below command got me some progress:
conda install -c anaconda bcolz
However, I also had to fix permissions on my anaconda install directory (Ubunutu).

Anaconda installation not finding packages

This one is best shown through what I'm trying to do and what is going on.
In my python file, I want to import seaborn.
It's available to install via conda.
(me_dev)[me#ip-***]$ conda install seaborn
Fetching package metadata: ....
Solving package specifications: ............................
# All requested packages already installed.
# packages in environment at /home/me/miniconda/envs/me_dev:
#
seaborn 0.7.0 py27_0
(me_dev)[me#ip-***** ****]$ which python
~/miniconda/bin/python
(me_dev)[me#ip-****]$ which ipython
~/miniconda/bin/ipython
Now if I start iPython and import seaborn:
In [1]: import seaborn
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-085c0287ecb5> in <module>()
----> 1 import seaborn
ImportError: No module named seaborn
Also, pip is not working either. It's not reading packages from pip.
(me_dev)[me#ip-*****]$ pip install jellyfish
Requirement already satisfied (use --upgrade to upgrade): jellyfish in /home/me/miniconda/lib/python2.7/site-packages
Yet:
from jellyfish import jaro_winkler ImportError: No module named jellyfish
Edit:
sys.path looks like so in iPython
['',
'/home/me/miniconda/bin',
'/home/me/miniconda/lib/python27.zip',
'/home/me/miniconda/lib/python2.7',
'/home/me/miniconda/lib/python2.7/plat-linux2',
'/home/me/miniconda/lib/python2.7/lib-tk',
'/home/me/miniconda/lib/python2.7/lib-old',
'/home/me/miniconda/lib/python2.7/lib-dynload',
'/home/me/miniconda/lib/python2.7/site-packages/setuptools-19.6.2-py2.7.egg',
'/home/me/miniconda/lib/python2.7/site-packages',
'/home/me/miniconda/lib/python2.7/site-packages/cryptography-1.0.2-py2.7-linux-x86_64.egg',
'/home/me/miniconda/lib/python2.7/site-packages/IPython/extensions',
'/home/me/.ipython']
Here's my .bashsrc
(me_dev)[me#ip-**** ~]$ cat .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# added by Miniconda 3.16.0 installer
export PATH="/home/me/miniconda/bin:$PATH"
# User specific aliases and functions
source activate me_dev
# added by Miniconda2 3.19.0 installer
export PATH="/home/me/miniconda/bin:$PATH"
I think which python (and which ipython) should be pointing at ~/miniconda/envs/me_dev/bin/, not at ~/miniconda/bin/ directory. When you start an python session with those binaries, they can't see your seaborn library, which is probably only installed in the environment site packages.
I'm not sure exactly how you ended up in this state, but I would recommend trying to make a new environment and see if you end up pointed at the correct binaries.
The organization your .bashrc is the problem. You're activating your virtual environment, but then giving the main miniconda bin directory precedence in your $PATH, which has the effect of partially inactivating the virtual environment.

IPython notebook install error

I'm trying to install IPython notebook on OS X 10.10.2.
After all dependencies have been added, this error occurs:
File "/Library/Python/2.7/site-packages/jinja2/tests.py", line 14, in <module>
from jinja2._compat import text_type, string_types, integer_types
ImportError: cannot import name integer_types
How can I fix this?
How are you installing ipython?
If you have pip, are you using pip install ipython[all]?
I also recommend using virtualenv to start with a completely clean python2.7 install from scratch and see if you encounter the errors still. There may be some version compatibility conflicts on the system.
Alternative is you can install the Anaconda distribution which comes prepackaged with ipython and dependencies http://continuum.io/downloads

Categories

Resources