ModuleNotFoundError: No module named 'Session' - python

When I run my python script file.py, I get an error ModuleNotFoundError: No module named 'Session'.
The imports on my script:
import os
import sys
import tensorflow as tf
import numpy as np
import random
import time
import requests
from requests import Request, Session
from flask_session import Session
from flask_session.__init__ import Session
import Session
from setup_inception import ImageNet, InceptionModel

You should not use from flask_session import Session
Instead use from flask_session.__init__ import Session

I'm sorry for the late answer, I have solved the problem with command:
import tensorflow.compat.v1 as tf
instead of
import tensorflow as tf
because I 'm using tensorflow 2.4

Related

ImportError: cannot import name 'combined_rule_sentence_segmenter'

I'm facing error while importing "import en_ner_bc5cdr_md"
import scispacy
import spacy
from spacy import displacy
from collections import Counter
import en_core_web_sm
import en_ner_bc5cdr_md
import en_core_sci_sm
import en_core_sci_md
import en_ner_bionlp13cg_md
from scispacy.abbreviation import AbbreviationDetector
from scispacy.umls_linking import UmlsEntityLinker
from collections import OrderedDict
from pprint import pprint
Please help
You need to download the model first, try
!pip install https://s3-us-west-2.amazonaws.com/ai2-s2-scispacy/releases/v0.5.1/en_ner_bc5cdr_md-0.5.1.tar.gz

airflows airflow.operators.python doesnt seem to work

i am trying to import the python operator for my airflow 2.2 in a jupyter notebook, but i get an error
this is what i import
import os
import datetime
import logging
import airflow
from airflow import DAG
from airflow.operators.python import PythonOperator
and this is the error "ModuleNotFoundError: No module named 'termios'"
you need to also import termios
import termios

ImportError: cannot import name 'MarianMTModel'

import numpy as np
import torch
import torchvision
from transformers import MarianTokenizer, MarianMTModel
from typing import List
I'm getting
ImportError: cannot import name 'MarianMTModel'
I've already installed transformers. What can I do to solve this issue?
Edit : Does this import Marian model implemented in C++?

No module named 'ray.rllib.agents.ppo.ppo_policy'

I have this code:
from copy import deepcopy
import json
import ray
try:
from ray.rllib.agents.agent import get_agent_class
except ImportError:
from ray.rllib.agents.registry import get_agent_class
from ray.rllib.agents.ppo.ppo_policy import PPOTFPolicy
from ray import tune
from ray.tune.registry import register_env
from ray.tune import run_experiments
I am getting the error:
No module named 'ray.rllib.agents.ppo.ppo_policy'
I tried:
pip install ray;
I re installed the system and reconfigured the environment to solve this problem

ModuleNotFoundError: No module named 'modeling'

I'm very new to deep learning and python and I'm trying to recreate the project at https://github.com/Nagakiran1/Extending-Google-BERT-as-Question-and-Answering-model-and-Chatbot
As I saw that in the project there is a file named Bert_QuestionAnswer.ipynb and with data.txt are the only difference I see from the original Bert repository, I just simply loaded it in my google drive and opened it as a notebook to see it in use.
When I run the first portion dough I get the ModuleNotFoundError: No module named 'modeling'errror.
What library is it part of?
For somoebody this was the problem :
It looks like it's trying to import from the github repo source rather
than the pip package.
If you are running this in a directory that contains the BERT github
repo, try running it elsewhere.
As always many thanks for the help.
This is the code of the file that throws me the error :
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from IPython.core.debugger import set_trace
import collections
import json
import math
import os
import random
import modeling
import optimization
import tokenization
import six
import os
import tensorflow as tf
import logging
logging.getLogger('tensorflow').disabled = True
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import warnings
warnings.filterwarnings("ignore")
import time
from pandas import Series
from nltk.tokenize import sent_tokenize
import gensim.downloader as api
from gensim.parsing.preprocessing import remove_stopwords
word_vectors = api.load("glove-wiki-gigaword-100") # load pre-trained word-vectors from gensim-data
You need to tell python where this module is:
import sys
sys.path.append("/path/to/your/bert/repo")
Because python will search in his system folders and in the current working directory. If you don't run it in the repo, python doesn't find this module.

Categories