WARNING: Readline services not available or not loaded.AttributeError: 'module' object has no attribute 'set_completer_delims' - ipython

REPL run ipython an error occurred.
WARNING: Readline services not available or not loaded.
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\Data\Packages/SublimeREPL/config/Python/ipy_repl.py", line 52, in <module>
embedded_shell.initialize()
File "<string>", line 2, in initialize
File "D:\Python27\lib\site-packages\IPython\config\application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "D:\Python27\lib\site-packages\IPython\terminal\ipapp.py", line 332, in initialize
self.init_shell()
File "D:\Python27\lib\site-packages\IPython\terminal\console\app.py", line 114, in init_shell
client=self.kernel_client,
File "D:\Python27\lib\site-packages\IPython\config\configurable.py", line 337, in instance
inst = cls(*args, **kwargs)
File "D:\Python27\lib\site-packages\IPython\core\interactiveshell.py", line 524, in __init__
self.init_completer()
File "D:\Python27\lib\site-packages\IPython\terminal\console\interactiveshell.py", line 129, in init_completer
self.Completer = ZMQCompleter(self, self.client, config=self.config)
File "D:\Python27\lib\site-packages\IPython\terminal\console\completer.py", line 37, in __init__
self.readline.set_completer_delims('\r\n')
AttributeError: 'module' object has no attribute 'set_completer_delims'

I experienced this problem whilst running ipython console in the WinPython distribution. In my case the problem was fixed by installing pyreadline:
pip install pyreadline
Hope this works for you too.

Related

Python Imports Keep Failing

