I can't seem to be able install PANDAS on CMD - python

First I got this message:
Defaulting to user installation because normal site-packages is not writeable.**
Then I got this error:
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\urllib3\response.py", line 438, in _error_catcher
yield
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\urllib3\response.py", line 519, in read
data = self._fp.read(amt) if not fp_closed else b""
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
data = self.__fp.read(amt)
File "c:\program files (x86)\python38-32\lib\http\client.py", line 454, in read
n = self.readinto(b)
File "c:\program files (x86)\python38-32\lib\http\client.py", line 498, in readinto
n = self.fp.readinto(b)
File "c:\program files (x86)\python38-32\lib\socket.py", line 669, in readinto
return self._sock.recv_into(b)
File "c:\program files (x86)\python38-32\lib\ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "c:\program files (x86)\python38-32\lib\ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\cli\base_command.py", line 173, in _main
status = self.run(options, args)
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\cli\req_command.py", line 203, in wrapper
return func(self, options, args)
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\commands\install.py", line 315, in run
requirement_set = resolver.resolve(
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 94, in resolve
result = self._result = resolver.resolve(
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\resolvelib\resolvers.py", line 472, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\resolvelib\resolvers.py", line 341, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\resolvelib\resolvers.py", line 172, in _add_to_criteria
if not criterion.candidates:
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\resolvelib\structs.py", line 151, in __bool__
return bool(self._sequence)
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 140, in __bool__
return any(self)
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 128, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 32, in _iter_built
candidate = func()
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 204, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 295, in __init__
super().__init__(
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 156, in __init__
self.dist = self._prepare()
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 227, in _prepare
dist = self._prepare_distribution()
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 305, in _prepare_distribution
return self._factory.preparer.prepare_linked_requirement(
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\operations\prepare.py", line 508, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\operations\prepare.py", line 550, in _prepare_linked_requirement
local_file = unpack_url(
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\operations\prepare.py", line 239, in unpack_url
file = get_http_url(
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\operations\prepare.py", line 102, in get_http_url
from_path, content_type = download(link, temp_dir.path)
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\network\download.py", line 145, in __call__
for chunk in chunks:
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\cli\progress_bars.py", line 144, in iter
for x in it:
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_internal\network\utils.py", line 63, in response_chunks
for chunk in response.raw.stream(
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\urllib3\response.py", line 576, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\urllib3\response.py", line 541, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "c:\program files (x86)\python38-32\lib\contextlib.py", line 131, in __exit__
self.gen.throw(type, value, traceback)
File "C:\Users\Marshal\AppData\Roaming\Python\Python38\site-packages\pip\_vendor\urllib3\response.py", line 443, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

Related

'DatabaseError' is not being caught by mysql.connector.errors.DatabaseError python

I am using SQLAlchemy and mysql-connector. While executing a query, if I get mysql.connector.errors.DatabaseError I have used the exception provided by mysql.
The exception is going in the Exception block and not in the DatabaseError catch block.
Code
try:
row_exists = None
session_object = self.connect_to_database()
# check if the value exists or not
try:
if session_object.query(
exists().where(
ConnectorRequest.CR_Context_Key == input_context['Context_Key'])).scalar():
row_exists = True
else:
row_exists = False
except DatabaseError as mysql_error:
logger.error('Error connecting to the MYSQL Server.Invalid database IP or Port provided' +
f'\nError-{str(mysql_error)}', exc_info=True)
# close the session_object
session_object.close()
return row_exists
except Exception as error:
logger.error('Error in exists query of the database' +
f'\nException - {str(error)}', exc_info=True)
Error caught in Exception
(mysql.connector.errors.DatabaseError) 2003 (HY000): Can't connect to MySQL server on '10.10.1.00:3306' (101)
(Background on this error at: https://sqlalche.me/e/14/4xp6)
Stacktrace
{"asctime": "2023-02-01 13:53:45,195", "levelname": "ERROR", "module": "Helper", "funcName": "check_if_file_is_already_processed", "process": 22216,
"message": "Error in exists query of the database\nException - (mysql.connector.errors.DatabaseError) 2003 (HY000): Can't connect to MySQL server on '10.10.1.00:3306' (101)\n(Background on this error at: https://sqlalche.me/e/14/4xp6)",
"exc_info": "Traceback (most recent call last):\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/mysql/connector/connection_cext.py\", line 232, in _open_connection\n self._cmysql.connect(**cnx_kwargs)\n_mysql_connector.MySQLInterfaceError: Can't connect to MySQL server on '10.10.1.00:3306' (101)\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py\", line 3361, in _wrap_pool_connect\n return fn()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 327, in connect\n return _ConnectionFairy._checkout(self)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 894, in _checkout\n fairy = _ConnectionRecord.checkout(pool)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 493, in checkout\n rec = pool._do_get()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py\", line 146, in _do_get\n self._dec_overflow()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py\", line 72, in __exit__\n with_traceback=exc_tb,\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py\", line 211, in raise_\n raise exception\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py\", line 143, in _do_get\n return self._create_connection()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 273, in _create_connection\n return _ConnectionRecord(self)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 388, in __init__\n self.__connect()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 691, in __connect\n pool.logger.debug(\"Error on connect(): %s\", e)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py\", line 72, in __exit__\n with_traceback=exc_tb,\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py\", line 211, in raise_\n raise exception\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 686, in __connect\n self.dbapi_connection = connection = pool._invoke_creator(self)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/engine/create.py\", line 578, in connect\n return dialect.connect(*cargs, **cparams)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py\", line 598, in connect\n return self.dbapi.connect(*cargs, **cparams)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/mysql/connector/__init__.py\", line 272, in connect\n return CMySQLConnection(*args, **kwargs)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/mysql/connector/connection_cext.py\", line 85, in __init__\n self.connect(**kwargs)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/mysql/connector/abstracts.py\", line 1003, in connect\n self._open_connection()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/mysql/connector/connection_cext.py\", line 235, in _open_connection\n sqlstate=exc.sqlstate)\nmysql.connector.errors.DatabaseError: 2003 (HY000): Can't connect to MySQL server on '10.10.1.00:3306' (101)\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/home/usr/Workarea-2/usr/pycharm_project/toyota_finance_service/python_module/folder_listener_connector/folder_listener_connector/Helper.py\", line 155, in check_if_file_is_already_processed\n ConnectorRequest.CR_Context_Key == input_context['Connector_Context_Key'])).scalar():\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/orm/query.py\", line 2893, in scalar\n ret = self.one()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/orm/query.py\", line 2870, in one\n return self._iter().one()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/orm/query.py\", line 2919, in _iter\n execution_options={\"_sa_orm_load_options\": self.load_options},\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/orm/session.py\", line 1713, in execute\n conn = self._connection_for_bind(bind)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/orm/session.py\", line 1553, in _connection_for_bind\n engine, execution_options\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/orm/session.py\", line 747, in _connection_for_bind\n conn = bind.connect()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py\", line 3315, in connect\n return self._connection_cls(self, close_with_result=close_with_result)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py\", line 96, in __init__\n else engine.raw_connection()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py\", line 3394, in raw_connection\n return self._wrap_pool_connect(self.pool.connect, _connection)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py\", line 3365, in _wrap_pool_connect\n e, dialect, self\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py\", line 2199, in _handle_dbapi_exception_noconnection\n sqlalchemy_exception, with_traceback=exc_info[2], from_=e\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py\", line 211, in raise_\n raise exception\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/engine/base.py\", line 3361, in _wrap_pool_connect\n return fn()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 327, in connect\n return _ConnectionFairy._checkout(self)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 894, in _checkout\n fairy = _ConnectionRecord.checkout(pool)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 493, in checkout\n rec = pool._do_get()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py\", line 146, in _do_get\n self._dec_overflow()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py\", line 72, in __exit__\n with_traceback=exc_tb,\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py\", line 211, in raise_\n raise exception\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/impl.py\", line 143, in _do_get\n return self._create_connection()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 273, in _create_connection\n return _ConnectionRecord(self)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 388, in __init__\n self.__connect()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 691, in __connect\n pool.logger.debug(\"Error on connect(): %s\", e)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py\", line 72, in __exit__\n with_traceback=exc_tb,\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/util/compat.py\", line 211, in raise_\n raise exception\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/pool/base.py\", line 686, in __connect\n self.dbapi_connection = connection = pool._invoke_creator(self)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/engine/create.py\", line 578, in connect\n return dialect.connect(*cargs, **cparams)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/sqlalchemy/engine/default.py\", line 598, in connect\n return self.dbapi.connect(*cargs, **cparams)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/mysql/connector/__init__.py\", line 272, in connect\n return CMySQLConnection(*args, **kwargs)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/mysql/connector/connection_cext.py\", line 85, in __init__\n self.connect(**kwargs)\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/mysql/connector/abstracts.py\", line 1003, in connect\n self._open_connection()\n File \"/home/usr/Workarea-2/usr/python_proj_env/folder_listener_connector_venv/lib/python3.6/site-packages/mysql/connector/connection_cext.py\", line 235, in _open_connection\n sqlstate=exc.sqlstate)\nsqlalchemy.exc.DatabaseError: (mysql.connector.errors.DatabaseError) 2003 (HY000): Can't connect to MySQL server on '10.10.1.00:3306' (101)\n(Background on this error at: https://sqlalche.me/e/14/4xp6)"}
The exception is sqlalchemy.exc.DatabaseError; SQLAlchemy wraps the error from the DB-API connector (here MySQL-Connector) but displays the details from it.
So you need to do
from sqlalchemy.exc import DatabaseError
...
try:
# something
except DatabaseError:
# handle exception

Kernel ERROR using Jupyter-matlab notebook. Seems like the kernel initialization cant find one file, how can I fix it?

I want to use Jupyter-matlab notebooks. I've downloaded Anaconda navigator and followed the steps from this web: http://jmlilly.net/jupyter-matlab
Unfortunately, when I try to open a matlab notebook:
Seems like I've installed properly
It happends:
Kernel Error...
Error text (It's very unclear):
Traceback (most recent call last):
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\tornado\web.py", line 1704, in _execute
result = await result
File "C:\Users\lucas\anaconda3\envs\jlab\lib\asyncio\tasks.py", line 328, in __wakeup
future.result()
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\notebook\services\sessions\handlers.py", line 74, in post
model = yield maybe_future(
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 98, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 110, in start_kernel_for_session
kernel_id = yield maybe_future(
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\lucas\anaconda3\envs\jlab\lib\asyncio\futures.py", line 201, in result
raise self._exception
File "C:\Users\lucas\anaconda3\envs\jlab\lib\asyncio\tasks.py", line 256, in __step
result = coro.send(None)
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 176, in start_kernel
kernel_id = await maybe_future(self.pinned_superclass.start_kernel(self, **kwargs))
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\utils.py", line 26, in wrapped
raise e
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\utils.py", line 23, in wrapped
return loop.run_until_complete(future)
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\nest_asyncio.py", line 89, in run_until_complete
return f.result()
File "C:\Users\lucas\anaconda3\envs\jlab\lib\asyncio\futures.py", line 201, in result
raise self._exception
File "C:\Users\lucas\anaconda3\envs\jlab\lib\asyncio\tasks.py", line 256, in __step
result = coro.send(None)
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\multikernelmanager.py", line 207, in _async_start_kernel
starter = ensure_async(km.start_kernel(**kwargs))
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\utils.py", line 26, in wrapped
raise e
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\utils.py", line 23, in wrapped
return loop.run_until_complete(future)
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\nest_asyncio.py", line 89, in run_until_complete
return f.result()
File "C:\Users\lucas\anaconda3\envs\jlab\lib\asyncio\futures.py", line 201, in result
raise self._exception
File "C:\Users\lucas\anaconda3\envs\jlab\lib\asyncio\tasks.py", line 256, in __step
result = coro.send(None)
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\manager.py", line 79, in wrapper
raise e
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\manager.py", line 71, in wrapper
out = await method(self, *args, **kwargs)
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\manager.py", line 381, in _async_start_kernel
await ensure_async(self._launch_kernel(kernel_cmd, **kw))
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\utils.py", line 26, in wrapped
raise e
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\utils.py", line 23, in wrapped
return loop.run_until_complete(future)
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\nest_asyncio.py", line 89, in run_until_complete
return f.result()
File "C:\Users\lucas\anaconda3\envs\jlab\lib\asyncio\futures.py", line 201, in result
raise self._exception
File "C:\Users\lucas\anaconda3\envs\jlab\lib\asyncio\tasks.py", line 256, in __step
result = coro.send(None)
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\manager.py", line 301, in _async_launch_kernel
connection_info = await self.provisioner.launch_kernel(kernel_cmd, **kw)
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\provisioning\local_provisioner.py", line 204, in launch_kernel
self.process = launch_kernel(cmd, **scrubbed_kwargs)
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\launcher.py", line 169, in launch_kernel
raise ex
File "C:\Users\lucas\anaconda3\envs\jlab\lib\site-packages\jupyter_client\launcher.py", line 157, in launch_kernel
proc = Popen(cmd, **kwargs)
File "C:\Users\lucas\anaconda3\envs\jlab\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\lucas\anaconda3\envs\jlab\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
I've been trying re-install anaconda, jupyter, matlab-kernel, change environment python version (3.7, 3.8, 3.9) etc. but it doesn't work.
Matlab version: R2021b

spacy.load error: RuntimeError: dictionary changed size during iteration

I am loading a spaCy model as part of a step in my Dataflow streaming pipeline. To load the pre-downloaded spaCy model for a specific language I am using
nlp_model = spacy.load(SPACY_KEYS[lang])
where SPACY_KEYS is a dictionary containing the names of the models for each language (e.g. 'en': 'en_core_web_sm').
This works without any issues for the majority of the jobs run by the pipeline, but for a few iterations I am getting the following error:
Error message from worker: generic::unknown: Traceback (most recent call last):
File "apache_beam/runners/common.py", line 1232, in apache_beam.runners.common.DoFnRunner.process
File "apache_beam/runners/common.py", line 752, in apache_beam.runners.common.PerWindowInvoker.invoke_process
File "apache_beam/runners/common.py", line 870, in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window
File "apache_beam/runners/common.py", line 1368, in apache_beam.runners.common._OutputProcessor.process_outputs
File "/usr/local/lib/python3.7/site-packages/submodules/entities_and_pii_removal.py", line 259, in entities_and_PII
nlp_model = spacy.load(SPACY_KEYS[lang]) # load spacy model
File "/usr/local/lib/python3.7/site-packages/spacy/__init__.py", line 52, in load
name, vocab=vocab, disable=disable, exclude=exclude, config=config
File "/usr/local/lib/python3.7/site-packages/spacy/util.py", line 420, in load_model
return load_model_from_package(name, **kwargs) # type: ignore[arg-type]
File "/usr/local/lib/python3.7/site-packages/spacy/util.py", line 453, in load_model_from_package
return cls.load(vocab=vocab, disable=disable, exclude=exclude, config=config) # type: ignore[attr-defined]
File "/usr/local/lib/python3.7/site-packages/de_core_news_sm/__init__.py", line 10, in load
return load_model_from_init_py(__file__, **overrides)
File "/usr/local/lib/python3.7/site-packages/spacy/util.py", line 621, in load_model_from_init_py
config=config,
File "/usr/local/lib/python3.7/site-packages/spacy/util.py", line 489, in load_model_from_path
return nlp.from_disk(model_path, exclude=exclude, overrides=overrides)
File "/usr/local/lib/python3.7/site-packages/spacy/language.py", line 2042, in from_disk
util.from_disk(path, deserializers, exclude) # type: ignore[arg-type]
File "/usr/local/lib/python3.7/site-packages/spacy/util.py", line 1299, in from_disk
reader(path / key)
File "/usr/local/lib/python3.7/site-packages/spacy/language.py", line 2037, in <lambda>
p, exclude=["vocab"]
File "spacy/pipeline/trainable_pipe.pyx", line 343, in spacy.pipeline.trainable_pipe.TrainablePipe.from_disk
File "/usr/local/lib/python3.7/site-packages/spacy/util.py", line 1299, in from_disk
reader(path / key)
File "spacy/pipeline/trainable_pipe.pyx", line 333, in spacy.pipeline.trainable_pipe.TrainablePipe.from_disk.load_model
File "spacy/pipeline/trainable_pipe.pyx", line 334, in spacy.pipeline.trainable_pipe.TrainablePipe.from_disk.load_model
File "/usr/local/lib/python3.7/site-packages/thinc/model.py", line 593, in from_bytes
return self.from_dict(msg)
File "/usr/local/lib/python3.7/site-packages/thinc/model.py", line 624, in from_dict
loaded_value = deserialize_attr(default_value, value, attr, node)
File "/usr/local/lib/python3.7/functools.py", line 840, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/usr/local/lib/python3.7/site-packages/thinc/model.py", line 804, in deserialize_attr
return srsly.msgpack_loads(value)
File "/usr/local/lib/python3.7/site-packages/srsly/_msgpack_api.py", line 27, in msgpack_loads
msg = msgpack.loads(data, raw=False, use_list=use_list)
File "/usr/local/lib/python3.7/site-packages/srsly/msgpack/__init__.py", line 76, in unpackb
for decoder in msgpack_decoders.get_all().values():
File "/usr/local/lib/python3.7/site-packages/catalogue/__init__.py", line 110, in get_all
for keys, value in REGISTRY.items():
RuntimeError: dictionary changed size during iteration
I have not been able to identify the cause of this problem. Is there a way of getting around it?

Why does python's numba run 2D array program on Spyder but not on remote server?

I created a small program that uses numba on a method containing a 2D array (list of lists). This program runs just fine on Spyder, but when I try to run the exact same program on a remote Ubuntu server, I get a long error saying "unsupported nested memory-managed object" (listed below the program code).
The code:
from numba import jit
#jit(nopython=True)
def test():
num1 = 10
num2 = 5
array = [ [ 1 for i in range(num1) ] for j in range(num2) ]
#array = [2 for i in range(num1) ]
sum = 0
for i in range(0,num1):
for j in range(0,num2):
sum = sum + array[i][j]
print(sum)
test()
The error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/numba/runtime/context.py", line 186, in _call_incref_decref
meminfo = data_model.get_nrt_meminfo(builder, value)
File "/usr/lib/python3/dist-packages/numba/datamodel/models.py", line 329, in get_nrt_meminfo
"unsupported nested memory-managed object")
NotImplementedError: unsupported nested memory-managed object
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/numba/errors.py", line 243, in new_error_context
yield
File "/usr/lib/python3/dist-packages/numba/lowering.py", line 216, in lower_block
self.lower_inst(inst)
File "/usr/lib/python3/dist-packages/numba/lowering.py", line 263, in lower_inst
self.storevar(val, inst.target.name)
File "/usr/lib/python3/dist-packages/numba/lowering.py", line 928, in storevar
self.decref(fetype, old)
File "/usr/lib/python3/dist-packages/numba/lowering.py", line 982, in decref
self.context.nrt.decref(self.builder, typ, val)
File "/usr/lib/python3/dist-packages/numba/runtime/context.py", line 208, in decref
self._call_incref_decref(builder, typ, typ, value, "NRT_decref")
File "/usr/lib/python3/dist-packages/numba/runtime/context.py", line 179, in _call_incref_decref
funcname, getters + (getter,))
File "/usr/lib/python3/dist-packages/numba/runtime/context.py", line 188, in _call_incref_decref
raise NotImplementedError("%s: %s" % (root_type, str(e)))
NotImplementedError: list(list(int64)): unsupported nested memory-managed object
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "2DArrayTest.py", line 15, in <module>
test()
File "/usr/lib/python3/dist-packages/numba/dispatcher.py", line 307, in _compile_for_args
return self.compile(tuple(argtypes))
File "/usr/lib/python3/dist-packages/numba/dispatcher.py", line 579, in compile
cres = self._compiler.compile(args, return_type)
File "/usr/lib/python3/dist-packages/numba/dispatcher.py", line 80, in compile
flags=flags, locals=self.locals)
File "/usr/lib/python3/dist-packages/numba/compiler.py", line 740, in compile_extra
return pipeline.compile_extra(func)
File "/usr/lib/python3/dist-packages/numba/compiler.py", line 360, in compile_extra
return self._compile_bytecode()
File "/usr/lib/python3/dist-packages/numba/compiler.py", line 699, in _compile_bytecode
return self._compile_core()
File "/usr/lib/python3/dist-packages/numba/compiler.py", line 686, in _compile_core
res = pm.run(self.status)
File "/usr/lib/python3/dist-packages/numba/compiler.py", line 246, in run
raise patched_exception
File "/usr/lib/python3/dist-packages/numba/compiler.py", line 238, in run
stage()
File "/usr/lib/python3/dist-packages/numba/compiler.py", line 621, in stage_nopython_backend
self._backend(lowerfn, objectmode=False)
File "/usr/lib/python3/dist-packages/numba/compiler.py", line 576, in _backend
lowered = lowerfn()
File "/usr/lib/python3/dist-packages/numba/compiler.py", line 563, in backend_nopython_mode
self.flags)
File "/usr/lib/python3/dist-packages/numba/compiler.py", line 858, in native_lowering_stage
lower.lower()
File "/usr/lib/python3/dist-packages/numba/lowering.py", line 135, in lower
self.lower_normal_function(self.fndesc)
File "/usr/lib/python3/dist-packages/numba/lowering.py", line 176, in lower_normal_function
entry_block_tail = self.lower_function_body()
File "/usr/lib/python3/dist-packages/numba/lowering.py", line 201, in lower_function_body
self.lower_block(block)
File "/usr/lib/python3/dist-packages/numba/lowering.py", line 216, in lower_block
self.lower_inst(inst)
File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python3/dist-packages/numba/errors.py", line 249, in new_error_context
six.reraise(type(newerr), newerr, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/numba/six.py", line 658, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3/dist-packages/numba/errors.py", line 243, in new_error_context
yield
File "/usr/lib/python3/dist-packages/numba/lowering.py", line 216, in lower_block
self.lower_inst(inst)
File "/usr/lib/python3/dist-packages/numba/lowering.py", line 263, in lower_inst
self.storevar(val, inst.target.name)
File "/usr/lib/python3/dist-packages/numba/lowering.py", line 928, in storevar
self.decref(fetype, old)
File "/usr/lib/python3/dist-packages/numba/lowering.py", line 982, in decref
self.context.nrt.decref(self.builder, typ, val)
File "/usr/lib/python3/dist-packages/numba/runtime/context.py", line 208, in decref
self._call_incref_decref(builder, typ, typ, value, "NRT_decref")
File "/usr/lib/python3/dist-packages/numba/runtime/context.py", line 179, in _call_incref_decref
funcname, getters + (getter,))
File "/usr/lib/python3/dist-packages/numba/runtime/context.py", line 188, in _call_incref_decref
raise NotImplementedError("%s: %s" % (root_type, str(e)))
numba.errors.LoweringError: Failed at nopython (nopython mode backend)
list(list(int64)): unsupported nested memory-managed object
File "2DArrayTest.py", line 7
[1] During: lowering "$56 = build_list(items=[])" at 2DArrayTest.py (7)
I have seen elsewhere that numba doesn't like 2D arrays and lists of lists because of memory. Is there a way to make it work on the remote server, since it works on Spyder? What is it that Spyder does differently to make it work?

google-api-python-client broken by OAuth2?

I am trying to check whether a certain dataset exists in BigQuery and I get this very strange error I've never had untill yesterday:
ERROR:dsUtils.bq_utils:Could not check if dataset tmp exists.
Traceback (most recent call last):
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\dsUtils\bq_utils.py", line 113, in _get
resp = bq_service.datasets().get(projectId=self.project_id, datasetId=self.id).execute(num_retries=2)
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\oauth2client\util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\googleapiclient\http.py", line 755, in execute
method=str(self.method), body=self.body, headers=self.headers)
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\googleapiclient\http.py", line 93, in _retry_request
resp, content = http.request(uri, method, *args, **kwargs)
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\oauth2client\client.py", line 598, in new_request
self._refresh(request_orig)
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\oauth2client\client.py", line 864, in _refresh
self._do_refresh_request(http_request)
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\oauth2client\client.py", line 891, in _do_refresh_request
body = self._generate_refresh_request_body()
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\oauth2client\client.py", line 1597, in _generate_refresh_request_body
assertion = self._generate_assertion()
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\oauth2client\service_account.py", line 318, in _generate_assertion
key_id=self._private_key_id)
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\oauth2client\crypt.py", line 97, in make_signed_jwt
signature = signer.sign(signing_input)
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\oauth2client\_pycrypto_crypt.py", line 101, in sign
return PKCS1_v1_5.new(self._key).sign(SHA256.new(message))
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\Crypto\Signature\PKCS1_v1_5.py", line 112, in sign
m = self._key.decrypt(em)
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\Crypto\PublicKey\RSA.py", line 174, in decrypt
return pubkey.pubkey.decrypt(self, ciphertext)
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\Crypto\PublicKey\pubkey.py", line 93, in decrypt
plaintext=self._decrypt(ciphertext)
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\Crypto\PublicKey\RSA.py", line 235, in _decrypt
r = getRandomRange(1, self.key.n-1, randfunc=self._randfunc)
File "C:\Users\paco\Anaconda3\envs\visitForecastEnv\lib\site-packages\Crypto\PublicKey\RSA.py", line 126, in __getattr__
raise AttributeError("%s object has no %r attribute" % (self.__class__.__name__, attrname,))
AttributeError: _RSAobj object has no '_randfunc' attribute
Has anyone an idea of why I get these errors suddenly?

Categories