'How can I get file access in JupyterLab running over the web, which is giving me many errors?

Update: I conclude from discussions with others that this is a genuine bug; the web versions of JupyterLab do not currently allow you to access files.

When I run JupyterLab over the web, e.g. from Jupyter.org/try, I have several difficulties with files. I think something got corrupted -- how can I get a normal JupyterLab environment? Here are some of the problems:

1) I can not access files from my machine. The command os.chdir("C:") gives the error

FileNotFoundError: [Errno 44] No such file or directory: 'C:'

2) I can not access files from the web. First the command import pandas as pd gives the error

Could not import the lzma module. Your installed Python is incomplete

Then the command pd.read_csv("https://data.nasa.gov/api/views/7qz6-zrqt/rows.csv") (which reads a readily accessible csv file) gives the error

URLError: <urlopen error unknown url type: https>

3) I can not access the files that I upload into the folders visible at left of the screen. The command pwd returns '/home/pyodide' but no amount of moving around from that directory seems to get me to a directory with the files I uploaded or the notebooks I created.

4) I can not delete some of the files visible in the folders at the left of the screen. E.g.: I don't remember uploading or modifying the file "Lorenz.ipynb". I try to delete it, and I press "Delete" at this screen, but the file remains.

enter image description here

I also have JupyterLab installed directly on my machine, where it runs without these problems -- but I am trying to convince people that JupyterLab by web is an easy way of getting into Python, and these errors are preventing that. How can I get JupyterLab working normally over the web?



Solution 1:[1]

Sorry, I (and others) didn't see your question earlier. I'm going to largely refer you to where similar things are discussed more recently as this is a very rapidly developing niche.
The short answer is I would suggest not yet encouraging those just get getting into Python to use JupyterLite, which is what you are referring to when you say, "When I run JupyterLab over the web, e.g. from Jupyter.org/try,"[at this time]. You'll note that there and at the JupyterLite site itself it status is stated as "experimental", "cutting-edge", "unofficial", etc.

How can I get JupyterLab working normally over the web?

Go to here and click launch binder. This will give you a temporary session that will time out after ten minutes inactivity on a remote linux-based machine. The Jupyter in use there is full Python-backed. You can upload files by dragging them in the file navigator and you can download new or modified files from the remote machine back to your system. I go more into using it here. Make sure you note there is a safety net for notebooks even if the session times out.

At this time you'll have a better experience directing folks to MyBinder-served sites with full Python kernels on actual remote machines to address your desire "to convince people that JupyterLab by web is an easy way of getting into Python".


If you want to keep using JupyterLite some, please check out the caveats referring to some of the issues you encountered (and more) at the following places:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1