HuggingFace - 'optimum' ModuleNotFoundError - python

I want to run the 3 code snippets from this webpage.
I've made all 3 one post, as I am assuming it all stems from the same problem of optimum not having been imported correctly?
Kernel: conda_pytorch_p36
Installations:
pip install optimum
OR
! pip install datasets transformers optimum[intel]
Both provide same Traceback:
Requirement already satisfied: optimum in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (0.1.3)
Requirement already satisfied: transformers>=4.12.0 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from optimum) (4.15.0)
Requirement already satisfied: coloredlogs in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from optimum) (15.0.1)
Requirement already satisfied: torch>=1.9 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from optimum) (1.10.1)
Requirement already satisfied: sympy in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from optimum) (1.8)
Requirement already satisfied: typing-extensions in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from torch>=1.9->optimum) (3.10.0.0)
Requirement already satisfied: dataclasses in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from torch>=1.9->optimum) (0.8)
Requirement already satisfied: numpy>=1.17 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.12.0->optimum) (1.19.5)
Requirement already satisfied: packaging>=20.0 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.12.0->optimum) (21.3)
Requirement already satisfied: pyyaml>=5.1 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.12.0->optimum) (5.4.1)
Requirement already satisfied: sacremoses in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.12.0->optimum) (0.0.46)
Requirement already satisfied: tqdm>=4.27 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.12.0->optimum) (4.62.3)
Requirement already satisfied: regex!=2019.12.17 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.12.0->optimum) (2021.4.4)
Requirement already satisfied: requests in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.12.0->optimum) (2.25.1)
Requirement already satisfied: huggingface-hub<1.0,>=0.1.0 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.12.0->optimum) (0.2.1)
Requirement already satisfied: tokenizers<0.11,>=0.10.1 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.12.0->optimum) (0.10.3)
Requirement already satisfied: importlib-metadata in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.12.0->optimum) (4.5.0)
Requirement already satisfied: filelock in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.12.0->optimum) (3.0.12)
Requirement already satisfied: humanfriendly>=9.1 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from coloredlogs->optimum) (10.0)
Requirement already satisfied: mpmath>=0.19 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from sympy->optimum) (1.2.1)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from packaging>=20.0->transformers>=4.12.0->optimum) (2.4.7)
Requirement already satisfied: zipp>=0.5 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from importlib-metadata->transformers>=4.12.0->optimum) (3.4.1)
Requirement already satisfied: idna<3,>=2.5 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from requests->transformers>=4.12.0->optimum) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from requests->transformers>=4.12.0->optimum) (2021.5.30)
Requirement already satisfied: chardet<5,>=3.0.2 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from requests->transformers>=4.12.0->optimum) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from requests->transformers>=4.12.0->optimum) (1.26.5)
Requirement already satisfied: joblib in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from sacremoses->transformers>=4.12.0->optimum) (1.0.1)
Requirement already satisfied: click in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from sacremoses->transformers>=4.12.0->optimum) (8.0.1)
Requirement already satisfied: six in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from sacremoses->transformers>=4.12.0->optimum) (1.16.0)
Note: you may need to restart the kernel to use updated packages.
from optimum.intel.lpot.quantization import LpotQuantizerForSequenceClassification
# Create quantizer from config
quantizer = LpotQuantizerForSequenceClassification.from_config(
"echarlaix/quantize-dynamic-test",
"quantization.yml",
model_name_or_path="textattack/bert-base-uncased-SST-2",
)
model = quantizer.fit_dynamic()
Traceback:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-9dcf25f181ea> in <module>
----> 1 from optimum.intel.lpot.quantization import LpotQuantizerForSequenceClassification
2
3 # Create quantizer from config
4 quantizer = LpotQuantizerForSequenceClassification.from_config(
5 "echarlaix/quantize-dynamic-test",
ModuleNotFoundError: No module named 'optimum.intel.lpot'
from optimum.intel.lpot.pruning import LpotPrunerForSequenceClassification
# Create pruner from config
pruner = LpotPrunerForSequenceClassification.from_config(
"echarlaix/magnitude-pruning-test",
"prune.yml",
model_name_or_path="textattack/bert-base-uncased-SST-2",
)
model = pruner.fit()
Traceback:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-7-e9872c164aee> in <module>
----> 1 from optimum.intel.lpot.pruning import LpotPrunerForSequenceClassification
2
3 # Create pruner from config
4 pruner = LpotPrunerForSequenceClassification.from_config(
5 "echarlaix/magnitude-pruning-test",
ModuleNotFoundError: No module named 'optimum.intel.lpot'
from optimum.graphcore import IPUTrainer
from optimum.graphcore.bert import BertIPUConfig
from transformers import BertForMaskedLM, BertTokenizer
from poptorch.optim import AdamW
# Allocate model and tokenizer as usual
tokenizer = BertTokenizer.from_pretrained("bert-base-cased")
model = BertForMaskedLM.from_pretrained("bert-base-cased")
# Trainer + poptorch custom configuration optional
ipu_config = BertIPUConfig()
trainer = IPUTrainer(model, trainings_args, config=ipu_config)
optimizer = AdamW(model.parameters)
# This is hidden from the user, it will be handled by the Trainer
with trainer.compile(some_data_loader) as model_f:
for steps in range(10): # !
outputs = trainer.step(optimizer)
# Save the model and/or push to hub
model.save_pretrained("...")
model.push_to_hub("...")
Traceback:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-8-921e03245390> in <module>
----> 1 from optimum.graphcore import IPUTrainer
2 from optimum.graphcore.bert import BertIPUConfig
3 from transformers import BertForMaskedLM, BertTokenizer
4 from poptorch.optim import AdamW
5
ModuleNotFoundError: No module named 'optimum.graphcore'
Please let me know if there's anything else I can add to post.

Pointed out by a Contributor of HuggingFace, on this Git Issue,
The library previously named LPOT has been renamed to Intel Neural Compressor (INC), which resulted in a change in the name of our subpackage from lpot to neural_compressor.
The correct way to import would now be from optimum.intel.neural_compressor.quantization import IncQuantizerForSequenceClassification
Concerning the graphcore subpackage, you need to install it first with pip install optimum[graphcore]
Furthermore you'll need to have access to an IPU in order to use it.
Solution
! pip install datasets transformers optimum[graphcore]
Instead of:
from optimum.intel.lpot.quantization import LpotQuantizerForSequenceClassification
from optimum.intel.lpot.pruning import LpotPrunerForSequenceClassification
from optimum.intel.neural_compressor.quantization import IncQuantizerForSequenceClassification
from optimum.intel.neural_compressor.pruning import IncPrunerForSequenceClassification

Related

YouTube video viewer program

I am trying to use the Youtube viewer program on someone's YouTube videos. The source code of this program can be found on the GitHub page.
There is a problem in the import statements, though.
In the YouTube viewer -> youtubeviewer -> download_driver.py file, so this page, there is an import statement.
import undetected_chromedriver._compat as uc
At first when I tried to run this program, the following error pops up:
ModuleNotFoundError: No module named 'undetected_chromedriver'
I eventually installed it using the python3 -m pip install undetected_chromedriver command. Everything ran smoothly until the statement above. The command prompt popped up the following error message.
Traceback (most recent call last):
File "C:\Users\14725\YouTube-Viewer\youtube_viewer.py", line 42, in <module>
from youtubeviewer.download_driver import *
File "C:\Users\14725\YouTube-Viewer\youtubeviewer\download_driver.py", line 29, in <module>
import undetected_chromedriver._compat as uc
ModuleNotFoundError: No module named 'undetected_chromedriver._compat'
I checked again if I had installed the module by using the python3 -m pip install undetected_chromedriver command. The following messages popped up:
Requirement already satisfied: undetected_chromedriver in c:\users\14725\appdata\roaming\python\python39\site-packages (3.4)
Requirement already satisfied: requests in c:\users\14725\appdata\roaming\python\python39\site-packages (from undetected_chromedriver) (2.28.0)
Requirement already satisfied: selenium>=4.0.0 in c:\users\14725\appdata\roaming\python\python39\site-packages (from undetected_chromedriver) (4.8.0)
Requirement already satisfied: websockets in c:\users\14725\appdata\roaming\python\python39\site-packages (from undetected_chromedriver) (10.4)
Requirement already satisfied: certifi>=2021.10.8 in c:\users\14725\appdata\roaming\python\python39\site-packages (from selenium>=4.0.0->undetected_chromedriver) (2022.5.18.1)
Requirement already satisfied: trio~=0.17 in c:\users\14725\appdata\roaming\python\python39\site-packages (from selenium>=4.0.0->undetected_chromedriver) (0.22.0)
Requirement already satisfied: urllib3[socks]~=1.26 in c:\users\14725\appdata\roaming\python\python39\site-packages (from selenium>=4.0.0->undetected_chromedriver) (1.26.9)
Requirement already satisfied: trio-websocket~=0.9 in c:\users\14725\appdata\roaming\python\python39\site-packages (from selenium>=4.0.0->undetected_chromedriver) (0.9.2)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\14725\appdata\roaming\python\python39\site-packages (from requests->undetected_chromedriver) (2.0.12)
Requirement already satisfied: idna<4,>=2.5 in c:\users\14725\appdata\roaming\python\python39\site-packages (from requests->undetected_chromedriver) (3.3)
Requirement already satisfied: cffi>=1.14 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.15.0)
Requirement already satisfied: sniffio in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.3.0)
Requirement already satisfied: sortedcontainers in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (2.4.0)
Requirement already satisfied: async-generator>=1.9 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.10)
Requirement already satisfied: outcome in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.2.0)
Requirement already satisfied: attrs>=19.2.0 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (21.4.0)
Requirement already satisfied: exceptiongroup>=1.0.0rc9 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (1.1.0)
Requirement already satisfied: wsproto>=0.14 in c:\users\14725\appdata\roaming\python\python39\site-packages (from trio-websocket~=0.9->selenium>=4.0.0->undetected_chromedriver) (1.2.0)
Requirement already satisfied: PySocks!=1.5.7,<2.0,>=1.5.6 in c:\users\14725\appdata\roaming\python\python39\site-packages (from urllib3[socks]~=1.26->selenium>=4.0.0->undetected_chromedriver) (1.7.1)
Requirement already satisfied: pycparser in c:\users\14725\appdata\roaming\python\python39\site-packages (from cffi>=1.14->trio~=0.17->selenium>=4.0.0->undetected_chromedriver) (2.21)
Requirement already satisfied: h11<1,>=0.9.0 in c:\users\14725\appdata\roaming\python\python39\site-packages (from wsproto>=0.14->trio-websocket~=0.9->selenium>=4.0.0->undetected_chromedriver) (0.14.0)
Which I think these have indicated that I have the module installed. What should I do to run this program? Have I missed something?
There was an important update of undetected_chromedriver recently. I recommend you to install the latest known stable version with:
pip install undetected-chromedriver==3.2.1

