Reconnect minion on a new salt-master causes issues - salt-stack

I'm trying to reconnect minions to my new salt-master.
To do that,
I changed the sources.list
installing the new version of salt-minion (from 2015 to 2017.7.8)
Disconnect the minion from the old salt-master (I had two master to manage the old server because the internal application wasn't
uptodate to run a 2017 version of salt, and one for the uptodate
infrastructure)
I ran rm -r /etc/salt/pki
systemctl force-reload salt-minion.servce
I accepted the key on my new master
I ran salt-call state.sls motd (or whatever the formula)
The point is the following. For few of my minions, I cannot say why, but when I ran the last command salt-call state.sls motd I get this issue:
[ERROR ] An un-handled exception was caught by salt's global exception handler:
KeyError: 'saltutil.is_running'
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
salt_call()
File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 396, in salt_call
client.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/call.py", line 58, in run
caller.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 134, in run
ret = self.call()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 204, in call
ret['return'] = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/state.py", line 1071, in sls
conflict = running(concurrent)
File "/usr/lib/python2.7/dist-packages/salt/modules/state.py", line 209, in running
active = __salt__['saltutil.is_running']('state.*')
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1121, in __getitem__
func = super(LazyLoader, self).__getitem__(item)
File "/usr/lib/python2.7/dist-packages/salt/utils/lazy.py", line 101, in __getitem__
raise KeyError(key)
KeyError: 'saltutil.is_running'
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
salt_call()
File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 396, in salt_call
client.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/call.py", line 58, in run
caller.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 134, in run
ret = self.call()
File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 204, in call
ret['return'] = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/state.py", line 1071, in sls
conflict = running(concurrent)
File "/usr/lib/python2.7/dist-packages/salt/modules/state.py", line 209, in running
active = __salt__['saltutil.is_running']('state.*')
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1121, in __getitem__
func = super(LazyLoader, self).__getitem__(item)
File "/usr/lib/python2.7/dist-packages/salt/utils/lazy.py", line 101, in __getitem__
raise KeyError(key)
KeyError: 'saltutil.is_running'
My salt version:
Salt Version:
Salt: 2017.7.8
Dependency Versions:
cffi: 0.8.6
cherrypy: Not Installed
dateutil: 2.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.3
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: 0.21.1
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.2
mysql-python: 1.2.3
pycparser: 2.10
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 14.4.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
System Versions:
dist: debian 8.8
locale: UTF-8
machine: x86_64
release: 3.16.0-4-amd64
system: Linux
version: debian 8.8
I tried to uninstall salt-minion with:
apt-get autoremove salt-minion* -y
apt-get purge salt-minion* -y
aptitude purge salt-minion -y
And apt-get update & install salt-minion
But I still have the exact same error. And not on every minions. For some of them, I have the exact same configuration on each server, and it can work for one and not the other.
Any clue? Help :s

Related

Problem to open Jupyter notebook: cannot import name 'escape' from 'markupsafe'

