How to enable code completation on jupyter? - jupyter

I'm experiencing a very strange problem.
The code completetion is not working on my jupyter.
I have installed it at least 3 times, two manually and the last one via Anaconda.
I tried to use it on Chrome and Edge with no sucess.
I'm using it on Windows 10
Here goes the startup messages
[W 09:48:06.701 LabApp] Error loading server extension jupyter_nbextensions_configurator
Traceback (most recent call last):
File "C:\Anaconda3\envs\tf\lib\site-packages\notebook\notebookapp.py", line 1942, in init_server_extensions
mod = importlib.import_module(modulename)
File "C:\Anaconda3\envs\tf\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'jupyter_nbextensions_configurator'
[W 09:48:06.704 LabApp] Error loading server extension jupyter_tabnine
Traceback (most recent call last):
File "C:\Anaconda3\envs\tf\lib\site-packages\notebook\notebookapp.py", line 1942, in init_server_extensions
mod = importlib.import_module(modulename)
File "C:\Anaconda3\envs\tf\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'jupyter_tabnine'
[I 09:48:07.134 LabApp] JupyterLab extension loaded from C:\Anaconda3\envs\tf\lib\site-packages\jupyterlab
[I 09:48:07.135 LabApp] JupyterLab application directory is C:\Anaconda3\envs\tf\share\jupyter\lab
[I 09:48:07.142 LabApp] Serving notebooks from local directory: D:\Dev\Bolsa\src
[I 09:48:07.142 LabApp] Jupyter Notebook 6.1.4 is running at:
[I 09:48:07.143 LabApp] http://localhost:8888/?token=315a13e878a473d4f11f55f0d623240071060f151731429d
[I 09:48:07.144 LabApp] or http://127.0.0.1:8888/?token=315a13e878a473d4f11f55f0d623240071060f151731429d
[I 09:48:07.145 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:48:07.284 LabApp]
As you can see it is trying to load tabnine and jupyter_nbextensions_configurator, I'd installed it on the first jupyter installation, and I don't know why after two new jupyter installations and uninstall both of them jupyter still trying to load it.
Does anyone have any idea of what is happening?
Thanks

I could not find a solution for this problem, but I found a workaround.
I'd install the Python extension on VScode and then I'd open the jupyter notebook in there. So the code completation is working like a charm.
Here goes the instructions to open jupyter notebook on VSCode
https://code.visualstudio.com/docs/python/jupyter-support

Related

Virtual serial SPI port WSL2

i am using a Python module for a LED strip (APA102), that communicates over my Raspberry Pi's SPI pins. When I execute scripts on my WSL2 locally (since I don't have my Pi always with me), i get an exception when trying to import the apa102_pi module with the following traceback:
WARNING: GENERIC_X86 is not fully supported. Some features may not work.
WARNING: GENERIC_X86 is not fully supported. Some features may not work.
Traceback (most recent call last):
File "/home/michael/.pyenv/versions/apa_env/bin/apa102_server", line 33, in <module>
sys.exit(load_entry_point('michaelstuffer98.apa102-tcp-server==0.0.0', 'console_scripts', 'apa102_server')())
File "/home/michael/.pyenv/versions/apa_env/bin/apa102_server", line 25, in importlib_load_entry_point
return next(matches).load()
File "/home/michael/.pyenv/versions/3.9.15/lib/python3.9/importlib/metadata.py", line 86, in load
module = import_module(match.group('module'))
File "/home/michael/.pyenv/versions/3.9.15/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/home/michael/.pyenv/versions/3.9.15/envs/apa_env/lib/python3.9/site-packages/apa102_tcp_server/led_audio_controller.py", line 3, in <module>
from apa102_tcp_server.apa_led import LedStrip
File "/home/michael/.pyenv/versions/3.9.15/envs/apa_env/lib/python3.9/site-packages/apa102_tcp_server/apa_led.py", line 1, in <module>
from apa102_pi.driver import apa102
File "/home/michael/.pyenv/versions/3.9.15/envs/apa_env/lib/python3.9/site-packages/apa102_pi/driver/apa102.py", line 10, in <module>
from microcontroller.pin import spiPorts
ImportError: cannot import name 'spiPorts' from 'microcontroller.pin' (/home/michael/.pyenv/versions/3.9.15/envs/apa_env/lib/python3.9/site-packages/microcontroller/pin.py)
This happens imo because I don't have serial pins available. I already worked with pseudo-terminals before, is it possible to create a workaround with that, or is there another a possibility to create this interface virtually? I actually don't really need the functionality (still would be nice to have that too), but only want to make importing the module work.

Why isn't Juypter notebook working on my raspberry pi

