jupyterlab-desktop icon indicating copy to clipboard operation
jupyterlab-desktop copied to clipboard

Wrong Compiled Build for Mac M1 - Errors, Crashes, Faults, Unable to Load Custom Environment

Open mmangione opened this issue 2 years ago • 1 comments

Description

I am happily using Jupyterlab Desktop on my Mac Mini (Intel). I have been having issues with my Mac M1 Max.

  1. Directly following install, cannot set custom pip environment. Have to use prebuilt environment. (Using Jupyterlab 3.4.5 from pip)
  2. After installing prebuilt environment, unable to switch to my pip environment.
  3. Activity Monitor shows Jupyterlab trying to run in an Intel environment (not M1)

Reproduce

  1. Download and install the latest version of Jupyterlab Desktop (3.4.5-1 at the time of this writing).
  2. Launch Jupyterlab Desktop
  3. Attempt to use a custom pip environment.
  4. When that fails, install the prebuilt environment.
  5. After refresh and relaunch, attempt to switch to the same custom pip environment.
  6. Open Activity Monitor and inspect the Jupyterlab process.

Expected behavior

I would expect to be able to use my custom pip environment - just like I do on my Mac Mini (Intel).

Context

  • Operating System and version: MacOS Monterey 12.5.1
  • CPU: Mac M1 Max
  • Ram: 64 GB
  • JupyterLab-Desktop version: 3.4.5-1
  • Installer: .dmg
