Closed andrii-i closed 1 year ago
Did you run try running jlpm
from the root of the repository to refresh node modules? Sometimes errors like this show up when you pull the latest code but do not refresh the node packages. You can also try jlpm clean
and then jlpm
What is your node version?
Thank you for looking into this. Yes, I tried running jlpm
in the root, also just tried running jlpm clean
and then jlpm
and in both cases error persists. My node version is v19.4.0.
Did you try running a stable Node version like 18.x?
Switched to node 18.14.0 LTS, did a clean install and error still remains.
canvas
being a binary package is bringing lots of troubles. From the error message, it seems the binary is looking for some system libraries (aka pixman
) but does not find them. Did you try installing the package for your OS?
The best to get an answer / fix is certainly to take part into that issue: https://github.com/Automattic/node-canvas/issues/2193
This also occurs for me, on a MacBook Pro with an M1 Pro (Apple Silicon) chip
@andrii-i Can you try this installation page, which has instructions to install these packages from source. https://github.com/Automattic/node-canvas/wiki/Installation%3A-Mac-OS-X
Haters gonna hate, but ol' conda-forge has your back on all of those. A maximally-reproducible environment.yml
can solve for all of the below:
conda-lock --file=environment.yml --platform=osx-arm64 --platform=linux-64 --platform=win-64 --platform=osx-64 --kind=explicit
name: jupyterla-dev
channels:
- conda-forge
- nodefaults
dependencies:
# binder
- jupyterlab-link-share=0.2
- jupyter_server_fileid
- jupyter-server-proxy
- matplotlib-base
- nodejs=18
- numpy
- pip
- python=3.10
- vega_datasets
- xeus-python
# docs
- sphinx >=1.8
- sphinx-copybutton
- pydata-sphinx-theme
- pytest
- pytest-tornasync
- pytest-check-links
- jsx-lexer
- myst-parser
# screenshots
- altair
- ipython
- ipywidgets
- jupyterlab-geojson
- matplotlib-base
- nbconvert
- pandas
- scipy
- vega_datasets
# canvas cruft
- pkgconfig
- cairo
- pango
- libpng
- libjpeg-turbo
- giflib
- librsvg
- pixman
# test
- coverage
- pytest >=7.0
- pytest-check-links >=0.7
- pytest-console-scripts
- pytest-cov
- pytest-jupyter >=0.5.3
- pytest-timeout
- pytest-tornasync
- requests
- requests_cache
- virtualenv
# dev
- build
- pre-commit
- pytest-cov
- coverage
- hatch
- bump2version
- ruff # ==0.0.242",
- black-jupyter ==23.1.0
At least, it solves: good luck doing that with pip/brew/choco!
@andrii-i Can you try this installation page, which has instructions to install these packages from source. https://github.com/Automattic/node-canvas/wiki/Installation%3A-Mac-OS-X
Tried installing through homebrew and from source as suggested, error still remains
Haters gonna hate, but ol' conda-forge has your back on all of those. A maximally-reproducible
environment.yml
can solve for all of the below:
@bollwyvl Thank you for suggesting a solution, I would be happy with any way to run tests locally.
I have created a conda-lock
file based on suggested environment.yml
, created new environment from it and installed jupyterlab in this new environment. Tests don't go through but I get a different error now, it has to do with missing cairo
library now (even though cairo is already present in the environment.yml
file). Do you know how to fix this?
@andrii-i Installing these packages using homebrew worked for me on an M1 Mac. I still have some tests failing, but they are not because of the package binaries anymore. Here are my installation steps.
# Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install cairo and dependencies
brew install pkg-config cairo pango libpng jpeg giflib librsvg
I also got rid of my jupyterlab
local package and re-cloned it locally. Opened a new terminal (so homebrew paths are activated) and then went through the jupyterlab install/build steps.
pip install -e ".[dev,test]"
jlpm install
jlpm run build
jlpm test
@bollwyvl I tried the conda-lock route as well, but ran into errors during the jlab installation step. Here are the steps I followed.
pip install conda-lock
conda-lock --file=environment.yml --platform=osx-arm64 --kind=explicit
conda create -n jlab-py-3.10 --file conda-osx-arm64.lock
conda activate jlab-py-3.10
pip install -e ".[dev,test]"
conda-lock
My bad: conda-lock
was just there to demonstrate that it can solve it, as i don't have all those machines lying around.
Though, of course, checking in "known-good" conda-lock
s is pretty damned nice for reproducibility.
/usr/local/lib/libcairo.2.dylib
Sure, that's likely to happen for pre-compiled binaries. But usually that crap can be massaged with LD_LIBRARY_PATH
.
So maybe something like:
yarn
to that environment.yml
# i like project-local envs, so i can find stuff
mamba env update --prefix=./.venv --file=environment.yml
source activate ./.venv
# prefer binaries you just installed
export LD_LIBRARY_PATH=${CONDA_PREFIX}/lib:$LD_LIBRARY_PATH
# get this out of the way up-front, instead of deep inside `hatch`-land
yarn
# no need to use [extras], you already have them at known versions
python -m pip install -vv -e . --no-deps --ignore-installed
jlpm build
jlpm test
Since I keep my m1 macos global environment clean, I regularly have to follow the bullet point in https://jupyterlab.readthedocs.io/en/stable/developer/contributing.html#installing-jupyterlab where it talks about a pixman error, and do:
mamba install -c conda-forge pkg-config glib pango pixman
When I install those packages with conda/mamba, then I can do a dev install and test JupyterLab.
@jasongrout this fixed it 🎉, thank you very much!
@jasongrout @fcollonval
Given the missing piece here was the pixman
library, should we add this explicitly to the first set of instructions in the docs?
conda install -c conda-forge pkg-config pango libpng cairo jpeg giflib librsvg glib **pixman**
It is natural that users might not reach the notes section that comes later, but the initial instructions are not easily missed.
I was actually working on editing the docs in #13956 although without adding the command explicitly to the first set of instructions as @3coins mentions (it still would have more visibility in Notes section as currently command is formatted as italics text, not as code that is more visible).
Given the missing piece here was the
pixman
library, should we add this explicitly to the first set of instructions in the docs?
Often these libraries are already installed at the system level, and presumably users will want to use those system libraries if they are installed? I mean, we don't ask them to install git and nodejs using conda, but we could?
I was thinking that making the bullet point more explicit about the possible errors and make it jump out a bit more by making the install instruction a block instead of just inline text would be enough?
Agree that formatting the notes better will help.
@3coins @jasongrout updated #13956 to display paragraoph about pixman error and command to fix it as a note element in "Installing JupyterLab" section. Also now string with longer set of conda packages that @3coins suggested is used:
conda install -c conda-forge pkg-config pango libpng cairo jpeg giflib librsvg glib pixman
I'm running into this issue on my Mac M1
@jupyterlab/coreutils: FAIL test/url.spec.ts
@jupyterlab/coreutils: ● Test suite failed to run
@jupyterlab/coreutils: dlopen(/Users/donjayamanne/Desktop/development/vsc/jupyterlab/node_modules/canvas/build/Release/canvas.node, 0x0001): Library not loaded: @rpath/libpixman-1.0.dylib
@jupyterlab/coreutils: Referenced from: <E241D0E7-A034-3C64-AF79-E45D7487118C> /Users/donjayamanne/Desktop/development/vsc/jupyterlab/node_modules/canvas/build/Release/canvas.node
@jupyterlab/coreutils: Reason: no LC_RPATH's found
@jupyterlab/coreutils: at Object.<anonymous> (../../node_modules/canvas/lib/bindings.js:3:18)
I have managed to install using conda and brew without any issues I.e. I tried both of the following
conda install -c conda-forge pkg-config pango libpng cairo jpeg giflib librsvg glib pixman
export PKG_CONFIG_PATH=$CONDA_PREFIX/lib/pkgconfig
brew install pkg-config cairo pango libpng jpeg giflib librsvg
Still no joy.
I'm facing the same issue again on MacOS (M2).
Description
Jupyterlab test runs fail locally with "Library not loaded: '@rpath/libpixman-1.0.dylib'" error.
Error:
``` > @jupyterlab/coreutils:test $ jest @jupyterlab/coreutils: FAIL test/pageconfig.spec.ts @jupyterlab/coreutils: ● Test suite failed to run @jupyterlab/coreutils: dlopen(/Users/aieroshe/Documents/jupyterlab/node_modules/canvas/build/Release/canvas.node, 0x0001): Library not loaded: '@rpath/libpixman-1.0.dylib' @jupyterlab/coreutils: Referenced from: '/Users/aieroshe/Documents/jupyterlab/node_modules/canvas/build/Release/canvas.node' @jupyterlab/coreutils: Reason: tried: '/usr/local/lib/libpixman-1.0.dylib' (no such file), '/usr/lib/libpixman-1.0.dylib' (no such file) @jupyterlab/coreutils: at Object.Reproduce
Expected behavior
Test runs go through or fail for valid reason
Context
Operating System and version: MacOS 12.6.3 Monterey, Apple M1 Pro chip Browser and version: Chrome version 109.0.5414.87 (Official Build) (arm64) JupyterLab version: 3.6.x, head-of-master (WIP 4.0.0)