I have installed Jupyter notebook on a fresh install of debian for pi. I had it working perfectly on a previous install. I do not understand why it is not working on this install. Kernal will not start.
#raspberrypi:~ $ jupyter notebook
[I 14:14:54.030 NotebookApp] Serving notebooks from local directory: /home/pi
[I 14:14:54.031 NotebookApp] The Jupyter Notebook is running at:
[I 14:14:54.031 NotebookApp] http://localhost:8888/?token=3d0f751a532a4e1a3744a1a49701fbde9a17d1d95fda43ca
[I 14:14:54.032 NotebookApp] or http://127.0.0.1:8888/?token=3d0f751a532a4e1a3744a1a49701fbde9a17d1d95fda43ca
[I 14:14:54.033 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 14:14:54.249 NotebookApp]
To access the notebook, open this file in a browser:
file:///home/pi/.local/share/jupyter/runtime/nbserver-837-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=3d0f751a532a4e1a3744a1a49701fbde9a17d1d95fda43ca
or http://127.0.0.1:8888/?token=3d0f751a532a4e1a3744a1a49701fbde9a17d1d95fda43ca
[I 14:15:26.196 NotebookApp] Kernel started: 9c892a78-7ef2-4d36-9649-d46392e26bb7
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "/usr/lib/python3/dist-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/usr/lib/python3/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' from 'prompt_toolkit.shortcuts' (/usr/local/lib/python3.7/dist-packages/prompt_toolkit/shortcuts/__init__.py)
[I 14:15:32.162 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "/usr/lib/python3/dist-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/usr/lib/python3/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' from 'prompt_toolkit.shortcuts' (/usr/local/lib/python3.7/dist-packages/prompt_toolkit/shortcuts/__init__.py)
[I 14:15:35.190 NotebookApp] KernelRestarter: restarting kernel (2/5), keep random ports
$
Is anyone able to shine some light on my situation?
change the ownership of the ~/.local/share/jupyter directory from root to pi using below cmd:
sudo chown -R pi:pi ~/.local/share/jupyter
Please Run this command if your kernel does not start or shows any issue it worked for me
"pip3 install --force-reinstall --upgrade jupyter"

odoo.service.server: Failed to load server-wide module `web`

I am getting this error during starting the server after installation of odoo 11.
I am using ubuntu 18.04
my config file is like this
*
[options]
; This is the password that allows database operations:
;admin_passwd = admin
db_host = 127.0.0.1
db_port = 8069
db_user = odoo
db_password = 123
addons_path = /opt/odoo/addons,/opt/odoo/odoo/addons
logfile = /var/log/odoo/odoo-server.log
*
Full error is something like this
2020-02-07 05:12:33,809 12706 CRITICAL ? odoo.modules.module: Couldn't load module web
2020-02-07 05:12:33,809 12706 CRITICAL ? odoo.modules.module: The 'odoo.addons.web' package was not installed in a way that PackageLoader understands.
2020-02-07 05:12:33,809 12706 ERROR ? odoo.service.server: Failed to load server-wide module `web`.
The `web` module is provided by the addons found in the `openerp-web` project.
Maybe you forgot to add those addons in your addons_path configuration.
Traceback (most recent call last):
File "/opt/odoo/odoo/service/server.py", line 984, in load_server_wide_modules
odoo.modules.module.load_openerp_module(m)
File "/opt/odoo/odoo/modules/module.py", line 368, in load_openerp_module
__import__('odoo.addons.' + module_name)
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/opt/odoo/odoo/modules/module.py", line 82, in load_module
exec(open(modfile, 'rb').read(), new_mod.__dict__)
File "<string>", line 4, in <module>
File "/opt/odoo/addons/web/controllers/__init__.py", line 4, in <module>
from . import main, pivot
File "/opt/odoo/addons/web/controllers/main.py", line 56, in <module>
loader = jinja2.PackageLoader('odoo.addons.web', "views")
File "/home/sandip/.local/lib/python3.6/site-packages/jinja2/loaders.py", line 290, in __init__
" PackageLoader understands." % package_name
ValueError: The 'odoo.addons.web' package was not installed in a way that PackageLoader understands.
It's actually a bug inside Jinja2. Update it to version 2.11.2
You might be blocked by a missing parameter in your config file.
Try to add the following parameter in the file:
server_wide_modules = web
It is a requirement for the installation to go through peacefully.
Hope it helps
Please check your jinja version
maybe wrong with your version jinja
uninstall them
sudo pip3 uninstall Jinja2
then install with right version
sudo pip3 install Jinja2==2.10.1

"import matlab.engine" works on linux command line but not in Spyder

Matlab engine for python (r2016a) appears to be installed and working with python. I can do the following from a bash prompt:
$ python
Python 3.4.5 |Anaconda 4.3.1 (64-bit)| (default, Jul 2 2016, 17:47:47)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matlab.engine
>>> eng = matlab.engine.start_matlab()
>>> eng.abs(-1)
1
>>> exit()
Next I start Spyder (typing "spyder &" from the same bash prompt) and this is what I get trying the same thing from within Spyder:
Python 3.4.5 |Anaconda 4.3.1 (64-bit)| (default, Jul 2 2016, 17:47:47)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matlab.engine
Traceback (most recent call last):
File "/home/XXX/anaconda3/envs/mr2/lib/python3.4/site-packages/matlab/engine/__init__.py", line 42, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "/home/XXX/anaconda3/envs/mr2/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked
ImportError: No module named 'matlabengineforpython3_4'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/XXX/anaconda3/envs/mr2/lib/python3.4/site-packages/matlab/engine/__init__.py", line 58, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "/home/XXX/anaconda3/envs/mr2/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1191, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1161, in _load_backward_compatible
File "<frozen importlib._bootstrap>", line 539, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1715, in load_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
ImportError: /opt/local/matlab2016a/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../bin/glnxa64/libicuio.so.54: undefined symbol: _ZN6icu_5413UnicodeString9doReplaceEiiPKDsii
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/XXX/anaconda3/envs/mr2/lib/python3.4/site-packages/matlab/engine/__init__.py", line 61, in <module>
'MathWorks Technical Support for assistance: %s' % e)
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: /opt/local/matlab2016a/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../bin/glnxa64/libicuio.so.54: undefined symbol: _ZN6icu_5413UnicodeString9doReplaceEiiPKDsii
>>>
Using IPython instead of python gives similar results but with a less informative error. It's clear that Spyder can't find the module matlabengineforpython3_4 but I don't know where to go from there.
How can I get the MATLAB engine to work correctly from within spyder?
This issue might be due to an incompatibility between the libstdc++ shipped with MATLAB and the libstdc++ shipped with the system that the spyder was linked against.
"CXXABI_1.3.9 not found" error message indicates that the libstdc++.so.6 library that is included with MATLAB is missing ABI versions the system needs to draw graphical content.
This is caused because the version of this particular library packaged with MATLAB is older than the versions that come with newer Linux operating systems, which causes compatibility issues.
You can try the following workarounds:
Renaming the libstdc++.so.6 library file so that MATLAB cannot find it and is forced to use the system's version of the library. This file is located in matlabroot/sys/os/glnxa64 . Renaming it to libstdc++.so.6.old should suffice. (where "matlabroot" is root installation directory of MATLAB)
Forcing MATLAB to load the system version by setting the $LD_PRELOAD environment variable to the newer version of libstdc++.
Also, since you are trying to call an external program from MATLAB, this may be a third party issue. But, you can try setting the library paths correctly in 'LD_LIBRARY_PATH' system variable.
find / -name "libstdc++.so*"
I found that calling matlab with the command LD_PRELOAD=/usr/lib64/libstdc++.so.6 matlab -desktop seems to solve the issue
in order to avoid having to type this command every time I also assigned an alias on my .bashrc file alias matlab="LD_PRELOAD=/usr/lib64/libstdc++.so.6 /usr/local/bin/matlab -desktop"
https://cn.mathworks.com/matlabcentral/answers/329796-issue-with-libstdc-so-6