Troubleshoot Output
➜  jupyterlab-desktop ln -s /Applications/JupyterLab.app/Contents/MacOS/JupyterLab /usr/local/bin/jlab
ln: /usr/local/bin/jlab: Permission denied
So, I used sudo to symlink Jupyterlab Desktop.
➜  jupyterlab-desktop sudo  ln -s /Applications/JupyterLab.app/Contents/Resources/app/jlab /usr/local/bin/jlab
Then I attempted to run it.
➜  jupyterlab-desktop jlab --verbose 4
zsh: permission denied: jlab
Attempt to call it directly with the app. I am then able to get started. But, I develop this error upon trying to switch environments.
➜  jupyterlab-desktop /Applications/JupyterLab.app/Contents/MacOS/JupyterLab --verbose 4
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/jupyterlab/__main__.py", line 3, in 
    from jupyterlab.labapp import main
  File "/Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/jupyterlab/labapp.py", line 13, in 
    from jupyter_server.serverapp import flags
  File "/Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/jupyter_server/serverapp.py", line 60, in 
    from jupyter_client import KernelManager
  File "/Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/jupyter_client/__init__.py", line 8, in 
    from .asynchronous import AsyncKernelClient  # noqa
  File "/Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in 
    from .client import AsyncKernelClient  # noqa
  File "/Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/jupyter_client/asynchronous/client.py", line 6, in 
    from jupyter_client.channels import HBChannel
  File "/Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/jupyter_client/channels.py", line 12, in 
    import zmq.asyncio
  File "/Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/zmq/__init__.py", line 103, in 
    from zmq import backend
  File "/Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/zmq/backend/__init__.py", line 31, in 
    raise original_error from None
  File "/Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/zmq/backend/__init__.py", line 26, in 
    _ns = select_backend(first)
  File "/Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/zmq/backend/select.py", line 31, in select_backend
    mod = import_module(name)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/zmq/backend/cython/__init__.py", line 6, in 
    from . import (
ImportError: dlopen(/Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/zmq/backend/cython/_device.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace (_zmq_errno)
Here is the contents of that directory /Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/zmq/backend/cython/...
(notebooks_env) ➜  cython ls -lrt
total 4024
-rw-r--r--  1 micah.mangione  staff     140 Aug 29 11:20 __init__.pxd
-rw-r--r--  1 micah.mangione  staff     759 Aug 29 11:20 __init__.py
-rwxr-xr-x  1 micah.mangione  staff  180105 Aug 29 11:20 _device.cpython-38-darwin.so
-rwxr-xr-x  1 micah.mangione  staff  216551 Aug 29 11:20 _poll.cpython-38-darwin.so
-rwxr-xr-x  1 micah.mangione  staff  179298 Aug 29 11:20 _proxy_steerable.cpython-38-darwin.so
-rwxr-xr-x  1 micah.mangione  staff  159354 Aug 29 11:20 _version.cpython-38-darwin.so
-rw-r--r--  1 micah.mangione  staff     968 Aug 29 11:20 checkrc.pxd
-rw-r--r--  1 micah.mangione  staff    6867 Aug 29 11:20 constant_enums.pxi
-rwxr-xr-x  1 micah.mangione  staff  219225 Aug 29 11:20 context.cpython-38-darwin.so
-rw-r--r--  1 micah.mangione  staff    1408 Aug 29 11:20 context.pxd
-rwxr-xr-x  1 micah.mangione  staff  160087 Aug 29 11:20 error.cpython-38-darwin.so
-rw-r--r--  1 micah.mangione  staff    4564 Aug 29 11:20 libzmq.pxd
-rwxr-xr-x  1 micah.mangione  staff  278713 Aug 29 11:20 message.cpython-38-darwin.so
-rw-r--r--  1 micah.mangione  staff    2396 Aug 29 11:20 message.pxd
-rwxr-xr-x  1 micah.mangione  staff  431816 Aug 29 11:20 socket.cpython-38-darwin.so
-rw-r--r--  1 micah.mangione  staff    2104 Aug 29 11:20 socket.pxd
-rwxr-xr-x  1 micah.mangione  staff  179335 Aug 29 11:20 utils.cpython-38-darwin.so
Jupyterlab notebook itself seems to run just fine.
(notebooks_env) ➜  cython jupyter notebook
[I 2022-09-05 20:45:58.203 LabApp] JupyterLab extension loaded from /Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/jupyterlab
[I 2022-09-05 20:45:58.203 LabApp] JupyterLab application directory is /Users/micah.mangione/projects/cart/notebooks_env/share/jupyter/lab
[I 20:45:58.207 NotebookApp] Serving notebooks from local directory: /Users/micah.mangione/projects/cart/notebooks_env/lib/python3.8/site-packages/zmq/backend/cython
[I 20:45:58.207 NotebookApp] Jupyter Notebook 6.4.12 is running at:
[I 20:45:58.207 NotebookApp] http://localhost:8888/?token=f70037941b7215e02451ca3245a87bc2eebf2eb6ce22f94d
[I 20:45:58.207 NotebookApp]  or http://127.0.0.1:8888/?token=f70037941b7215e02451ca3245a87bc2eebf2eb6ce22f94d
[I 20:45:58.207 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 20:45:58.209 NotebookApp]
To access the notebook, open this file in a browser:
    file:///Users/micah.mangione/Library/Jupyter/runtime/nbserver-98932-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/?token=f70037941b7215e02451ca3245a87bc2eebf2eb6ce22f94d
 or http://127.0.0.1:8888/?token=f70037941b7215e02451ca3245a87bc2eebf2eb6ce22f94d
Logs (required for issues with loading, server and startup) main.log
➜  jupyterlab-desktop cat main.log
[2022-09-05 20:18:14.879] [info]  In production mode
[2022-09-05 20:18:14.889] [info]  Logging to file (/Users/micah.mangione/Library/Logs/jupyterlab-desktop/main.log) at 'false' level
[2022-09-05 20:18:15.062] [error] (node:92169) DeprecationWarning: findLogPath() is deprecated and will be removed in v5.
(Use `JupyterLab --trace-deprecation ...` to show where the warning was created)
[2022-09-05 20:18:15.324] [info]  feedURL https://update.electronjs.org/jupyterlab/jupyterlab-desktop/darwin-x64/3.4.5-1
[2022-09-05 20:18:15.324] [info]  requestHeaders { 'User-Agent': 'update-electron-app/2.0.1 (darwin: x64)' }
[2022-09-05 20:18:15.363] [error] Error: Command failed: ln -s /Applications/JupyterLab.app/Contents/Resources/app/jlab /usr/local/bin/jlab
ln: /usr/local/bin/jlab: Permission denied
at checkExecSyncError (node:child_process:835:11)
at Object.execSync (node:child_process:909:15)
at Object.execSync (node:electron/js2c/asar_bundle:5:12692)
at setupJLabCommand (/Applications/JupyterLab.app/Contents/Resources/app.asar/build/out/main/main.js:177:25)
at /Applications/JupyterLab.app/Contents/Resources/app.asar/build/out/main/main.js:192:9
at processTicksAndRejections (node:internal/process/task_queues:96:5)

[2022-09-05 20:18:15.388] [info] checking-for-update [2022-09-05 20:18:16.958] [info] update-not-available [2022-09-05 20:20:02.220] [info] In production mode [2022-09-05 20:20:02.230] [info] Logging to file (/Users/micah.mangione/Library/Logs/jupyterlab-desktop/main.log) at 'false' level [2022-09-05 20:20:02.391] [error] (node:92805) DeprecationWarning: findLogPath() is deprecated and will be removed in v5. (Use jlab --trace-deprecation ... to show where the warning was created) [2022-09-05 20:20:02.636] [info] feedURL https://update.electronjs.org/jupyterlab/jupyterlab-desktop/darwin-x64/3.4.5-1 [2022-09-05 20:20:02.638] [info] requestHeaders { 'User-Agent': 'update-electron-app/2.0.1 (darwin: x64)' }

renderer.log
➜  jupyterlab-desktop cat renderer.log
[2022-09-05 20:18:21.611] [debug] Starting application in workspace: "default"
I am sure developing a lot of errors and issues... Screen Shot 2022-09-05 at 8 00 08 PM Screen Shot 2022-09-05 at 7 59 39 PM

Oh. Wrong build environment. Not a Mac M1.

mmangione avatar Sep 06 '22 03:09 mmangione

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

welcome[bot] avatar Sep 06 '22 03:09 welcome[bot]

One of my students seems to have a similar issue. He installed JupyterLab Desktop (3.5.0-1) on his Mac M1 and cannot use his miniconda environment. He has also installed jupyterlab into the same miniconda environment but still no luck. He sent me the following screenshots:

image

image

While this student has an M1, it seems that none of my students with Mac computers are able to specify a custom miniconda environment regardless of whether they are on an M1 or not.

I am wondering if there is anything that I am doing wrong when I instruct them on how to setup the custom environment on a Mac? Sadly, I cannot work through it myself because I do not have the Apple hardware required.

Thanks for any insight the Jupyterlab Desktop team can give on this issue. I love using Jupyterlab Desktop myself and I am using it for all of my students. I think they rather like it too!

connorferster avatar Nov 20 '22 23:11 connorferster

@mmangione @connorferster I just tested v3.5.0-1 on Mac M1 computer but could not reproduce the issues with custom environments. I used the instructions here to create the environments (without specifying jupyterlab version).

@connorferster in the screenshot you shared, the base conda environment is selected by the user. is that intentional? is there jupyterlab python package (>=3.4.5) installed in that environment?

mbektas avatar Nov 28 '22 05:11 mbektas

Thanks @mbektas for the follow-up and trying to reproduce the issue. Thank you also for providing the link to the instructions.

The student told me that jupyterlab was installed in their conda base environment (yes, that was intentional) but I should have asked for the output of pip list to be sure. So, as long as they are pointing to the python executable in the appropriate /bin directory and that environment has jupyterlab >= 3.4.5 installed, there should be no problems, correct?

connorferster avatar Nov 28 '22 08:11 connorferster

@connorferster yes, correct., if the conda base environment has proper jupyterlab version installed, it should work.

mbektas avatar Nov 28 '22 16:11 mbektas

closing as no update from the original poster.

mbektas avatar Jun 07 '23 05:06 mbektas