Trouble with pip installation

You don’t seem to be using the right approaches in two significant ways.

First, you should be using %pip install everywhere in modern Jupyter. The exclamation point use in conjunction with install commands was replaced with a modern magic version in 2019 to ensure the installation occurs in the specific environment where the kernel is running. Installing with an exclamation point doesn’t do that and was leading to issues commonly. See more about the modern %pip install command here. The second paragraph here goes into more details about why the exclamation point may lead to issues. Importantly, this works now everywhere in modern Jupyter, including JupyterLite and Google Colab, which segues to the second and perhaps more important issue…

Second, I see emscripten there in your error traceback. This makes me think you are using JupyterLite with either the Pyodide-based kernel or Xeus-Python based kernel. Where are you running this code? On your own machine or on the internet? The critical information about what kernel is involved is cut off in your screenshot? (See below.) If you are using the highly experimental JupyterLite that runs on web assembly-based kernels that actually run in virtual machines buried deep in your browser and thus have limitations that a full typical, Python-based kernel running on a local machine or a remote virtual system don’t have. (See warnings here highlighted by shocking bolts around ‘Status’ and here indicated by ‘Experimental’ in bold between two warning danger symbols about the experimental nature of JupyterLite.) Several of these limitations make it important to use approaches associated witih that. As you found, an exclamation point won’t work to run shell commands here in your JupyterLite. Or at least I suspect this is the issue. Here is the documentation on how to install in JupyterLite specifically, and you’ll see it supports the way used in modern Jupyter that I referenced above.



Suggestions about posting in such forums:

Please don’t use screenshots to share code and error tracebacks. It is highly frowned upon in forums such as this for a number of reasons. One of them being it isn’t indexable/searchable by the systems used to organize how to find answers. Please read Getting good answers to your questions. I’d refer you especially under the section ‘Help others reproduce the problem’, in the link to How do I ask a good question? at the bottom there where it emphasizes in bold DO NOT post images of code, data, error messages, etc.

Another good point about screenshots is that they make you think you included all relevant information and often instead lead to you not sharing details you should describe in text of your question. For example, here you cut off the key feature, the kernel status indicator that shows up in the upper right & shows what kernel you are using, and so I am left to guess. Please endeavor to share all relevant information with those you wish to help you.

2 Likes