I am using jupyter notebook, ipython 3 on windows. Whenever i am starting my python 3, i get the "Kernel Dead" message

Dead kernel
The kernel has died, and the automatic restart has failed. It is possible the kernel cannot be restarted.
If you are not able to restart the kernel, you will still be able to save the notebook, but running code will no longer work until the notebook is reopened.
the above message is shown in notebook dashboard after i start python3.
[I 23:07:08.365 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 9938cea3-6528-4a27-b4c3-ee906d748bfb restarted
Traceback (most recent call last):
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\runpy.py"
, line 170, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\runpy.py"
, line 85, in _run_code
exec(code, run_globals)
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\ipykernel\__main__.py", line 3, in <module>
app.launch_new_instance()
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\traitlets\config\application.py", line 588, in launch_instance
app.initialize(argv)
File "<decorator-gen-123>", line 2, in initialize
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\traitlets\config\application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\ipykernel\kernelapp.py", line 417, in initialize
self.init_io()
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\ipykernel\kernelapp.py", line 316, in init_io
self.patch_io()
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\ipykernel\kernelapp.py", line 326, in patch_io
faulthandler_register = faulthandler.register
AttributeError: module 'faulthandler' has no attribute 'register'
[W 23:07:11.369 NotebookApp] KernelRestarter: restart failed
[W 23:07:11.369 NotebookApp] Kernel 9938cea3-6528-4a27-b4c3-ee906d748bfb died, r
emoving from map.
ERROR:root:kernel 9938cea3-6528-4a27-b4c3-ee906d748bfb restarted failed!
[W 23:07:11.390 NotebookApp] Kernel deleted before session
[W 23:07:11.392 NotebookApp] 410 DELETE /api/sessions/1cca4919-305f-4b4f-acdd-b2
a614fd2638 (::1) 3.00ms referer=http://localhost:8888/notebooks/Untitled.ipynb?k
ernel_name=python3
In command prompt i get the above shown message. What is the problem in the faulthandler module. How should I rectify it? I installed jupyter notebook by using "pip". I am new to python programming and also jupyter. please help me resolve this.
We accidentally made a release of the ipykernel package which doesn't work on Python 3.5 on Windows. Once we realised this, we made a new release (version 4.3.1) to fix it.
You can upgrade by running:
pip install --upgrade ipykernel
If you had installed ipykernel using conda, the command would be:
conda update ipykernel