Have you guys faced this problem before? I was installing cuCNN and after the installation, I cannot open Jupyter Notebooks anymore.
When I try it I got this error:
(base) PS C:\Users\USER> jupyter notebook
(base) PS C:\Users\USER> jupyter notebook
Traceback (most recent call last):
File "D:\Program Files(D)\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "D:\Program Files(D)\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 43, in <module>
from jinja2 import Environment, FileSystemLoader
File "D:\Program Files(D)\Anaconda3\lib\site-packages\jinja2\__init__.py", line 6, in <module>
from markupsafe import escape
ImportError: cannot import name 'escape' from 'markupsafe' (unknown location)
(base) PS C:\Users\USER>
Does anyone know how to solve it?
I executed these commands to install cuDNN:
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/
python3 -m pip install tensorflow
https://www.tensorflow.org/install/pip#windows-wsl2
I solved it hopefully:
"You have to reinstall markupsafe"
After trying several things I had to remove "markupsafe" manually, because "pip uninstall markupsafe" did not work out, once removed it, proceed to install markupsafe again(pip install markupsafe)... and that's it.
Note that for me only worked markupsafe 2.0.1, superior versions had other problems(this problem: https://github.com/aws/aws-sam-cli/issues/3661)
pip install markupsafe==2.0.1

pip install ngrok ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output

im trying to pip install ngrok but i got the error.
i use ubuntu server
I haven't been able to solve it for hours :(
please help me
pip install ngrok
/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py:122: PkgResourcesDeprecationWarning: 0.1.36ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
/usr/local/lib/python3.8/dist-packages/pkg_resources/__init__.py:122: PkgResourcesDeprecationWarning: 0.23ubuntu1 is an invalid version and will not be supported in a future release
warnings.warn(
Collecting ngrok
Using cached ngrok-0.1.6.tar.gz (3.5 kB)
Collecting ping
Using cached ping-0.2.tar.gz (10 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qanhr0lu/ping/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qanhr0lu/ping/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-qanhr0lu/ping/pip-egg-info
cwd: /tmp/pip-install-qanhr0lu/ping/
Complete output (8 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-qanhr0lu/ping/setup.py", line 23, in <module>
from ping import __version__
File "/tmp/pip-install-qanhr0lu/ping/ping.py", line 196
except socket.error, (errno, msg):
^
SyntaxError: invalid syntax
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I'm not sure which python ngrok library you are trying to install, but I suspect it's probably pyngrok which is installed using: pip install pyngrok
source: https://pyngrok.readthedocs.io/en/latest/index.html

I'm trying to use Prophet from fbprophet but I'm getting this excuciatingly long error message no idea what's suppose to mean?

ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/r4/nqsj60p57yq9vh_zy4fq6n000000gn/T/pip-install-91n1df76/fbprophet_e94a6b9aeb83455cb3e0fdf4115391fb/setup.py'"'"'; file='"'"'/private/var/folders/r4/nqsj60p57yq9vh_zy4fq6n000000gn/T/pip-install-91n1df76/fbprophet_e94a6b9aeb83455cb3e0fdf4115391fb/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/r4/nqsj60p57yq9vh_zy4fq6n000000gn/T/pip-record-2j0pe0nh/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/fbprophet
cwd: /private/var/folders/r4/nqsj60p57yq9vh_zy4fq6n000000gn/T/pip-install-91n1df76/fbprophet_e94a6b9aeb83455cb3e0fdf4115391fb/
Complete output (40 lines):
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/fbprophet
creating build/lib/fbprophet/stan_model
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/r4/nqsj60p57yq9vh_zy4fq6n000000gn/T/pip-install-91n1df76/fbprophet_e94a6b9aeb83455cb3e0fdf4115391fb/setup.py", line 122, in
setup(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/init.py", line 165, in setup
return distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/install.py", line 546, in run
self.run_command('build')
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/private/var/folders/r4/nqsj60p57yq9vh_zy4fq6n000000gn/T/pip-install-91n1df76/fbprophet_e94a6b9aeb83455cb3e0fdf4115391fb/setup.py", line 48, in run
build_models(target_dir)
File "/private/var/folders/r4/nqsj60p57yq9vh_zy4fq6n000000gn/T/pip-install-91n1df76/fbprophet_e94a6b9aeb83455cb3e0fdf4115391fb/setup.py", line 38, in build_models
StanBackendEnum.get_backend_class(backend).build_model(target_dir, MODEL_DIR)
File "/private/var/folders/r4/nqsj60p57yq9vh_zy4fq6n000000gn/T/pip-install-91n1df76/fbprophet_e94a6b9aeb83455cb3e0fdf4115391fb/fbprophet/models.py", line 209, in build_model
import pystan
ModuleNotFoundError: No module named 'pystan'
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/r4/nqsj60p57yq9vh_zy4fq6n000000gn/T/pip-install-91n1df76/fbprophet_e94a6b9aeb83455cb3e0fdf4115391fb/setup.py'"'"'; file='"'"'/private/var/folders/r4/nqsj60p57yq9vh_zy4fq6n000000gn/T/pip-install-91n1df76/fbprophet_e94a6b9aeb83455cb3e0fdf4115391fb/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/r4/nqsj60p57yq9vh_zy4fq6n000000gn/T/pip-record-2j0pe0nh/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/fbprophet Check the logs for full command output.
/fbprophet/models.py", line 209, in build_model import pystan ModuleNotFoundError: No module named 'pystan' ---------------------------------------- ERROR: Command errored out with exit status 1
This is your error message. Have you installed pystan ?
If you have and are still getting this error then try uninstalling pystan and install a older version.
I had the same issue and the below worked for me:
Step 1: Uninstall pystan
pip uninstall pystan
Step 2: Install pystan version ~2.14
pip install pystan~=2.14
**Step 3: Try installing fbprophet again **
pip install fbprophet
Reference.
After making sure you have the right python version.
Update apt and install following libraries.
sudo apt update
sudo apt install python3-dev python3-pip python3-venv
use python3 -m pip to install pystan and prophet
python3 -m pip pystan
python3 -m pip prophet

Jupyter ImportError: cannot import name 'create_prompt_application' ubuntu 18.04

I have installed jupypter on Ubuntu 18.04. when I try to open .ipynb file it says trying to connect to server and fails eventaully.
When I looked at the console I saw the following error :
ImportError: cannot import name 'create_prompt_application'
as follows
[I 14:37:41.311 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "/usr/local/lib/python3.6/dist-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/usr/local/lib/python3.6/dist-packages/ipykernel/connect.py", line 13, in <module>
from IPython.core.profiledir import ProfileDir
File "/usr/lib/python3/dist-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/usr/lib/python3/dist-packages/IPython/terminal/embed.py", line 18, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/usr/lib/python3/dist-packages/IPython/terminal/interactiveshell.py", line 20, in <module>
from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop, create_prompt_layout, create_output
ImportError: cannot import name 'create_prompt_application'
[W 14:37:44.322 NotebookApp] KernelRestarter: restart failed
Some posts related to IPyton are suggesting that prompt-toolkit should be downgraded. I run deptree to get dependency tree as follows, which shows that prompt-toolkit 2.0.9 is installed and required version for jupyter-console should be between 2.0.0 and 2.0.1
- jupyter-console [required: Any, installed: 6.0.0]
- ipykernel [required: Any, installed: 5.1.0]
- ipython [required: >=5.0.0, installed: 5.5.0]
- pexpect [required: Any, installed: 4.2.1]
- jupyter-client [required: Any, installed: 5.2.4]
- jupyter-core [required: Any, installed: 4.4.0]
- traitlets [required: Any, installed: 4.3.2]
- python-dateutil [required: >=2.1, installed: 2.6.1]
- pyzmq [required: >=13, installed: 18.0.1]
- tornado [required: >=4.1, installed: 6.0.1]
- traitlets [required: Any, installed: 4.3.2]
- tornado [required: >=4.2, installed: 6.0.1]
- traitlets [required: >=4.1.0, installed: 4.3.2]
- ipython [required: Any, installed: 5.5.0]
- pexpect [required: Any, installed: 4.2.1]
- jupyter-client [required: Any, installed: 5.2.4]
- jupyter-core [required: Any, installed: 4.4.0]
- traitlets [required: Any, installed: 4.3.2]
- python-dateutil [required: >=2.1, installed: 2.6.1]
- pyzmq [required: >=13, installed: 18.0.1]
- tornado [required: >=4.1, installed: 6.0.1]
- traitlets [required: Any, installed: 4.3.2]
- prompt-toolkit [required: >=2.0.0,<2.1.0, installed: 2.0.9]
Any thoughts on what could be wrong and what should I do?
Thanks
It is best to upgrade jupyter-console with this command:
pip3 install --upgrade --force jupyter-console
Then it will be compatible with later versions of prompt-toolkit.
More details in this github issue.
sudo pip3 uninstall ipython
sudo pip3 install ipython
the error solved for me Try it out.
sudo pip3 install 'prompt-toolkit<2.1.0,>=2.0.0' --force-reinstall
For me the solution was to follow these steps:
python3 -m venv venv
source venv/bin/activate
pip install jupyter
python -m jupyter notebook
I hope this helps anybody.

Upgrading from IPython 5.x to 6.0 results in crash due to IPython.utils.warn

I recently upgraded from IPython 5.x to 6.0 via condo update ipython. However, I get a crash in the kernel:
Traceback (most recent call last):
File "//anaconda/lib/python3.5/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "//anaconda/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "//anaconda/lib/python3.5/site-packages/ipykernel/__main__.py", line 2, in <module>
from ipykernel import kernelapp as app
File "//anaconda/lib/python3.5/site-packages/ipykernel/kernelapp.py", line 37, in <module>
from .ipkernel import IPythonKernel
File "//anaconda/lib/python3.5/site-packages/ipykernel/ipkernel.py", line 15, in <module>
from .zmqshell import ZMQInteractiveShell
File "//anaconda/lib/python3.5/site-packages/ipykernel/zmqshell.py", line 46, in <module>
from IPython.utils.warn import error
ImportError: No module named 'IPython.utils.warn'
[I 18:35:28.928 NotebookApp] KernelRestarter: restarting kernel (1/5)
Apparently, the issue is that IPython.utils.warn was deprecated and has now been removed as of version 6.0.0. How can I fix this?
Note: none of the following worked:
pip install --upgrade ipython
pip install --upgrade jupyter
pip install --upgrade --no-deps --force-reinstall ipython
pip install --upgrade --no-deps --force-reinstall jupyter
I had the same issue. The following line fixed the issue for me:
conda update ipykernel
I don't know why this is not done automatically.
+1 same problem.
Workaround was to downgrade to the latest available 5.x version of iPython (currently 5.3.0 found via conda search ipython):
conda install ipython=5.3.0
Now Jupyter notebook kernel can start again.

Resources