Jupyterlab and Plotly offline: requirejs is not defined - python

I installed plot.ly using conda and tried to use it in offline mode on Jupyterlab:
from plotly.offline import init_notebook_mode
init_notebook_mode(connected=True)
The Firefox developer console displays the following error after those statements:
ReferenceError: requirejs is not defined
I tried to manually put require.js into the folder with the notebook and into ...\anaconda3\pkgs\jupyter\nbextensions, it didn't work.
How do I solve this issue? How do I install require.js properly?
Versions:
Python 3.6.6
Plotly 3.4.2
Jupyterlab 0.35.4
Windows 10
Firefox 64.0.2
nodejs 10.15.0

Please see Yan Ulms answer: the plotly extension for Jupyter Lab is deprecated
Old answer:
You need to install the plotly extension for Jupyter Lab, as mentioned by #byouness.
A common pitfall in the installation is that you need to have a recent Node.js installation. This might be the cause of your error write EPROTO 1172:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:openssl\ssl\record\ssl3_record.c:252. Re-installing Node.js might be an easy fix.
Your company firewall might indeed be a problem. Because the installation of the extension uses NPM (node.je package manager), you should check Common proxy and networking problems for NPM. You might need to install the extension manually, by following the installation instructions for developers.
I definitely agree that the process is much more difficult than it should be. Installing it at my company was also a struggle. Good luck!

The JupyterLab readme on GitHub says that the #jupyterlab/plotly-extension is being deprecated. Please use the Plotly-supported jupyterlab-plotly. See the plotly.py README for more info.

Related

How to install ExecuteTime extension of Jupyter notebook?

I installed Jupiter Notebook extensions according to https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/install.html but the ExecuteTime one isn't working. It shows the message 'This nbextension is disabled in the notebook json config, but doesn't provide a yaml file to tell us how to configure it. You can still enable or disable it from here, though'. However, the folder execute_time in nbextensions contains file ExecuteTime.yaml. I am on MacOS.
Uninstall/reinstall doesn't help. I have looked for the answer across a lot of threads but there is no solution to this.
Does someone have a clue to that problem?
You should enable the execution time. For this:
pip install jupyterlab_execute_time
Then, reload the jupyterlab page.
Finally, go to the notebook section in jupyterlab advanced settings and paste:
{"recordTiming" : true,}
If it didn’t work visit: https://github.com/deshaw/jupyterlab-execute-time/tree/master/jupyterlab_execute_time

Open Jupyter in VSCode: TypeError: Cannot read properties of undefined (reading 'makeSettings')

System: MacOSX 10.15,
VSCode Version: 1.67.2,
Python Kernel Version: 3.8.13 (Conda base).
I created a new Jupyter notebook in my VSCode using command shortcut and selected the right python kernel showed above. The empty notebook page is well loaded and no error message occurred.
But when I typed and ran any code in the cell, this error message showed up below the cell.
Then I clicked the "log" link and the error log showed up and it was like this:
And hence I couldn't run any code in the notebook cell. Then I changed to another Python Kernel (3.9.12) of the same notebook, it showed the same error message:
Please give me a solution to overcome this bug.
Update: I tried to reinstall pyzmq to an older version in the canda base environment and it didn't change anything. Then I typed command jupyter --version and everything is well installed.
Update: I have searched on Github Issues of VSCode. There are two similar issues that are all caused by some extensions, one is called "Gitduck"(now renamed "duckly"), the other is "nur.Script". The link to these issues are here:
Cannot read property 'makeSettings' of undefined #834
Cannot read property 'makeSettings' of undefined #128458
But unfortunately, I never have installed any of these extensions in my VSCode. So it may be caused by a similar extension but I still don't know the name.
Finally, I use the command code --list-extensions to list all my installed extensions here, maybe helpful for filtering which extension is the bad guy:
Final Update: Today (05/31) I opened VSCode and tentatively created an empty Jupyter notebook, and this problem has gone away. I have done nothing, maybe VSCode's auto-update has solved this problem. Case closed.
You can try reinstalling the pyzmq module.
pip uninstall pyzmq
pip install pyzmq==19.0.2
Hope this helps you.

How to install previous version of Python extension for VSCode

I would like to install previous version of Python extension for VSCode (ms-python.python) to troubleshoot something, but when I am trying to use context menu with "Install another version..." I just have an error "server returned 404"
You need to install it from a .vsix file. You can find them here.
Download the .vsix file of the version you want. You may have to click assets to see them.
Then open VSCode, go to extensions -> click on the three dots -> install from vsix and select your file.
To install the .vsix you can also use the command
code --install-extension ms-python-release.vsix
sources :
- How can I install Visual Studio Code extensions offline?
- https://code.visualstudio.com/docs/editor/extension-gallery#_install-from-a-vsix
This can be done using "Install Another Version" option available with VS Code extension store.
Go to extensions.
Click on Gear Icon for the installed extension
Click on Install Another Version
And select the version you wish to install
The 404 issue is a bug in the VS Code marketplace. They are actively working to fix the problem.

How can I make this script run

I found this script (tutorial) on GitHub (https://github.com/amyoshino/Dash_Tutorial_Series/blob/master/ex4.py) and I am trying to run in my local machine.
Unfortunately I am having and Error
I would really appreciate if anyone can help me to run this script.
Perhaps this is something easy but I am new in coding.
Thank you!
You probably just need to pip install the dash-core-components library!
Take a look at the Dash Installation documentation. It currently recommends running these commands:
pip install dash==0.38.0 # The core dash backend
pip install dash-html-components==0.13.5 # HTML components
pip install dash-core-components==0.43.1 # Supercharged components
pip install dash-table==3.5.0 # Interactive DataTable component (new!)
pip install dash-daq==0.1.0 # DAQ components (newly open-sourced!)
For more info on using pip to install Python packages, see: Installing Packages.
If you have run those commands, and Flask still throws that error, you may be having a path/environment issue, and should provide more info in your question about your Python setup.
Also, just to give you a sense of how to interpret this error message:
It's often easiest to start at the bottom and work your way up.
Here, the bottommost message is a FileNotFound error.
The program is looking for the file in your Python37/lib/site-packages folder. That tells you it's looking for a Python package. That is the directory to which Python packages get installed when you use a tool like pip.

Autocompletion not working in virtual environment pycharm

I am currently working on a Django Project and installed djangorestframework on my installed apps. My pip freeze file you can see below:
Django==1.9.2
django-filter==0.12.0
djangorestframework==3.3.2
djangorestframework-jwt==1.7.2
eventbrite==3.3.3
Markdown==2.6.5
Pygments==2.1
PyJWT==1.4.0
requests==2.9.1
wheel==0.24.0
My project python interpreter is also pointing to the right directory
But the issue is auto completion feature is not working for djangorestframework, as you can see below. Pycharm is not recognizing my imports here.
I have also enabled Django Support in Pycharm.
Could anyone suggest me what should I do to enable autocompletion here? Thank you
Okay my issue is resolved
1 - Go to `file --> Invalidate Caches/Restart`
2- Wait for Pycharm to build new indexes
3- Then try to import your python modules.
It worked for me :)

Categories