How import module in python - python

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

Related

from six.moves import urllib ImportError: No module named six.moves

i have installed six but i got error below:
from six.moves import urllib
ImportError: No module named six.moves
When executing
pip install six.moves
:
Could not find a version that satisfies the requirement six.moves (from versions: )
No matching distribution found for six.moves
i am using python 3.5.6
Tensorflow 1.x is deprecated to use and no longer supported. This could be the reason for the above error.
Please try again by upgrading the tensorflow version to TF 2.x as per this tested build configuration which does not show any error while importing the above package.
You can use below code to install tensorflow
!pip install --upgrade tensorflow #or
!pip install tensorflow==2.2 # can mention specific TF version to install
and then import six package libraries
from six.moves import urllib
Note: This six package get installed automatically while installing tensorflow:

ImportError: No module named speech_recognition

Getting ImportError: No module named speech_recognition,
Code Snippet:
# for speech-to-text
import speech_recognition as sr
# for text-to-speech
from gtts import gTTS
# for language model
import transformers
import os
import time
# for data
import os
import datetime
import numpy as np
I have already tried pip3 install SpeechRecognition and pip install SpeechRecognition
pip3 install SpeechRecognition
Requirement already satisfied: SpeechRecognition in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (3.8.1)
WARNING: You are using pip version 21.3.1; however, version 22.1.2 is available.
You should consider upgrading via the '/usr/local/bin/python3 -m pip install --upgrade pip' command.
I am using Python 3.8

ImportError: cannot import name 'constrained_dtw' from 'dtw'

Does anyone know the solution of this problem:
ImportError: cannot import name 'constrained_dtw' from 'dtw'
I installed python DTW (Dynamic Time Warping) module via
pip install dtw
and I tried to solve it by install:
pip install dtaidistance
pip install dtw-python
without any result

How do I import 'umap' package in python?

After install 'umap' package, I can't import
I tried reinstall pre version (1.3.10, 1.4.0rc1).
But, It's not working
How can I do?
!pip3 install umap-learn
!pip3 install umap-learn[plot]
import umap
This is the error I get:
No module named 'umap'
you probably confused umap and umap-learn libs,
if that's the case, the code below'll solve your problem
https://umap-learn.readthedocs.io/en/latest/basic_usage.html
pip uninstall umap
pip install umap-learn
import umap.umap_ as umap
reducer = umap.UMAP()

ImportError: No module named scenedetect on Linux Ubuntu

I'm trying to use pyscenedetect library on python for videos but I get this error when using the python interface and when I use the command line interface I get the error "ModuleNotFoundError: No module named 'cv2'"
even though I believe I installed both correctly according to the documentations.
I have trying to look for different ways to import opencv for the second error but to no avail. As for the first error i can't find any answers to my problem.
import cv2
import numpy as numpy
import os
import scenedetect
from scenedetect.video_manager import VideoManager
from scenedetect.scene_manager import SceneManager
from scenedetect.frame_timecode import FrameTimecode
from scenedetect.stats_manager import StatsManager
from scenedetect.detectors import ContentDetector
If you have pip you can try
pip install opencv-python
If you have anaconoda, you can try
conda install -c conda-forge opencv
it's probable that you installed it on a different python installation in your PC.
To know where your python installation is you can launch python and:
import sys
sys.path
To get the list of everything you have installed you can:
pip freeze > installed_modules.txt
Try only running
import cv2
So that you can test it
I found the problem. As Ivan was pointing out, the problem was with openCV.
I used the following command:
sudo apt install python3-opencv

Categories