how to import mininet.topo at python? - import

trying to import mininet package and getting an error
'from mininet.topo import Topo'
that's the error that i get when trying to do :
C:\Users\liran\AppData\Local\Programs\Python\Python38\python.exe
C:/liran/Program/SMTR3/Code_try/TopologyFiles/Printer.py
Traceback (most recent call last):
File "C:/liran/Program/SMTR3/Code_try/TopologyFiles/Printer.py", line 85, in <module>
from mininet.topo import Topo
File "C:\Users\liran\AppData\Local\Programs\Python\Python38\lib\site-packages\mininet\topo.py", line 14, in <module>
from mininet.util import irange, natural, naturalSeq
File "C:\Users\liran\AppData\Local\Programs\Python\Python38\lib\site-packages\mininet\util.py", line 7, in <module>
from resource import getrlimit, setrlimit, RLIMIT_NPROC, RLIMIT_NOFILE
ModuleNotFoundError: No module named 'resource'

Related

Receiving an error when trying to run chatterbot on pi

I am new to working with Chatterbot. I am attempting to run chatterbot on my raspberry pi 4. After installing it, I attempted a basic program from chatterbot's documentation website:
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
chatbot = ChatBot('Bob')
######### Create a new trainer for the chatbot
trainer = ChatterBotCorpusTrainer(chatbot)
######### Train the chatbot based on the english corpus
trainer.train("chatterbot.corpus.english")
# Get a response to an input statement
responce = chatbot.get_response("Hello, how are you today?")
print(responce)
When I run this program I get this error message:
Traceback (most recent call last):
File "/home/pi/Matthew.codes/JenkinsProject/chatbot_test.py", line 4, in
chatbot = ChatBot('Bob')
File "/home/pi/.local/lib/python3.7/site-packages/chatterbot/chatterbot.py", line 28, in init
self.storage = utils.initialize_class(storage_adapter, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/chatterbot/utils.py", line 33, in initialize_class
return Class(*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/chatterbot/storage/sql_storage.py", line 20, in init
super().init(**kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/chatterbot/storage/storage_adapter.py", line 23, in init
'tagger_language', languages.ENG
File "/home/pi/.local/lib/python3.7/site-packages/chatterbot/tagging.py", line 20, in init
import spacy
File "/home/pi/.local/lib/python3.7/site-packages/spacy/init.py", line 6, in
from .errors import setup_default_warnings
File "/home/pi/.local/lib/python3.7/site-packages/spacy/errors.py", line 2, in
from .compat import Literal
File "/home/pi/.local/lib/python3.7/site-packages/spacy/compat.py", line 38, in
from thinc.api import Optimizer # noqa: F401
File "/home/pi/.local/lib/python3.7/site-packages/thinc/api.py", line 2, in
from .initializers import normal_init, uniform_init, glorot_uniform_init, zero_init
File "/home/pi/.local/lib/python3.7/site-packages/thinc/initializers.py", line 4, in
from .backends import Ops
File "/home/pi/.local/lib/python3.7/site-packages/thinc/backends/init.py", line 7, in
from .ops import Ops
File "/home/pi/.local/lib/python3.7/site-packages/thinc/backends/ops.py", line 15, in
from .cblas import CBlas
File "thinc/backends/cblas.pyx", line 1, in init thinc.backends.cblas
File "/home/pi/.local/lib/python3.7/site-packages/blis/init.py", line 3, in
from .cy import init
ImportError: /home/pi/.local/lib/python3.7/site-packages/blis/cy.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_load_8
I have tried adding storage adapters to the name class, but that did not work. As far as I can tell, I have installed all the dependencies.

Can't run pgadmin4: ImportError: cannot import name 'Markup' from 'jinja2

Linux Mint 20.3
I try to run pgadmin4 like this:
./pgadmin4env/bin/pgadmin4&
But get error:
[1] 3994127
(pgadmin4env) alexeij#workstation:~/pgadmin4/pgadmin4_dir$ Traceback (most recent call last):
File "./pgadmin4env/bin/pgadmin4", line 5, in <module>
from pgadmin4.pgAdmin4 import main
File "/home/alexeij/pgadmin4/pgadmin4_dir/pgadmin4env/lib/python3.8/site-packages/pgadmin4/pgAdmin4.py", line 35, in <module>
import config
File "/home/alexeij/pgadmin4/pgadmin4_dir/pgadmin4env/lib/python3.8/site-packages/pgadmin4/config.py", line 25, in <module>
from pgadmin.utils import env, IS_WIN, fs_short_path
File "/home/alexeij/pgadmin4/pgadmin4_dir/pgadmin4env/lib/python3.8/site-packages/pgadmin4/pgadmin/__init__.py", line 21, in <module>
from flask import Flask, abort, request, current_app, session, url_for
File "/home/alexeij/pgadmin4/pgadmin4_dir/pgadmin4env/lib/python3.8/site-packages/flask/__init__.py", line 19, in <module>
from jinja2 import Markup, escape
ImportError: cannot import name 'Markup' from 'jinja2' (/home/alexeij/pgadmin4/pgadmin4_dir/pgadmin4env/lib/python3.8/site-packages/jinja2/__init__.py)

Error 'str' object has no attribute 'is_stale'

After calling this method it shows me this error 'str' object has no attribute 'is_stale': response = client.get_products(37.77, -122.41)
this is source code:
import sys from uber_rides.session
import Session from uber_rides.client
import UberRidesClient
session = Session(oauth2credential='[redacted]')
client = UberRidesClient(session)
response = client.get_products(37.77, -122.41)
Traceback:
Traceback (most recent call last):
File "/Users/mhv/Projects/Other/Python/Uber/main.py", line 12, in <module>
response = client.get_products(37.77, -122.41)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uber_rides/client.py", line 128, in get_products
return self._api_call('GET', 'v1.2/products', args=args)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uber_rides/client.py", line 96, in _api_call
self.refresh_oauth_credential()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uber_rides/client.py", line 720, in refresh_oauth_credential
if credential.is_stale():
AttributeError: 'str' object has no attribute 'is_stale'
Best regards

ImportError: cannot import name 'client_pb2' from 'google.api'

import io
import os
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]="ip-boundary-996e9662df4c.json"
from google.cloud import speech
I am trying to load the library required to use Google STT, but an error occurs. Here's what the error says:
Traceback (most recent call last):
File "/home/yugwon/IP_boundary/server/stt.py", line 5, in <module>
from google.cloud import speech
File "/home/yugwon/IP_boundary/venv/lib/python3.7/site-packages/google/cloud/speech/__init__.py", line 17, in <module>
from google.cloud.speech_v1 import SpeechClient
File "/home/yugwon/IP_boundary/venv/lib/python3.7/site-packages/google/cloud/speech_v1/__init__.py", line 17, in <module>
from .services.speech import SpeechClient
File "/home/yugwon/IP_boundary/venv/lib/python3.7/site-packages/google/cloud/speech_v1/services/speech/__init__.py", line 16, in <module>
from .client import SpeechClient
File "/home/yugwon/IP_boundary/venv/lib/python3.7/site-packages/google/cloud/speech_v1/services/speech/client.py", line 43, in <module>
from google.api_core import operation # type: ignore
File "/home/yugwon/IP_boundary/venv/lib/python3.7/site-packages/google/api_core/operation.py", line 45, in <module>
from google.longrunning import operations_pb2
File "/home/yugwon/IP_boundary/venv/lib/python3.7/site-packages/google/longrunning/operations_pb2.py", line 26, in <module>
from google.longrunning.operations_proto_pb2 import *
File "/home/yugwon/IP_boundary/venv/lib/python3.7/site-packages/google/longrunning/operations_proto_pb2.py", line 31, in <module>
from google.api import client_pb2 as google_dot_api_dot_client__pb2
ImportError: cannot import name 'client_pb2' from 'google.api' (/home/yugwon/IP_boundary/python-generated/google/api/__init__.py)
As a workaround for this, I tried the following, but still the same problem appeared and failed.
pip install --upgrade googleapis-common-protos
Below is my venv pip list.
Do you have any other solution?

Docker-compose: AttributeError: 'module' object has no attribute 'ssl'

Today I have tried use docker-compose and got next error:
>>docker-compose
Traceback (most recent call last):
File "/usr/bin/docker-compose", line 9, in <module>
load_entry_point('docker-compose==1.7.1', 'console_scripts', 'docker-compose')()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2361, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 14, in <module>
from . import errors
File "/usr/lib/python2.7/site-packages/compose/cli/errors.py", line 9, in <module>
from docker.errors import APIError
File "/usr/lib/python2.7/site-packages/docker/__init__.py", line 20, in <module>
from .client import Client, AutoVersionClient, from_env # flake8: noqa
File "/usr/lib/python2.7/site-packages/docker/client.py", line 22, in <module>
import websocket
File "/usr/lib/python2.7/site-packages/websocket/__init__.py", line 22, in <module>
from ._core import *
File "/usr/lib/python2.7/site-packages/websocket/_core.py", line 39, in <module>
from ._socket import *
File "/usr/lib/python2.7/site-packages/websocket/_socket.py", line 28, in <module>
from ._ssl_compat import *
AttributeError: 'module' object has no attribute 'ssl'
OS: OpenSuse Leap 42.1
Docker-compose: 1.7.1
Docker: 1.11.2
libopenssl-devel installed
Downgrade OpennSSL to version 1.0.1i-15.1 from 1.0.1i-2.36.1 has fixed my problem.