ModuleNotFoundError: No module named 'docopt' - python

I have installed docopt by typing pip3 install docopt and now it is well installed: You can see it on the list
umr5558-c02gl0y6drjm:Concatenate etudiant$ pip3 list
Package Version
--------------- -------
biopython 1.71
buildozer 0.34
cycler 0.10.0
docopt 0.6.2
kiwisolver 1.0.1
matplotlib 2.2.2
nose 1.3.7
numpy 1.14.2
pexpect 4.5.0
pip 10.0.0
ptyprocess 0.5.2
pyparsing 2.2.0
python-dateutil 2.7.2
pytz 2018.4
scipy 1.0.1
setuptools 39.0.1
sh 1.12.14
six 1.11.0
virtualenv 15.2.0
wheel 0.30.0
But when I try to import docoport from docopt on python3 it raises:
ModuleNotFoundError: No module named 'docopt'
Does someone have an idea?
Here is the path:
umr5558-c02gl0y6drjm:Concatenate etudiant$ pip3.6 install docopt
Requirement already satisfied: docopt in /usr/local/lib/python3.6/site-packages (0.6.2)
Here is the import section:
from Bio import codonalign
from Bio.Align import MultipleSeqAlignment
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import IUPAC
from Bio.Seq import Seq from Bio import AlignIO
from Bio import pairwise2
from Bio.codonalign.codonseq import _get_codon_list, CodonSeq, cal_dn_ds
import scipy
from Bio.Align.Applications import MuscleCommandline
from Bio.Align import MultipleSeqAlignment
from scipy.linalg import expm
from Bio import SeqIO
import sys
import numpy as np
from docopt import docopt
Thanks

Hello
Try it
sudo apt install python3-docopt

I had a similar problem and this is how I solved it:I also had installed docopt via pip install docopt, and I have both python 2 and 3 in my mac. The problem is that docopt is installed for python 3, but when running the .py file in terminal, it ran in python 2 by default. Just add #!/usr/bin/env python3 to the very beginning of your .py file, and it should fix your issue.

Related

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

How import module in 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

Code is running in VS Code but not in Terminal

My python script is perfectly running in vs code, but when I run it via terminal I get the error message
"ImportError: No module named concurrent.futures"
I use a venv and a pip list shows:
Package Version
-------------- ----------
appdirs 1.4.4
attrs 19.3.0
beautifulsoup4 4.9.1
black 19.10b0
certifi 2020.4.5.2
chardet 3.0.4
click 7.1.2
futures 3.1.1
idna 2.9
pathspec 0.8.0
pip 19.2.3
regex 2020.6.8
requests 2.23.0
setuptools 41.2.0
soupsieve 2.0.1
toml 0.10.1
typed-ast 1.4.1
urllib3 1.25.9
The import in my code looks like this:
import concurrent.futures
import csv
import os
import re
import time
from datetime import date
import requests
from bs4 import BeautifulSoup
I also tried:
from futures import ThreadPoolExecutor
import concurrent.futures
installing futures not in a venv
updating futures
uninstalling futures
EDIT:
my goal is to run the script daily so I followed this tutorial Link
and I'm stuck at the point were I create a Unix executable file. When I run this file the terminal shows the error.
I figured it out my self and it was quite simple...
In the tutorial they create this file with
#!/bin/sh
Python /Users/yanissilloul/Documents/instabot-master/examples/like_hashtags_copy.py neonphotography
The solution was to activate the venv before running the .py file.
#!/bin/sh
source .venv/bin/activate
Python /Users/yanissilloul/Documents/instabot-master/examples/like_hashtags_copy.py neonphotography
Thanks to Niklas Mertsch, your question brought me there.

Module not found error : While module is installed and listed in the pip list

I have installed biopython and related modules but when I try to load them as
from BCBio.GFF import GFFExaminer
import pprint
from BCBio import GFF
It is throwing following error,
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-44-5e2a9411b6ce> in <module>
----> 1 from BCBio.GFF import GFFExaminer
2 import pprint
3 from BCBio import GFF
4 import gzip
5 import numpy as np
~/software/anaconda/lib/python3.7/site-packages/BCBio/GFF/__init__.py in <module>
1 """Top level of GFF parsing providing shortcuts for useful classes.
2 """
----> 3 from BCBio.GFF.GFFParser import GFFParser, DiscoGFFParser, GFFExaminer, parse, parse_simple
4 from BCBio.GFF.GFFOutput import GFF3Writer, write
5
~/software/anaconda/lib/python3.7/site-packages/BCBio/GFF/GFFParser.py in <module>
30 collections.defaultdict = _utils.defaultdict
31
---> 32 from Bio.Seq import UnknownSeq
33 from Bio.SeqRecord import SeqRecord
34 from Bio import SeqFeature
ModuleNotFoundError: No module named 'Bio'
Python version : Python 3.7.2
pip version : pip 18.1
And When I do
pip list
I see both bio and biopython in the list
bio 0.1.0
biopython 1.74
bcbio-gff 0.6.6
bcrypt 3.1.6
binaryornot 0.4.4
bio 0.1.0
biopython 1.74
bleach 3.0.2
boto3 1.9.139
botocore 1.12.139
Any suggestions or help is much appreciated.
Your pip list doesn't show bcbio-gff package installed.
Try:
pip install bcbio-gff
As a further note, bio is a profiling package, and probably not what you were looking for.
Try creating a new virtualenv:
python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip
pip install biopython bcbio-gff
Then try running your script again.

import simplejson - no module named simplejson

my python version is 2.7.14 in windows 7
I have import simplejson with command "pip install simplejson"
my code is
import os
import platform
import re
import subprocess
import sys
import threading
import simplejson
error messge is
ImportError: No module named simplejson
how can i fix this ?
Download it from here - simplejson 3.12.0
Install
Enjoy
If you have Python and pip in your PATH just run the following command in your console.
$ pip install simplejson
The console will return the following output
Collecting simplejson
Downloading simplejson-3.13.2-cp27-cp27m-win32.whl (68kB)
Installing collected packages: simplejson
Successfully installed simplejson-3.13.2

Categories