ModuleNotFoundError: No module named 'nn_pruning.modules.quantization'

Goal: install nn_pruning.
Kernel: conda_pytorch_p36. I performed Restart & Run All.
It seems to recognise the optimize_model import, but not other functions. Even though they are from the same nn_pruning library.
pip install nn_pruning | pip install -U nn_pruning
Requirement already satisfied: nn_pruning in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (0.1.2)
Requirement already satisfied: torch>=1.6 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from nn_pruning) (1.8.1+cpu)
Requirement already satisfied: transformers>=4.3.0 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from nn_pruning) (4.15.0)
Requirement already satisfied: click in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from nn_pruning) (8.0.1)
Requirement already satisfied: scikit-learn>=0.24 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from nn_pruning) (0.24.2)
Requirement already satisfied: joblib>=0.11 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from scikit-learn>=0.24->nn_pruning) (1.0.1)
Requirement already satisfied: numpy>=1.13.3 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from scikit-learn>=0.24->nn_pruning) (1.19.5)
Requirement already satisfied: scipy>=0.19.1 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from scikit-learn>=0.24->nn_pruning) (1.5.4)
Requirement already satisfied: threadpoolctl>=2.0.0 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from scikit-learn>=0.24->nn_pruning) (2.1.0)
Requirement already satisfied: dataclasses in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from torch>=1.6->nn_pruning) (0.8)
Requirement already satisfied: typing-extensions in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from torch>=1.6->nn_pruning) (3.10.0.0)
Requirement already satisfied: huggingface-hub<1.0,>=0.1.0 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.3.0->nn_pruning) (0.2.1)
Requirement already satisfied: tqdm>=4.27 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.3.0->nn_pruning) (4.62.3)
Requirement already satisfied: packaging>=20.0 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.3.0->nn_pruning) (21.3)
Requirement already satisfied: filelock in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.3.0->nn_pruning) (3.0.12)
Requirement already satisfied: pyyaml>=5.1 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.3.0->nn_pruning) (5.4.1)
Requirement already satisfied: requests in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.3.0->nn_pruning) (2.25.1)
Requirement already satisfied: sacremoses in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.3.0->nn_pruning) (0.0.46)
Requirement already satisfied: tokenizers<0.11,>=0.10.1 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.3.0->nn_pruning) (0.10.3)
Requirement already satisfied: importlib-metadata in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.3.0->nn_pruning) (4.5.0)
Requirement already satisfied: regex!=2019.12.17 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from transformers>=4.3.0->nn_pruning) (2021.4.4)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from packaging>=20.0->transformers>=4.3.0->nn_pruning) (2.4.7)
Requirement already satisfied: zipp>=0.5 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from importlib-metadata->transformers>=4.3.0->nn_pruning) (3.4.1)
Requirement already satisfied: idna<3,>=2.5 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from requests->transformers>=4.3.0->nn_pruning) (2.10)
Requirement already satisfied: chardet<5,>=3.0.2 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from requests->transformers>=4.3.0->nn_pruning) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from requests->transformers>=4.3.0->nn_pruning) (1.26.5)
Requirement already satisfied: certifi>=2017.4.17 in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from requests->transformers>=4.3.0->nn_pruning) (2021.5.30)
Requirement already satisfied: six in /home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages (from sacremoses->transformers>=4.3.0->nn_pruning) (1.16.0)
Note: you may need to restart the kernel to use updated packages.
import functools
from tqdm import tqdm
import torch
#from datasets import load_dataset
from transformers import AutoTokenizer, AutoModelForQuestionAnswering
from nn_pruning.inference_model_patcher import optimize_model
from nn_pruning.modules.quantization import prepare_static, quantize # !
Traceback:
ModuleNotFoundError: No module named 'nn_pruning.modules.quantization'
An Issue has since been approved to amend this.