I recently wrote a package which is on 1.2.9 but when trying to import it using pip install rolimons Python tries to import 1.2.9 which fails and moves on until version 1.1.3 which is the only version that doesn't error out.
Here is the error:
ERROR: Command errored out with exit status 1:
command: /home/runner/rolimonspy-test/venv/bin/python3 /home/runner/rolimonspy-test/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp89bhulpc
cwd: /tmp/pip-install-baj2a_r_/rolimons_41a3df9c7f414766a57996a21dc8cd26
Complete output (16 lines):
Traceback (most recent call last):
File "/home/runner/rolimonspy-test/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 280, in <module>
main()
File "/home/runner/rolimonspy-test/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/runner/rolimonspy-test/venv/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/tmp/pip-build-env-029qi198/overlay/lib/python3.8/site-packages/poetry/core/masonry/api.py", line 41, in prepare_metadata_for_build_wheel
builder = WheelBuilder(poetry)
File "/tmp/pip-build-env-029qi198/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 56, in __init__
super().__init__(poetry, executable=executable)
File "/tmp/pip-build-env-029qi198/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/builder.py", line 83, in __init__
self._module = Module(
File "/tmp/pip-build-env-029qi198/overlay/lib/python3.8/site-packages/poetry/core/masonry/utils/module.py", line 69, in __init__
raise ModuleOrPackageNotFound(
poetry.core.masonry.utils.module.ModuleOrPackageNotFound: No file/folder found for package python-template
More information about the structure and package here:

error executing flower with celery in Windows 10

I am developing an application in Django 3, in windows 10.
I have installed celery and RabitMQ and flower. Celery works well but when I run
celery -A proj flower
produces the following error
[I 200718 21:32:31 command:134] Visit me at http://localhost:5555
[I 200718 21:32:31 command:141] Broker: amqp://guest:**#localhost:5672//
[I 200718 21:32:31 command:142] Registered tasks:
['apps.tareas.task.send_emails_users',
'celery.accumulate',
'celery.backend_cleanup',
'celery.chain',
'celery.chord',
'celery.chord_unlock',
'celery.chunks',
'celery.group',
'celery.map',
'celery.starmap']
Traceback (most recent call last):
File "C:\Program Files\Python38\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\Python38\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\Sofia\OneDrive\Proyectos\Django 3\shop\env\Scripts\celery.exe\__main__.py", line 9, in <module>
File "c:\users\sofia\onedrive\proyectos\django 3\shop\env\lib\site-packages\celery\__main__.py", line 16, in main
_main()
File "c:\users\sofia\onedrive\proyectos\django 3\shop\env\lib\site-packages\celery\bin\celery.py", line 322, in main
cmd.execute_from_commandline(argv)
File "c:\users\sofia\onedrive\proyectos\django 3\shop\env\lib\site-packages\celery\bin\celery.py", line 495, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "c:\users\sofia\onedrive\proyectos\django 3\shop\env\lib\site-packages\celery\bin\base.py", line 305, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "c:\users\sofia\onedrive\proyectos\django 3\shop\env\lib\site-packages\celery\bin\celery.py", line 487, in handle_argv
return self.execute(command, argv)
File "c:\users\sofia\onedrive\proyectos\django 3\shop\env\lib\site-packages\celery\bin\celery.py", line 415, in execute
[I 200718 21:32:31 mixins:229] Connected to amqp://guest:**#127.0.0.1:5672//
return cls(
File "c:\users\sofia\onedrive\proyectos\django 3\shop\env\lib\site-packages\flower\command.py", line 51, in run_from_argv
flower.start()
File "c:\users\sofia\onedrive\proyectos\django 3\shop\env\lib\site-packages\flower\app.py", line 50, in start
self.listen(self.options.port, address=self.options.address,
File "c:\users\sofia\onedrive\proyectos\django 3\shop\env\lib\site-packages\tornado\web.py", line 2042, in listen
server.listen(port, address)
File "c:\users\sofia\onedrive\proyectos\django 3\shop\env\lib\site-packages\tornado\tcpserver.py", line 144, in listen
self.add_sockets(sockets)
File "c:\users\sofia\onedrive\proyectos\django 3\shop\env\lib\site-packages\tornado\tcpserver.py", line 157, in add_sockets
self._handlers[sock.fileno()] = add_accept_handler(
File "c:\users\sofia\onedrive\proyectos\django 3\shop\env\lib\site-packages\tornado\netutil.py", line 268, in add_accept_handler
io_loop.add_handler(sock, accept_handler, IOLoop.READ)
File "c:\users\sofia\onedrive\proyectos\django 3\shop\env\lib\site-packages\tornado\platform\asyncio.py", line 79, in add_handler
self.asyncio_loop.add_reader(
File "C:\Program Files\Python38\lib\asyncio\events.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
Can't be causing this error.
I have searched the documentation and found nothing like this error.
I have solved the problem by editing the file asyncio.py in tornado\platform adding:
import sys
if sys.platform == 'win32':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
I had the same error.
Which version of python do you use? mine was 3.8 then I changed to 3.6 and everything works correctly.

Python Keyerror 'sapi5', cant understand the error

One question of this type is previously asked but is not very helpful. I am using version Python3.8 in Windows 10 OS. I am getting an error, KeyError: 'sapi5'. dont know why this error is occurring. Please have a look at the below code given . My code is-
import pyttsx3
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voices', voices[0].id)
The Error is quite big. can anyone help me?
Traceback (most recent call last):
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\weakref.py", line 131, in __getitem__
o = self.data[key]()
KeyError: 'sapi5'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\drivers\sapi5.py", line 3, in <module>
from comtypes.gen import SpeechLib # comtypes
ImportError: cannot import name 'SpeechLib' from 'comtypes.gen' (C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\gen\__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\ctypes\__init__.py", line 123, in WINFUNCTYPE
return _win_functype_cache[(restype, argtypes, flags)]
KeyError: (<class 'ctypes.HRESULT'>, (<class 'ctypes.c_long'>, <class 'comtypes.automation.tagVARIANT'>, <class 'comtypes.automation.tagVARIANT'>, <class 'ctypes.c_long'>, <class 'ctypes.c_long'>), 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "g:/saurav/Assistant/VA/MyAssistant.py", line 9, in <module>
engine = pyttsx3.init('sapi5')
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\drivers\sapi5.py", line 6, in <module>
engine = comtypes.client.CreateObject("SAPI.SpVoice")
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\__init__.py", line 250, in CreateObject
return _manage(obj, clsid, interface=interface)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\__init__.py", line 110, in GetBestInterface
mod = GetModule(tlib)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\_generate.py", line 110, in GetModule
mod = _CreateWrapper(tlib, pathname)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\_generate.py", line 184, in _CreateWrapper
mod = _my_import(fullname)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\_generate.py", line 24, in _my_import
return __import__(fullname, globals(), locals(), ['DUMMY'])
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\gen\_C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.py", line 140, in <module>
ISpeechRecoGrammar._methods_ = [
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\__init__.py", line 329, in __setattr__
self._make_methods(value)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\__init__.py", line 698, in _make_methods
prototype = WINFUNCTYPE(restype, *argtypes)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\ctypes\__init__.py", line 125, in WINFUNCTYPE
class WinFunctionType(_CFuncPtr):
TypeError: item 2 in _argtypes_ passes a union by value, which is unsupported.
first uninstall pyttsx3 using following command
pip uninstall pyttsx3
Then install pyttsx3 version 2.6 using following command
pip install pyttsx3==2.6

ipython notebook freeze on start

my ipython notebook functionality stop working.
If I do
ipython notebook
the console just hangs forever with no debug output.
I have already tried reinstalling ipython but no success.
Also, if I start normal ipython everything seems fine.
Does anybody have a clue how to solve this? I suspect some lock file is still there but how can I find out what is exactly going wrong?
also if I force interrupt I get the following stack trace
^C^CTraceback (most recent call last):
File "/home/lfiaschi/anaconda/bin/ipython", line 9, in <module>
load_entry_point('ipython==1.2.1', 'console_scripts', 'ipython')()
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/__init__.py", line 118, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 544, in launch_instance
app.initialize(argv)
File "<string>", line 2, in initialize
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 89, in catch_config_error
return method(app, *args, **kwargs)
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 312, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<string>", line 2, in initialize
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 89, in catch_config_error
return method(app, *args, **kwargs)
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/core/application.py", line 373, in initialize
self.parse_command_line(argv)
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 307, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<string>", line 2, in parse_command_line
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 89, in catch_config_error
return method(app, *args, **kwargs)
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 474, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<string>", line 2, in initialize_subcommand
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 89, in catch_config_error
return method(app, *args, **kwargs)
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 405, in initialize_subcommand
subapp = import_item(subapp)
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/utils/importstring.py", line 42, in import_item
module = __import__(package, fromlist=[obj])
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/html/notebookapp.py", line 64, in <module>
from .services.kernels.kernelmanager import MappingKernelManager
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/html/services/kernels/kernelmanager.py", line 21, in <module>
from IPython.kernel.multikernelmanager import MultiKernelManager
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/kernel/__init__.py", line 6, in <module>
from .connect import *
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/kernel/connect.py", line 39, in <module>
from IPython.utils.localinterfaces import LOCALHOST
File "/home/lfiaschi/anaconda/lib/python2.7/site-packages/IPython/utils/localinterfaces.py", line 43, in <module>
PUBLIC_IPS = socket.gethostbyname_ex(socket.gethostname() + '.local')[2]
KeyboardInterrupt
I had the same problem in Linux/Ubuntu. This also hanged spyder.
Workaround for me:
(1) Look at host name of computer
cat /etc/hostname
which gives e.g. my-laptop
(2) Ensure that /etc/hosts contains the following entry
127.0.0.1 my-laptop my-laptop.local
because ipython looks for a 'local' extension too.
And fire up again ipython notebook or spyder. This worked for me for spyder, when it was hanging at:
PUBLIC_IPS = socket.gethostbyname_ex(socket.gethostname() + '.local')[2]

ipython: OperationalError: disk I/O error

I was running ipython successfully on fedora 18 until now: I'm getting the following exception when trying to launch it:
Traceback (most recent call last):
File "/usr/bin/ipython", line 9, in <module>
load_entry_point('ipython==1.1.0', 'console_scripts', 'ipython')()
File "/usr/lib/python2.7/site-packages/IPython/__init__.py", line 118, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/usr/lib/python2.7/site-packages/IPython/config/application.py", line 544, in launch_instance
app.initialize(argv)
File "<string>", line 2, in initialize
File "/usr/lib/python2.7/site-packages/IPython/config/application.py", line 89, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 323, in initialize
self.init_shell()
File "/usr/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 339, in init_shell
ipython_dir=self.ipython_dir, user_ns=self.user_ns)
File "/usr/lib/python2.7/site-packages/IPython/config/configurable.py", line 349, in instance
inst = cls(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 320, in __init__
**kwargs
File "/usr/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 456, in __init__
self.init_history()
File "/usr/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 1487, in init_history
self.history_manager = HistoryManager(shell=self, parent=self)
File "/usr/lib/python2.7/site-packages/IPython/core/history.py", line 481, in __init__
self.new_session()
File "<string>", line 2, in new_session
File "/usr/lib/python2.7/site-packages/IPython/core/history.py", line 65, in needs_sqlite
return f(self, *a, **kw)
File "/usr/lib/python2.7/site-packages/IPython/core/history.py", line 500, in new_session
self.session_number = cur.lastrowid
OperationalError: disk I/O error
If you suspect this is an IPython bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev#scipy.org
You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.
Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
c.Application.verbose_crash=True
I tried to upgrade ipython to the latest version using pip, which did not help. Any solution or workaround is very much welcomed.
IPython store history in a profile generally in ~/.ipython/profile_default/history.sqlite. There seem to be a disk error reading/writting to it.
Check the permissions of the file/folders, if necessary delete the file.
I solved it by set c.NotebookNotary.db_file = u':memory:' in jupyter configure file ~/.jupyter/jupyter_notebook_config.py