Search code examples
pythonjupyter-notebookpmdarima

How can i install pmdarima in jupiter lite


I am using Jupiter lite (https://jupyter.org/try-jupyter/lab/index.html)

I need to install pmdarima.

I write import pmdarima but i receive the following error


ModuleNotFoundError Traceback (most recent call last) Cell In[79], line 1 ----> 1 import pmdarima

ModuleNotFoundError: No module named 'pmdarima'

I write

pip install pmdarima

but i get

module 'pexpect' has no attribute 'TIMEOUT'

Any help would be appreciated.

BR,

Andreas


Solution

  • At this time that won't work.

    In theory, the command to install that would be %pip install -q pmdarima that you run in a cell inside the notebook where you want to use the package. See here for more about that. That syntax structure will work with many packages. Just substitute the package name.

    However, not all packages that work in a typical, full Python-based kernel with a pyodide-based kernel that underlies JupyterLite. This is one of them. If you run that command, you'll see the following:

    ValueError: Can't find a pure Python 3 wheel for 'pmdarima'.
    See: https://pyodide.org/en/stable/usage/faq.html#micropip-can-t-find-a-pure-python-wheel
    You can use `micropip.install(..., keep_going=True)`to get a list of all packages with missing wheels.
    

    It tells you there how to get more information. And if you wanted to and are capable to build the wheels and add it, see here. Otherwise you need to use a typical, full Python-based kernel and cannot use JupyterLite if you cannot do your work without that package at this time. Things keep developing and new packages are added.


    An option to use that package without installing anything on your machine or logging in:

    To use the package right in your browser alone with a typical, full Python-based kernel without installing anything on your machine or logging in anywhere, go to here and press the 'launch binder' badge. When the temporary JupyterLab session opens that is being served by the MyBinder.org service opens, click on the tile in under 'Notebook' in the main pane on the right to open a Python3-based (ipykernel)-backed notebook and enter in a new cell %pip install pmdarima (or %pip install -q pmdarima) and let the process run. It will let you know when it is done running by saying you may need to restart the kernel to use the package. Under kernel, choose to restart the kernel. Then you can enter in a new cell the first eight lines from first example from under 'Quickstart Examples' from here and run the example portion that includes importing pmdarima and using train_test_split() from pmdarima.model_selection to split the data to train and test sets.

    Note that the computational resources of the MyBinder-based session may not be enough to do anything substantial; however, you can at least observe that the package can install with pip alone.

    Be aware the remote anonymous session is temporary and will time out after inactivity, and so if you make anything useful download it back to your own local machine. There is also an icon with a cloud that let's you back it up in your browser cache. However, the most safe way is you have it where you can access it on your normal local drive as the browser cache isn't accessible. There is no way to recover content if you didn't take steps while the session was active.