EasyOCR Module Not Found Error Despite Successful Install

I'm trying to run a python file that utilizes easyocr but despite a successful install, I can't get it to recognize that I have easyocr installed. Does anyone know why that is?
Please see below for the install and response in Anaconda:
(base) C:\Users\[username]\Desktop >pip install easyocr
Collecting easyocr
Using cached easyocr-1.4.1-py3-none-any.whl (63.6 MB)
Requirement already satisfied: Pillow<8.3.0 in c:\users\[username]\anaconda3\lib\site-packages (from easyocr) (8.2.0)
Requirement already satisfied: numpy in c:\users\[username]\anaconda3\lib\site-packages (from easyocr) (1.19.2)
Requirement already satisfied: scipy in c:\users\[username]\anaconda3\lib\site-packages (from easyocr) (1.6.2)
Requirement already satisfied: opencv-python-headless in c:\users\[username]\anaconda3\lib\site-packages (from easyocr) (4.5.1.48)
Requirement already satisfied: python-bidi in c:\users\[username]\anaconda3\lib\site-packages (from easyocr) (0.4.2)
Requirement already satisfied: torch in c:\users\[username]\anaconda3\lib\site-packages (from easyocr) (1.8.1)
Requirement already satisfied: torchvision>=0.5 in c:\users\[username]\anaconda3\lib\site-packages (from easyocr) (0.9.1)
Requirement already satisfied: scikit-image in c:\users\[username]\anaconda3\lib\site-packages (from easyocr) (0.18.1)
Requirement already satisfied: PyYAML in c:\users\[username]\anaconda3\lib\site-packages (from easyocr) (5.4.1)
Requirement already satisfied: typing-extensions in c:\users\[username]\anaconda3\lib\site-packages (from torch->easyocr) (3.7.4.3)
Requirement already satisfied: six in c:\users\[username]\anaconda3\lib\site-packages (from python-bidi->easyocr) (1.15.0)
Requirement already satisfied: matplotlib!=3.0.0,>=2.0.0 in c:\users\[username]\anaconda3\lib\site-packages (from scikit-image->easyocr) (3.4.1)
Requirement already satisfied: networkx>=2.0 in c:\users\[username]\anaconda3\lib\site-packages (from scikit-image->easyocr) (2.5.1)
Requirement already satisfied: imageio>=2.3.0 in c:\users\[username]\anaconda3\lib\site-packages (from scikit-image->easyocr) (2.9.0)
Requirement already satisfied: tifffile>=2019.7.26 in c:\users\[username]\anaconda3\lib\site-packages (from scikit-image->easyocr) (2021.4.8)
Requirement already satisfied: PyWavelets>=1.1.1 in c:\users\[username]\anaconda3\lib\site-packages (from scikit-image->easyocr) (1.1.1)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\[username]\anaconda3\lib\site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->easyocr) (1.3.1)
Requirement already satisfied: pyparsing>=2.2.1 in c:\users\[username]\anaconda3\lib\site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->easyocr) (2.4.7)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\[username]\anaconda3\lib\site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->easyocr) (2.8.1)
Requirement already satisfied: cycler>=0.10 in c:\users\[username]\anaconda3\lib\site-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->easyocr) (0.10.0)
Requirement already satisfied: decorator<5,>=4.3 in c:\users\[username]\anaconda3\lib\site-packages (from networkx>=2.0->scikit-image->easyocr) (4.4.2)
Installing collected packages: easyocr
Successfully installed easyocr-1.4.1
(base) C:\Users\[username]\Desktop\test.py
Traceback (most recent call last):
File "C:\Users\[username]\Desktop\test.py", line 9, in <module>
from ocr import OCR
File "C:\Users\[username]\Desktop\ ocr.py", line 3, in <module>
import easyocr
ModuleNotFoundError: No module named 'easyocr'

