I followed this tutorial to start a python3 script at startup. The significant files are all stored at /home/pi/Desktop
pi#raspberrypi:~/Desktop $ ls
Jaeger.py launcher.sh logs
pi#raspberrypi:~/Desktop $
There are three files in general:
Jaeger.py Python script which needs python3
launcher.sh Shell script which should be started after boot
logs Folder for log files when the cronjob failed
Jaeger.py
#!/usr/bin/env python
import time
import sys
import curses
import mariadb # => need python3!
from evdev import InputDevice, ecodes, list_devices
...
launcher.sh
#!/bin/sh
# launcher.sh
# navigate to home directory, then to this directory, then execute python script, then back home
/usr/bin/python3 /home/pi/Desktop/Jaeger.py
Crontab
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
#reboot sh /home/pi/Desktop/launcher.sh >/home/pi/Desktop/logs/cronlog 2>&1
When executing the launcher.sh shell script via cmd (without sudo) it works!
pi#raspberrypi:~/Desktop $ sh launcher.sh
0011674128
Did it!
Last Inserted ID: None
When executing the launcher.sh shell script via cmd (with sudo) it doesn't work!
pi#raspberrypi:~/Desktop $ sudo sh launcher.sh
Traceback (most recent call last):
File "/home/pi/Desktop/Jaeger.py", line 5, in <module>
import mariadb
ModuleNotFoundError: No module named 'mariadb'
And this is the exact same error message I run into while booting and using the crontab... After boot, I can read this error message in my log files stored in /home/pi/Desktop/logs/cronlog
Why do I get an error with import mariadb when using sudo and why do I get the same error when using the crontab without any sudo cmd? Is the crontab always started as root? Do I have to setup python3 for root?
BTW
pi#raspberrypi:~/Desktop $ python3 -V
Python 3.7.3
pi#raspberrypi:~/Desktop $ python2 -V
Python 2.7.16
pi#raspberrypi:~/Desktop $ which python
/usr/bin/python
pi#raspberrypi:~/Desktop $ which python3
/usr/bin/python3
EDIT0
pi#raspberrypi:~ $ pip list
Package Version
asn1crypto 0.24.0
astroid 2.1.0
asttokens 1.1.13
automationhat 0.2.0
beautifulsoup4 4.7.1
blinker 1.4
blinkt 0.1.2
buttonshim 0.0.2
Cap1xxx 0.1.3
certifi 2018.8.24
chardet 3.0.4
Click 7.0
colorama 0.3.7
colorzero 1.1
cookies 2.2.1
cryptography 2.6.1
cupshelpers 1.0
docutils 0.14
drumhat 0.1.0
entrypoints 0.3
envirophat 1.0.0
evdev 1.4.0
ExplorerHAT 0.4.2
Flask 1.0.2
fourletterphat 0.1.0
gpiozero 1.6.2
guizero 1.2.0
html5lib 1.0.1
idna 2.6
isort 4.3.4
itsdangerous 0.24
jedi 0.13.2
Jinja2 2.10
keyring 17.1.1
keyrings.alt 3.1.1
lazy-object-proxy 1.3.1
logilab-common 1.4.2
lxml 4.3.2
mariadb 1.0.7
MarkupSafe 1.1.0
mccabe 0.6.1
microdotphat 0.2.1
mote 0.0.4
motephat 0.0.3
mypy 0.670
mypy-extensions 0.4.1
numpy 1.16.2
oauthlib 2.1.0
olefile 0.46
pantilthat 0.0.7
parso 0.3.1
pexpect 4.6.0
pgzero 1.2
phatbeat 0.1.1
pianohat 0.1.0
picamera 1.13
piglow 1.2.5
pigpio 1.78
Pillow 5.4.1
pip 18.1
psutil 5.5.1
pycairo 1.16.2
pycrypto 2.6.1
pycups 1.9.73
pygame 1.9.4.post1
Pygments 2.3.1
PyGObject 3.30.4
pyinotify 0.9.6
PyJWT 1.7.0
pylint 2.2.2
pyOpenSSL 19.0.0
pyserial 3.4
pysmbc 1.0.15.6
python-apt 1.8.4.3
pyxdg 0.25
rainbowhat 0.1.0
reportlab 3.5.13
requests 2.21.0
requests-oauthlib 1.0.0
responses 0.9.0
roman 2.0.0
RPi.GPIO 0.7.0
RTIMULib 7.2.1
scrollphat 0.0.7
scrollphathd 1.2.1
SecretStorage 2.3.1
Send2Trash 1.5.0
sense-hat 2.2.0
setuptools 40.8.0
simplejson 3.16.0
six 1.12.0
skywriter 0.0.7
sn3218 1.2.7
soupsieve 1.8
spidev 3.5
ssh-import-id 5.7
thonny 3.3.10
touchphat 0.0.1
twython 3.7.0
typed-ast 1.3.1
unicornhathd 0.0.4
urllib3 1.24.1
webencodings 0.5.1
Werkzeug 0.14.1
wheel 0.32.3
wrapt 1.10.11
pi#raspberrypi:~ $ pip3 list
Package Version
asn1crypto 0.24.0
astroid 2.1.0
asttokens 1.1.13
automationhat 0.2.0
beautifulsoup4 4.7.1
blinker 1.4
blinkt 0.1.2
buttonshim 0.0.2
Cap1xxx 0.1.3
certifi 2018.8.24
chardet 3.0.4
Click 7.0
colorama 0.3.7
colorzero 1.1
cookies 2.2.1
cryptography 2.6.1
cupshelpers 1.0
docutils 0.14
drumhat 0.1.0
entrypoints 0.3
envirophat 1.0.0
evdev 1.4.0
ExplorerHAT 0.4.2
Flask 1.0.2
fourletterphat 0.1.0
gpiozero 1.6.2
guizero 1.2.0
html5lib 1.0.1
idna 2.6
isort 4.3.4
itsdangerous 0.24
jedi 0.13.2
Jinja2 2.10
keyring 17.1.1
keyrings.alt 3.1.1
lazy-object-proxy 1.3.1
logilab-common 1.4.2
lxml 4.3.2
mariadb 1.0.7
MarkupSafe 1.1.0
mccabe 0.6.1
microdotphat 0.2.1
mote 0.0.4
motephat 0.0.3
mypy 0.670
mypy-extensions 0.4.1
numpy 1.16.2
oauthlib 2.1.0
olefile 0.46
pantilthat 0.0.7
parso 0.3.1
pexpect 4.6.0
pgzero 1.2
phatbeat 0.1.1
pianohat 0.1.0
picamera 1.13
piglow 1.2.5
pigpio 1.78
Pillow 5.4.1
pip 18.1
psutil 5.5.1
pycairo 1.16.2
pycrypto 2.6.1
pycups 1.9.73
pygame 1.9.4.post1
Pygments 2.3.1
PyGObject 3.30.4
pyinotify 0.9.6
PyJWT 1.7.0
pylint 2.2.2
pyOpenSSL 19.0.0
pyserial 3.4
pysmbc 1.0.15.6
python-apt 1.8.4.3
pyxdg 0.25
rainbowhat 0.1.0
reportlab 3.5.13
requests 2.21.0
requests-oauthlib 1.0.0
responses 0.9.0
roman 2.0.0
RPi.GPIO 0.7.0
RTIMULib 7.2.1
scrollphat 0.0.7
scrollphathd 1.2.1
SecretStorage 2.3.1
Send2Trash 1.5.0
sense-hat 2.2.0
setuptools 40.8.0
simplejson 3.16.0
six 1.12.0
skywriter 0.0.7
sn3218 1.2.7
soupsieve 1.8
spidev 3.5
ssh-import-id 5.7
thonny 3.3.10
touchphat 0.0.1
twython 3.7.0
typed-ast 1.3.1
unicornhathd 0.0.4
urllib3 1.24.1
webencodings 0.5.1
Werkzeug 0.14.1
wheel 0.32.3
wrapt 1.10.11
Related
What I'm trying to do
I'm writing a Python (version==3.8.X) script for interactive visualization of molecules, which is working perfectly fine in VS Code but not in classical Jupyter Notebooks anymore (it did though just 2 weeks ago). For its practical use case with my employer it needs to be able to be run in Jupyter Notebook but it seems impossible for me to set Jupyter up the correct way on my personal machine (Arch Linux) as well as work stations at work (Ubuntu Linux) even though I've had both running fine lately.
Information I've collected
These are two screenshots of the outputs of the exact same cell (same file), when using Jupyter Notebook and here in VS Code.
Output of jupyter nbextension list:
Known nbextensions:
config dir: /home/lnrd/.jupyter/nbconfig
notebook section
nbextensions_configurator/config_menu/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/config_menu/main
contrib_nbextensions_help_item/main enabled
- Validating: OK
jupyter-js-widgets/extension enabled
- Validating: OK
jupyterlab disabled
tree section
nbextensions_configurator/tree_tab/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/tree_tab/main
config dir: /home/lnrd/.local/etc/jupyter/nbconfig
notebook section
ipyevents/extension enabled
- Validating: OK
nbextensions_configurator/config_menu/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/config_menu/main
jupyter-js-widgets/extension enabled
- Validating: OK
tree section
nbextensions_configurator/tree_tab/main enabled
- Validating: problems found:
- require? X nbextensions_configurator/tree_tab/main
config dir: /etc/jupyter/nbconfig
notebook section
jupyter-js-widgets/extension enabled
- Validating: OK
Output of jupyter troubleshoot. I'm unsure about the meaning of the sys.<var> paths and where those are configured. I do understand $PATH, how it's configured and what it means for software in my OS. I guess pip list here is equal to py310 -m pip list.
I'm guessing the sys.<var> references the python kernel which Jupyter is running
I unsuccessfully tried setting up and using my py38 install as kernel (sys.version within the notebook then gave me 3.8.X) but errors had been the same
even with py38 as kernel, jupyter notebook --debug output (see below) had been looking for files in py310 directories. Maybe I've just made a mistake setting up the py38 kernel correctly but maybe not.
when using jupyter nbextension enable sometimes I've used the --py and --user flags and sometimes didn't - could this have been an issue?
$PATH:
/home/lnrd/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
/usr/bin/site_perl
/usr/bin/vendor_perl
/usr/bin/core_perl
/home/lnrd/.local/bin
sys.path:
/usr/bin
/usr/lib/python310.zip
/usr/lib/python3.10
/usr/lib/python3.10/lib-dynload
/home/lnrd/.local/lib/python3.10/site-packages
/usr/lib/python3.10/site-packages
sys.executable:
/usr/bin/python
sys.version:
3.10.9 (main, Dec 19 2022, 17:35:49) [GCC 12.2.0]
platform.platform():
Linux-6.1.8-arch1-1-x86_64-with-glibc2.36
which -a jupyter:
/usr/sbin/jupyter
/usr/bin/jupyter
/sbin/jupyter
/bin/jupyter
/home/lnrd/.local/bin/jupyter
pip list:
Package Version
--------------------------------- -----------
aiohttp 3.7.4.post0
aiohttp-retry 2.8.3
alabaster 0.7.13
amqp 5.1.1
antlr4-python3-runtime 4.9.3
anyio 3.6.2
anytree 2.8.0
appdirs 1.4.4
apptools 5.2.0
argon2-cffi 21.3.0
argon2-cffi-bindings 21.2.0
arrow 1.2.3
ase 3.22.1
astroid 2.13.3
asttokens 2.2.1
async-generator 1.10
async-timeout 3.0.1
asyncssh 2.12.0
atpublic 3.1.1
attrs 22.2.0
autocommand 2.2.2
autopep8 1.6.0
Babel 2.11.0
backcall 0.2.0
beautifulsoup4 4.11.1
billiard 3.6.4.0
bleach 6.0.0
breezy 3.3.2
Brlapi 0.8.4
btrfsutil 6.1.3
CacheControl 0.12.11
celery 5.2.7
certifi 2022.12.7
cffi 1.15.1
chardet 4.0.0
click 8.1.3
click-didyoumean 0.3.0
click-plugins 1.1.1
click-repl 0.2.0
colorama 0.4.6
comm 0.1.2
commonmark 0.9.1
configobj 5.1.0.dev0
contextlib2 21.6.0
cryptography 39.0.0
cssselect 1.2.0
cycler 0.11.0
Cython 0.29.33
debugpy 1.6.6
decorator 5.1.1
defusedxml 0.7.1
deprecation 2.1.0
dictdiffer 0.9.0
dill 0.3.6
discord 1.7.3
discord.py 1.7.3
diskcache 5.4.0
distlib 0.3.6
distro 1.8.0
dnspython 2.2.1
docutils 0.19
dpath 2.0.6
dscribe 1.2.2
dulwich 0.20.46
dvc-data 0.8.0
dvc-http 2.19.1
dvc-objects 0.2.2
dvc-render 0.0.10
dvc-task 0.1.2
dvclive 0.10.0
entrypoints 0.4
envisage 6.1.0
evdev 1.6.1
executing 1.2.0
fastbencode 0.1
fastjsonschema 2.16.2
flake8 4.0.1
flatten-dict 0.4.2
flufl.lock 7.1.1
fonttools 4.29.1
fqdn 1.5.1
fsspec 2022.8.2
funcy 1.17
future 0.18.2
gitdb 4.0.9
GitPython 3.1.27
grandalf 0.6
greenlet 1.1.2
html5lib 1.1
hydra-core 1.2.0
idna 3.4
imagesize 1.4.1
importlib-metadata 5.0.0
inflect 6.0.2
ipyevents 2.0.1
ipykernel 6.20.2
ipython 8.9.0
ipython-genutils 0.2.0
ipywidgets 8.0.4
isoduration 20.11.0
isort 5.11.4
jaraco.context 4.2.0
jaraco.functools 3.5.2
jaraco.text 3.11.0
jedi 0.18.2
Jinja2 3.1.2
joblib 1.2.0
json5 0.9.12
jsonpointer 2.3
jsonschema 4.17.3
jupyter 1.0.0
jupyter_client 8.0.1
jupyter-console 6.4.4
jupyter-contrib-core 0.4.2
jupyter_core 5.1.5
jupyter-events 0.6.3
jupyter-nbextensions-configurator 0.6.1
jupyter_packaging 0.12.3
jupyter-server 1.23.5
jupyter_server_terminals 0.4.4
jupyterlab 3.5.3
jupyterlab-pygments 0.2.2
jupyterlab_server 2.19.0
jupyterlab-widgets 3.0.5
kiwisolver 1.3.2
kombu 5.2.4
lazy-object-proxy 1.9.0
ledfx 0.10.7
lensfun 0.3.3
libfdt 1.6.1
lit 15.0.7.dev0
llvmlite 0.39.1
louis 3.24.0
lxml 4.9.2
Markdown 3.4.1
markdown-it-py 2.1.0
MarkupSafe 2.1.2
matplotlib 3.5.1
matplotlib-inline 0.1.6
mayavi 4.8.1
mccabe 0.6.1
mdurl 0.1.2
merge3 0.0.12
meson 1.0.0
mistune 2.0.4
more-itertools 9.0.0
msgpack 1.0.4
multidict 6.0.2
mypy 0.942
mypy-extensions 0.4.3
nanotime 0.5.2
natsort 8.1.0
nbclassic 0.5.1
nbclient 0.7.2
nbconvert 7.2.9
nbformat 5.7.3
nest-asyncio 1.5.6
netsnmp-python 1.0a1
networkx 2.8.6
notebook 6.5.2
notebook_shim 0.2.2
nspektr 0.4.0
numba 0.56.4
numpy 1.22.4
omegaconf 2.2.3
ordered-set 4.1.0
packaging 23.0
pandas 1.5.1
pandocfilters 1.5.0
parso 0.8.3
pathspec 0.9.0
patiencediff 0.2.12
pep517 0.13.0
pexpect 4.8.0
pickleshare 0.7.5
Pillow 9.4.0
pip 22.3.1
platformdirs 2.6.2
pluggy 1.0.0
ply 3.11
progress 1.6
prometheus-client 0.16.0
prompt-toolkit 3.0.36
psutil 5.9.4
ptyprocess 0.7.0
pure-eval 0.2.2
pwquality 1.4.5
py3Dmol 1.8.1
PyAudio 0.2.11
pybind11 2.10.1
pycairo 1.23.0
pycodestyle 2.10.0
pycparser 2.21
pydantic 1.10.4
pydocstyle 6.1.1
pydot 1.4.2
pyface 7.4.2
pyflakes 3.0.1
pygit2 1.10.1
Pygments 2.14.0
PyGObject 3.42.2
pygtrie 2.5.0
pylint 2.15.10
pyls-isort 0.2.2
pylsp-mypy 0.5.7
PyNaCl 1.5.0
pynvim 0.4.3
pyOpenSSL 23.0.0
pyparsing 3.0.9
PyQt5 5.15.6
PyQt5-Qt5 5.15.2
PyQt5-sip 12.9.1
PyQt6 6.4.1
PyQt6-sip 13.4.1
pyqtgraph 0.13.1
pyrsistent 0.19.3
python-dateutil 2.8.2
python-dotenv 0.20.0
python-json-logger 2.0.4
python-lsp-jsonrpc 1.0.0
python-lsp-server 1.4.1
python-xlib 0.31
pytz 2022.7
pyxdg 0.28
PyYAML 6.0
pyzmq 25.0.0
qtconsole 5.4.0
QtPy 2.3.0
rdkit 2022.9.3
requests 2.28.1
requests-unixsocket 0.3.0
resolvelib 0.9.0
retrying 1.3.3
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rfc3987 1.3.8
rich 13.3.1
rope 1.0.0
ruamel.yaml 0.17.21
ruamel.yaml.clib 0.2.6
scikit-learn 1.1.3
scipy 1.8.0
scmrepo 0.1.1
Send2Trash 1.8.0
setproctitle 1.3.2
setuptools 65.6.3
shiboken6 6.4.2
shiboken6-generator 6.4.2
shortuuid 1.0.9
shtab 1.5.5
simplejson 3.18.0
six 1.16.0
smmap 5.0.0
sniffio 1.3.0
snowballstemmer 2.2.0
soupsieve 2.3.2.post1
sparse 0.13.0
Sphinx 5.3.0
sphinxcontrib-applehelp 1.0.4
sphinxcontrib-devhelp 1.0.2
sphinxcontrib-htmlhelp 2.0.0
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.3
sphinxcontrib-serializinghtml 1.1.5
stack-data 0.6.2
tabulate 0.8.10
TBB 0.2
team 1.0
tenacity 8.1.0
terminado 0.17.1
terminator 2.1.2
testpath 0.6.0
threadpoolctl 3.1.0
tinycss2 1.2.1
toml 0.10.2
tomli 2.0.1
tomlkit 0.11.6
tornado 6.2
tqdm 4.64.1
traitlets 5.8.1
traits 6.4.1
traitsui 7.4.2
trove-classifiers 2023.1.20
typing_extensions 4.4.0
uc-micro-py 1.0.1
ujson 5.2.0
uri-template 1.2.0
urllib3 1.26.12
validate 5.1.0.dev0
validate-pyproject 0.12.1
vimiv 0.8.0
vine 5.0.0
voluptuous 0.13.1
vtk 9.2.2
wcwidth 0.2.6
webcolors 1.12
webencodings 0.5.1
websocket-client 1.5.0
wheel 0.38.4
widgetsnbextension 4.0.5
wrapt 1.14.1
wslink 1.9.1
wxPython 4.2.0
yapf 0.32.0
yarl 1.7.2
youtube-dl 2021.12.17
zc.lockfile 2.0
zipp 3.12.0
Output of jupyter notebook --debug shows this one line containing status 404. I suspect this should lead me somewhere but I'm unsure what to do with this information:
[W <time> NotebookApp] 404 GET /static/components/marked/lib/marked.js (127.0.0.1) 34.030000ms referer=http://localhost:8888/tree
What I've tried to fix this
gone through all config files in all jupyter --paths to check if jupyter-js-widgets=true
Used py38 and py310 kernels
with <py> as py38=/usr/bin/python3.8 and py310=/usr/bin/python3.10 i have
<py> -m pip install --upgrade jupyter notebook ipywidgets widgetsnbextension jupyter_contrib_nbextensions jupyter-js-widgets-nbextension
<py> -m pip install --force-reinstall jupyter notebook ipywidgets widgetsnbextension jupyter_contrib_nbextensions jupyter-js-widgets-nbextension
executing jupyter contrib nbextension install
disabling and enabling different jupyter nbextensions
JupyterLab
pip installing JupyterLab, enabling it and executing jupyterlab extension install py3dmol as suggested by error message from screenshot
uninstalling and disabling JupyterLab again because I hadn't used it when the code ran in Jupyter Notebook originally
OS: Arch linux(termux proot)
Python version: 3.10.8
My error message as follow
Visual Studio Code (1.73.1, undefined, desktop)
Jupyter Extension Version: 2022.9.1303220346.
Python Extension Version: 2022.18.2.
Workspace folder /home/jack/Documents/Medical-segmentation
info 15:00:11.430: ZMQ install verified.
User belongs to experiment group 'jupyterTestcf'
User belongs to experiment group 'jupyterEnhancedDataViewer'
info 15:00:12.217: LSP Notebooks experiment is disabled -- not in treatment group
info 15:00:13.731: Got empty env vars with python /bin/python in 1275ms
info 15:00:13.731: Got env vars ourselves faster /bin/python with env var count 59 in 1276ms
info 15:00:13.768: Process Execution: > /bin/python -m pip list
> /bin/python -m pip list
info 15:00:22.102: Starting interactive window for resource '/home/jack/Documents/Medical-segmentation/snakes/example2.py'
info 15:00:22.512: Preferred Remote kernel for Interactive-1.interactive is undefined
info 15:00:25.004: Process Execution: > /bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2022.9.1303220346/pythonFiles/normalizeSelection.py
> /bin/python ~/.vscode/extensions/ms-toolsai.jupyter-2022.9.1303220346/pythonFiles/normalizeSelection.py
info 15:00:25.022: Starting Jupyter Session startUsingPythonInterpreter, .jvsc74a57bd0e7370f93d1d0cde622a1f8e1c04877d8463912d04d973331ad4851f04de6915a./bin/python./bin/python.-m#ipykernel_launcher (Python Path: , EnvType: Global, EnvName: '', Version: 3.10.8) for 'Interactive-1.interactive' (disableUI=false)
info 15:00:25.024: Computing working directory for resource '/home/jack/Documents/Medical-segmentation/snakes/example2.py'
info 15:00:25.054: Got env vars ourselves faster /bin/python with env var count 59 in 2ms
info 15:00:25.108: Process Execution: > /bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
> /bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
info 15:00:25.266: Got env vars ourselves faster /bin/python with env var count 59 in 14ms
info 15:00:25.266: Got env vars ourselves faster /bin/python with env var count 59 in 6ms
info 15:00:25.308: Process Execution: > /bin/python -m ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"a946baa0-e0d4-41d4-b72d-1eed7330e6f9" --shell=9002 --transport="tcp" --iopub=9004 --f=/home/jack/.local/share/jupyter/runtime/kernel-v2-32230pKMrdOglR18w.json
> /bin/python -m ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"a946baa0-e0d4-41d4-b72d-1eed7330e6f9" --shell=9002 --transport="tcp" --iopub=9004 --f=/home/jack/.local/share/jupyter/runtime/kernel-v2-32230pKMrdOglR18w.json
info 15:00:25.308: Process Execution: cwd: ~/Documents/Medical-segmentation/snakes
cwd: ~/Documents/Medical-segmentation/snakes
info 15:00:25.823: Registering dummy command feature
info 15:00:27.946: ipykernel version & path 6.18.0, /usr/lib/python3.10/site-packages/ipykernel/__init__.py for /bin/python
info 15:00:29.175: Got empty env vars with python /bin/python in 4123ms
info 15:00:29.176: Got empty env vars with python /bin/python in 3924ms
info 15:00:29.176: Got empty env vars with python /bin/python in 3916ms
warn 15:00:33.920: StdErr from Kernel Process /usr/lib/python3.10/site-packages/traitlets/traitlets.py:2412: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
warn(
warn 15:00:33.921: StdErr from Kernel Process /usr/lib/python3.10/site-packages/traitlets/traitlets.py:2366: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use 'a946baa0-e0d4-41d4-b72d-1eed7330e6f9' instead of 'b"a946baa0-e0d4-41d4-b72d-1eed7330e6f9"'.
warn(
warn 15:00:33.964: StdErr from Kernel Process Permission denied (src/ip_resolver.cpp:542)
error 15:00:33.979: Disposing kernel process due to an error o [Error]: The kernel died. Error: /usr/lib/python3.10/site-packages/traitlets/traitlets.py:2412: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
warn(
/usr/lib/python3.10/site-packages/traitlets/traitlets.py:2366: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use 'a946baa0-e0d4-41d4-b72d-1eed7330e6f9' instead of 'b"a946baa0-e0d4-41d4-b72d-1eed7330e6f9"'.
warn(
Permission denied (src/ip_resolver.cpp:542)... View Jupyter [log](command:jupyter.viewOutput) for further details.
at ChildProcess.<anonymous> (/home/jack/.vscode/extensions/ms-toolsai.jupyter-2022.9.1303220346/out/extension.node.js:2:2195101)
at ChildProcess.emit (node:events:538:35)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) {
category: 'kerneldied',
kernelConnectionMetadata: {
kind: 'startUsingPythonInterpreter',
kernelSpec: {
specFile: '/home/jack/.vscode/extensions/ms-toolsai.jupyter-2022.9.1303220346/temp/jupyter/kernels/python3108jvsc74a57bd0e7370f93d1d0cde622a1f8e1c04877d8463912d04d973331ad4851f04de6915a/kernel.json',
interpreterPath: '/bin/python',
isRegisteredByVSC: 'registeredByNewVersionOfExt',
name: 'python3108jvsc74a57bd0e7370f93d1d0cde622a1f8e1c04877d8463912d04d973331ad4851f04de6915a',
argv: [Array],
language: 'python',
executable: 'python',
display_name: 'Python 3.10.8 64-bit',
metadata: [Object],
env: {}
},
I encounter this error message but I does not have any issue in another termux proot system. I remove all python and packages and reinstall. It didn't work for me.
11/24 updated:
It's weird because I look to another system by using pip list. It's the same version with I currently use system.
Package Version
---------------------- -----------
aiohttp 3.8.3
aiohttp-socks 0.7.1
aiorpcX 0.22.1
aiosignal 1.2.0
anyio 3.6.2
appdirs 1.4.4
argon2-cffi 21.3.0
argon2-cffi-bindings 21.2.0
asttokens 2.1.0
async-generator 1.10
async-timeout 4.0.2
attrs 22.1.0
autocommand 2.2.2
Babel 2.11.0
backcall 0.2.0
beautifulsoup4 4.11.1
bitstring 3.1.9
black 22.10.0
bleach 5.0.1
build 0.9.0
certifi 2022.9.24
cffi 1.15.1
chardet 5.0.0
charset-normalizer 3.0.0
click 8.1.3
codespell 0.0.0
comm 0.1.0
commonmark 0.9.1
contourpy 1.0.6
cryptography 38.0.1
cycler 0.11.0
Cython 0.29.32
debugpy 1.6.3
decorator 5.1.1
defusedxml 0.7.1
deprecation 2.1.0
dnspython 2.2.1
docopt 0.6.2
docutils 0.19
ecdsa 0.18.0
Electrum 4.3.1
entrypoints 0.4
executing 1.2.0
fastjsonschema 2.16.2
flake8 5.0.4
flake8-black 0.3.3
flake8-isort 5.0.0
fonttools 4.38.0
frozenlist 1.3.1
future 0.18.2
greenlet 1.1.3.post0
idna 3.4
imageio 2.22.4
imutils 0.5.4
inflect 6.0.2
installer 0.5.1
ipykernel 6.18.0
ipython 8.6.0
ipython-genutils 0.2.0
isort 5.10.1
jaraco.context 4.1.2
jaraco.functools 3.5.2
jaraco.text 3.11.0
jedi 0.18.1
Jinja2 3.1.2
json5 0.9.10
jsonrpclib-pelix 0.4.3.2
jsonschema 4.17.1
jupyter_client 7.4.7
jupyter_core 5.0.0
jupyter_packaging 0.12.3
jupyter-server 1.23.3
jupyterlab 3.5.0
jupyterlab-pygments 0.2.2
jupyterlab_server 2.16.3
kiwisolver 1.4.4
lxml 4.9.1
mackup 0.8.36
markdown-it-py 2.1.0
MarkupSafe 2.1.1
matplotlib 3.6.2
matplotlib-inline 0.1.6
mccabe 0.7.0
mdurl 0.1.2
mistune 2.0.4
more-itertools 9.0.0
msgpack 1.0.4
multidict 6.0.2
mypy-extensions 0.4.3
mysql-connector-python 8.0.31
nbclassic 0.4.8
nbclient 0.7.0
nbconvert 7.2.5
nbformat 5.7.0
nest-asyncio 1.5.6
networkx 2.8.8
nibabel 4.0.2
notebook 6.5.2
notebook_shim 0.2.2
numpy 1.23.4
ordered-set 4.1.0
packaging 21.3
pandas 1.5.1
pandocfilters 1.5.0
parso 0.8.3
pathspec 0.10.1
pbkdf2 1.3
pep517 0.13.0
pexpect 4.8.0
pickleshare 0.7.5
pikaur 1.13
Pillow 9.3.0
pip 22.3
platformdirs 2.5.2
pluggy 1.0.0
ply 3.11
portalocker 2.6.0
progressbar2 4.2.0
prometheus-client 0.15.0
prompt-toolkit 3.0.33
protobuf 4.21.7
psutil 5.9.4
ptyprocess 0.7.0
pure-eval 0.2.2
pyaes 1.6.1
pyalpm 0.10.6
pycodestyle 2.9.1
pycparser 2.21
pycryptodomex 3.12.0
pydantic 1.10.2
pyflakes 2.5.0
Pygments 2.13.0
pynvim 0.4.3
pyparsing 3.0.9
PyQt5 5.15.7
PyQt5-sip 12.11.0
pyrsistent 0.19.2
PySocks 1.7.1
python-dateutil 2.8.2
python-dotenv 0.21.0
python-lsp-jsonrpc 1.0.0
python-lsp-server 1.5.0
python-socks 2.0.3
python-utils 3.4.5
pytz 2022.5
pytz-deprecation-shim 0.1.0.post0
PyWavelets 1.4.1
pyzmq 24.0.1
qrcode 7.3.1
regex 2022.10.31
requests 2.28.1
requests-unixsocket 0.3.0
ruamel.yaml 0.17.21
ruamel.yaml.clib 0.2.7
scikit-image 0.19.3
scipy 1.9.3
Send2Trash 1.8.0
setuptools 63.2.0
Shapely 1.8.2
six 1.16.0
sniffio 1.3.0
soupsieve 2.3.2.post1
SQLAlchemy 1.4.43
stack-data 0.6.1
TBB 0.2
terminado 0.17.0
testpath 0.6.0
tifffile 2022.10.10
tinycss2 1.2.1
toml 0.10.2
tomli 2.0.1
tomlkit 0.11.6
tornado 6.2
traitlets 5.5.0
trove-classifiers 2022.10.19
typing_extensions 4.4.0
tzdata 2022.6
tzlocal 4.2
uc-micro-py 1.0.1
ujson 5.5.0
urllib3 1.26.12
validate-pyproject 0.10.1
wcwidth 0.2.5
webencodings 0.5.1
websocket-client 1.4.1
wheel 0.37.1
yarl 1.8.1
Open your vscode and reinstall the Python and Jupyter Notebook extensions.
Reinstall ipykernel package in the terminal.
At the same time, this issue also proposes other solutions.
Added:
I encountered the same problem with traitlets==4.3.3. I updated it by using pip install traitlets and it's version is 5.5.0 to solve this problem.
I didn't find a way to fix this within Arch itself, but I believe it has something to do with how Arch saves sockets to systemd, which is not accessible in proot, thus the permission denied error. However, as termux can run ipykernel successfully, and you have access to termux directories in proot arch, you can simply do this:
create venv in termux home: python -m venv env-name
activate venv in termux: source ~/env-name/bin/activate
install ipykernel: pip install ipykernel
activate venv in arch: source /data/data/com.termux/files/home/env-name/bin/activate
add venv as kernel: python -m ipykernel install --user --name env-name
select kernel in vscode
I'm trying to use Azure-storage-blob with Python importing with
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
and installed in my .venv with pip install azure-storage-blob and required in requirements.txt with azure-storage-blob
This is my pip list of the environment
Package Version
------------------------- ---------
adal 1.2.7
azure-common 1.1.28
azure-core 1.21.1
azure-cosmos 4.2.0
azure-functions 1.8.0
azure-mgmt-datalake-nspkg 3.0.1
azure-mgmt-nspkg 3.0.2
azure-mgmt-scheduler 2.0.0
azure-mgmt-search 2.1.0
azure-mgmt-servicebus 0.5.3
azure-mgmt-servicefabric 0.2.0
azure-mgmt-signalr 0.1.1
azure-mgmt-subscription 0.2.0
azure-mgmt-trafficmanager 0.50.0
azure-mgmt-web 0.35.0
azure-nspkg 3.0.2
azure-storage-blob 12.9.0
azure-storage-common 2.1.0
backcall 0.2.0
certifi 2021.10.8
cffi 1.15.0
charset-normalizer 2.0.9
click 8.0.4
colorama 0.4.4
cryptography 36.0.1
cycler 0.11.0
debugpy 1.5.1
decorator 5.1.0
entrypoints 0.3
fonttools 4.28.5
idna 3.3
ipykernel 6.6.0
ipython 7.30.1
isodate 0.6.1
itsdangerous 2.1.0
jedi 0.18.1
Jinja2 3.0.3
jupyter-client 7.1.0
jupyter-core 4.9.1
msrest 0.6.21
msrestazure 0.6.4
nest-asyncio 1.5.4
numpy 1.21.5
oauthlib 3.2.0
packaging 21.3
pandas 1.3.5
parso 0.8.3
pickleshare 0.7.5
Pillow 8.4.0
pip 22.0.3
prompt-toolkit 3.0.24
pycparser 2.21
pydocumentdb 2.3.5
Pygments 2.11.0
PyJWT 2.3.0
pymongo 4.0.1
pyparsing 3.0.6
python-dateutil 2.8.2
python-dotenv 0.19.2
pytz 2021.3
pywin32 303
pyzmq 22.3.0
requests 2.26.0
requests-oauthlib 1.3.1
But im getting Import "azure.storage.blob" could not be resolved
How can I solve this problem??
UPDATE: It just don't work in my .venv and under lib/site-package/azure there is not "storage" folder
Try either of the following ways to resolve Import "azure.storage.blob" could not be resolved error:
1. If you are using visual studio code, try following command to install azure-storage-blob:
conda install -c anaconda azure conda install -c conda-forge azure-storage-blob
2. Uninstall older version of azure-storage-blob’ and reinstall: pip uninstall azureandpip uninstall azure-storage`
Reinstall at the specific path:
cdd .venv
pip install azure-storage –upgrade
References: Unresolved import 'azure.storage.blob' when trying to use Python library azure-storage-blob , How to import Azure BlobService in python? and Install Azure Python api on linux: importError: No module named storage.blob
Thanks to everyone I solved recreating .venv
pip3 list
Package Version
------------------- ------------
apipkg 1.5
apparmor 3.0.3
appdirs 1.4.4
asn1crypto 1.4.0
brotlipy 0.7.0
certifi 2021.5.30
cffi 1.14.6
chardet 4.0.0
cmdln 2.0.0
configobj 5.0.6
createrepo-c 0.17.3
cryptography 3.3.2
cssselect 1.1.0
cupshelpers 1.0
cycler 0.10.0
decorator 5.0.9
idna 3.2
iniconfig 0.0.0
isc 2.0
joblib 1.0.1
kiwisolver 1.3.1
LibAppArmor 3.0.3
lxml 4.6.3
matplotlib 3.4.3
mysqlclient 2.0.3
nftables 0.1
notify2 0.3.1
numpy 1.21.1
opi 2.1.1
ordered-set 3.1.1
packaging 20.9
pandas 1.3.1
Pillow 8.3.1
pip 20.2.4
ply 3.11
psutil 5.8.0
py 1.10.0
pyasn1 0.4.8
pycairo 1.20.1
pycparser 2.20
pycups 2.0.1
pycurl 7.43.0.6
PyGObject 3.40.1
pyOpenSSL 20.0.1
pyparsing 2.4.7
pysmbc 1.0.23
PySocks 1.7.1
python-dateutil 2.8.2
python-linux-procfs 0.6
pytz 2021.1
pyudev 0.22.0
requests 2.25.1
rpm 4.16.1.3
scikit-learn 0.24.2
scipy 1.7.1
setuptools 57.4.0
six 1.16.0
sklearn 0.0
slip 0.6.5
slip.dbus 0.6.5
termcolor 1.1.0
threadpoolctl 2.2.0
torch 1.9.0+cu111
torchaudio 0.9.0
torchvision 0.10.0+cu111
tqdm 4.62.1
typing-extensions 3.10.0.0
urllib3 1.26.6
Above shows my installed modules, but when i go into the project folder, and run the shell script, I get:
Traceback (most recent call last):
File "main.py", line 3, in <module>
import torch
ImportError: No module named torch
Even though in the list above it clearly shows that torch is installed.
Please help. My $PATH is /usr/bin/python:/home/anthony/bin:/usr/local/bin:/usr/bin:/bin:/snap/bin
and my printenv PYTHONPATH is :/usr/bin/python
Let me know if you need any other print outs, I've tried everything, and nothing seems to be working. I am working mainly in pycharm.
It is very likely that pip3 is pointing to a different python instance.
Imagine you had python, python3, python3.6 and python3.8 all installed on your system. Which one would pip3 install packages for? (who knows?)
It is almost always safer to do python3.8 -m pip list/install since you can be sure that python3.8 somefile.py will be using the same files you just saw. (even better, do python3.8 -m venv /path/to/some/virtualenv and then make sure that is activated, then you can be sure pip points to the same python)
Swig within anaconda environment on Mac OS throws Fatal Python error: PyThreadState_Get: no current thread
I'm looking for a solution using swig and conda on Mac OS X.
The code is based on this github example, which works well on Linux 16.04 but fails on Mac OS X
https://github.com/rdeits/swig-eigen-numpy
It works outside the conda environment, but not inside of it.
This is my current environment conda list
asn1crypto 0.24.0 py36_0
bokeh 0.12.13 py36h2f9c1c0_0
bzip2 1.0.6 hd86a083_4
ca-certificates 2018.03.07 0
certifi 2018.4.16 py36_0
cffi 1.11.5 py36h342bebf_0
chardet 3.0.4 py36h96c241c_1
click 6.7 py36hec950be_0
cmake 3.9.4 h30c3106_0
cryptography 2.2.2 py36h1de35cc_0
curl 7.59.0 ha441bb4_0
cycler 0.10.0 py36hfc81398_0
expat 2.2.5 hb8e80ba_0
fastdtw 0.3.2 <pip>
flask 0.12.2 py36h5658096_0
freetype 2.8 h12048fb_1
gcloud 0.18.3 <pip>
gevent 1.2.2 py36ha70b9d6_0
googleapis-common-protos 1.5.3 <pip>
greenlet 0.4.13 py36h1de35cc_0
httplib2 0.11.3 <pip>
idna 2.6 py36h8628d0a_1
intel-openmp 2018.0.0 8
itsdangerous 0.24 py36h49fbb8d_1
jinja2 2.9.6 py36hde4beb4_1
libcurl 7.59.0 hf30b1f0_0
libcxx 4.0.1 h579ed51_0
libcxxabi 4.0.1 hebd6815_0
libedit 3.1 hb4e282d_0
libffi 3.2.1 h475c297_4
libgfortran 3.0.1 h93005f0_2
libpng 1.6.34 he12f830_0
libssh2 1.8.0 h322a93b_4
libuv 1.20.0 h1de35cc_0
livereload 2.5.1 <pip>
markupsafe 1.0 py36h3a1e703_1
matplotlib 2.0.2 py36h507e440_1
mkl 2018.0.2 1
ncurses 6.0 hd04f020_2
numpy 1.13.1 py36h93d791d_2
oauth2client 4.1.2 <pip>
openssl 1.0.2o h26aff7b_0
pandas 0.20.3 py36hd6655d8_2
patsy 0.5.0 py36_0
pcre 8.42 h378b8a2_0
pip 9.0.3 py36_0
protobuf 3.5.2.post1 <pip>
pyasn1 0.4.2 <pip>
pyasn1-modules 0.2.1 <pip>
pycparser 2.18 py36h724b2fc_1
pyopenssl 17.5.0 py36h51e4350_0
pyparsing 2.2.0 py36hb281f35_0
pysocks 1.6.8 py36_0
python 3.6.5 hc167b69_0
python-dateutil 2.6.1 py36h86d2abb_1
pytz 2017.2 py36h2e7dfbc_1
pyyaml 3.12 py36h2ba1e63_1
readline 7.0 hc1231fa_4
requests 2.18.4 py36h4516966_1
rhash 1.3.5 h3aa0507_1
rsa 3.4.2 <pip>
scipy 1.0.0 py36h1de22e9_0
setuptools 39.0.1 py36_0
six 1.11.0 py36h0e22d5e_1
sqlite 3.23.1 hf1716c9_0
statsmodels 0.8.0 py36h9c68fc9_0
swig 3.0.8 1
tk 8.6.7 h35a86e2_3
tornado 5.0.2 py36_0
urllib3 1.22 py36h68b9469_0
werkzeug 0.14.1 py36_0
wheel 0.31.0 py36_0
xz 5.2.3 h727817e_4
yaml 0.1.7 hc338f04_2
zlib 1.2.11 hf3cbc9b_2
I found a pointer to an answer on the anaconda support forum https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/057P4uNWyCU
The python 3.6 binary that ships with anaconda is statically linked with the python libs. Thats why loading a library that dynamically links to them fails due to duplicate symbols. The solution was not to link the library with python libs.
The magic part (it feels like a workaround) is in the SwigPython.cmake file
if(APPLE)
swig_link_libraries(${target} ${swigpy_LINK_LIBRARIES})
set_target_properties(${SWIG_MODULE_${target}_REAL_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
swig_link_libraries(${target} ${swigpy_LINK_LIBRARIES} ${PYTHON_LIBRARIES})
endif()