Issue of installing tensorflow 1.15 with python 3.7.7

I am trying to install tensorflow 1.15, and it's installed well. When I run again pip install tensorflow==1.15 it shows me the below screen:
C:\Users\Fatima>pip install tensorflow==1.15
Requirement already satisfied: tensorflow==1.15 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (1.15.0)
Requirement already satisfied: tensorflow-estimator==1.15.1 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.15.1)
Requirement already satisfied: keras-applications>=1.0.8 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.0.8)
Requirement already satisfied: grpcio>=1.8.6 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.37.1)
Requirement already satisfied: termcolor>=1.1.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.1.0)
Requirement already satisfied: six>=1.10.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.15.0)
Requirement already satisfied: keras-preprocessing>=1.0.5 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.1.2)
Requirement already satisfied: gast==0.2.2 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.2.2)
Requirement already satisfied: absl-py>=0.7.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.12.0)
Requirement already satisfied: opt-einsum>=2.3.2 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (3.3.0)
Requirement already satisfied: wrapt>=1.11.1 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.12.1)
Requirement already satisfied: numpy<2.0,>=1.16.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.20.2)
Requirement already satisfied: protobuf>=3.6.1 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (3.15.8)
Requirement already satisfied: astor>=0.6.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.8.1)
Requirement already satisfied: wheel>=0.26 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.36.2)
Requirement already satisfied: tensorboard<1.16.0,>=1.15.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.15.0)
Requirement already satisfied: google-pasta>=0.1.6 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.2.0)
Requirement already satisfied: h5py in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from keras-applications>=1.0.8->tensorflow==1.15) (3.2.1)
Requirement already satisfied: markdown>=2.6.8 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (3.3.4)
Requirement already satisfied: setuptools>=41.0.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (41.2.0)
Requirement already satisfied: werkzeug>=0.11.15 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (1.0.1)
Requirement already satisfied: importlib-metadata in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (4.0.1)
Requirement already satisfied: cached-property in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from h5py->keras-applications>=1.0.8->tensorflow==1.15) (1.5.2)
Requirement already satisfied: typing-extensions>=3.6.4 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (3.10.0.0)
Requirement already satisfied: zipp>=0.5 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (3.4.1)
That means that tensorflow is installed, right? The python I am using is V3.7.7
I use Pycharm to run the following code as test:
import tensorflow as tf
print(tf.__version__)
It gives me an error as follows:
Traceback (most recent call last):
File "C:/Python394/for_trials.py", line 1, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
It's like it couldn't identify the tensorflow, or the python is not compatible with Tf1. However, following the guide, that python 3.7 and older are compatible with Tf1.
Could you please help me in solving that issue to install Tf1 ?
thank you
The problem is that tensorflow is well installed in your machine but in which environment? for pycharm to see tensorflow, tensorflow must be installed in the same environment that pycharm uses to execute code. But if for example your pycharm is configured to execute codes in a virtual environment and tensorflow is installed in anaconda, there is has no way it works. So the simple solution that you can do is to change the environment of pycham to the environment where tensorflow is installed
tu change l’interpréteur comme ceci
tu change l’interpréteur comme ceci
tu change l’interpréteur comme ceci

Import Error: Cannot import name 'statfunc' (pymc3 module already installed)

When i try to import pymc3 module on my Jupyter notebook
using import pymc3 as pm i get the following error
```ImportError Traceback (most recent call last)
<ipython-input-5-2e5c536b7c65> in <module>
----> 1 import pymc3 as pm
~\Anaconda3_2\lib\site-packages\pymc3\__init__.py in <module>
19 from . import sampling
20
---> 21 from .diagnostics import *
22 from .backends.tracetab import *
23 from .backends import save_trace, load_trace
~\Anaconda3_2\lib\site-packages\pymc3\diagnostics.py in <module>
2
3 import numpy as np
----> 4 from .stats import statfunc, autocov
5 from .util import get_default_varnames
6 from .backends.base import MultiTrace
ImportError: cannot import name 'statfunc'```
I have pymc3 installed. See below. I am not sure what is needed to import statfunc. Can someone advise?
```base) C:\Users\gosal\Anaconda3_2\envs\py3>pip install pymc3
Requirement already satisfied: pymc3 in c:\users\gosal\anaconda3_2\lib\site-packages (3.9.2)
Requirement already satisfied: contextvars; python_version < "3.7" in c:\users\gosal\anaconda3_2\lib\site-packages (from pymc3) (2.4)
Requirement already satisfied: scipy>=0.18.1 in c:\users\gosal\appdata\roaming\python\python36\site-packages (from pymc3) (1.2.0)
Requirement already satisfied: h5py>=2.7.0 in c:\users\gosal\anaconda3_2\lib\site-packages (from pymc3) (2.8.0)
Requirement already satisfied: fastprogress>=0.2.0 in c:\users\gosal\anaconda3_2\lib\site-packages (from pymc3) (0.2.3)
Requirement already satisfied: arviz>=0.9.0 in c:\users\gosal\anaconda3_2\lib\site-packages (from pymc3) (0.9.0)
Requirement already satisfied: typing-extensions>=3.7.4 in c:\users\gosal\anaconda3_2\lib\site-packages (from pymc3) (3.7.4.2)
Requirement already satisfied: theano>=1.0.4 in c:\users\gosal\anaconda3_2\lib\site-packages (from pymc3) (1.0.4)
Requirement already satisfied: pandas>=0.18.0 in c:\users\gosal\anaconda3_2\lib\site-packages (from pymc3) (1.0.4)
Requirement already satisfied: patsy>=0.5.1 in c:\users\gosal\anaconda3_2\lib\site-packages (from pymc3) (0.5.1)
Requirement already satisfied: numpy>=1.13.0 in c:\users\gosal\anaconda3_2\lib\site-packages (from pymc3) (1.18.5)
Requirement already satisfied: immutables>=0.9 in c:\users\gosal\anaconda3_2\lib\site-packages (from contextvars; python_version < "3.7"->pymc3) (0.14)
Requirement already satisfied: six in c:\users\gosal\anaconda3_2\lib\site-packages (from h5py>=2.7.0->pymc3) (1.12.0)
Requirement already satisfied: packaging in c:\users\gosal\anaconda3_2\lib\site-packages (from arviz>=0.9.0->pymc3) (19.0)
Requirement already satisfied: netcdf4 in c:\users\gosal\anaconda3_2\lib\site-packages (from arviz>=0.9.0->pymc3) (1.5.4)
Requirement already satisfied: xarray>=0.11 in c:\users\gosal\anaconda3_2\lib\site-packages (from arviz>=0.9.0->pymc3) (0.16.0)
Requirement already satisfied: matplotlib>=3.0 in c:\users\gosal\anaconda3_2\lib\site-packages (from arviz>=0.9.0->pymc3) (3.2.1)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\gosal\anaconda3_2\lib\site-packages (from pandas>=0.18.0->pymc3) (2.7.5)
Requirement already satisfied: pytz>=2017.2 in c:\users\gosal\anaconda3_2\lib\site-packages (from pandas>=0.18.0->pymc3) (2019.3)
Requirement already satisfied: pyparsing>=2.0.2 in c:\users\gosal\anaconda3_2\lib\site-packages (from packaging->arviz>=0.9.0->pymc3) (2.3.1)
Requirement already satisfied: cftime in c:\users\gosal\anaconda3_2\lib\site-packages (from netcdf4->arviz>=0.9.0->pymc3) (1.2.1)
Requirement already satisfied: setuptools>=41.2 in c:\users\gosal\anaconda3_2\lib\site-packages (from xarray>=0.11->arviz>=0.9.0->pymc3) (49.2.0)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\gosal\anaconda3_2\lib\site-packages (from matplotlib>=3.0->arviz>=0.9.0->pymc3) (1.0.1)
Requirement already satisfied: cycler>=0.10 in c:\users\gosal\anaconda3_2\lib\site-packages (from matplotlib>=3.0->arviz>=0.9.0->pymc3) (0.10.0)```

Categories