n-riesco / ijavascript

IJavascript is a javascript kernel for the Jupyter notebook
Other
2.18k stars 187 forks source link

Instructions to install in macOS will fail when installing Python dependecies as described in the README #295

Open caraya opened 2 weeks ago

caraya commented 2 weeks ago

Homebrew and PIP no longer work to install IJavascript Python dependencies.

If you try to install packages with PIP, the installation will fail. When I run pip3 install zeromq I get the following error:

 pip3 install pyzmq
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
    xyz, where xyz is the package you are trying to
    install.

    If you wish to install a Python library that isn't in Homebrew,
    use a virtual environment:

    python3 -m venv path/to/venv
    source path/to/venv/bin/activate
    python3 -m pip install xyz

    If you wish to install a Python application that isn't in Homebrew,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. You can install pipx with

    brew install pipx

    You may restore the old behavior of pip by passing
    the '--break-system-packages' flag to pip, or by adding
    'break-system-packages = true' to your pip.conf file. The latter
    will permanently disable this error.

    If you disable this error, we STRONGLY recommend that you additionally
    pass the '--user' flag to pip, or set 'user = true' in your pip.conf
    file. Failure to do this can result in a broken Homebrew installation.

    Read more about this behavior here: <https://peps.python.org/pep-0668/>

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

This may also be the case for people running Linux Distributions.

Just throwing this out here in case anyone has the same problem

n-riesco commented 2 weeks ago

I don't recognise the commands you've run to install on macOS.

The instructions to install on macOS can be found here. It's likely they're obsolete, as I can't test them.

Please, could you follow them and post the error message you get? I'll try to help.

caraya commented 2 weeks ago

It was not a report. It was a heads up in case other users encounter the same issue. The error I showed in the original report is what I got when installing pyzqm with pip. It did not work.

As I researched the issue I found out that Homebrew no longer lets you install packages to their python instllations using pip. You're now required to install to a virtual environment using pipx.

See Externally Managed Environments

The steps I took to get IJavascript working are:

brew install pkg-config zeromq pipx pipx install --include-deps jupyter pipx inject --include-apps --include-deps jupyter pyzmq npm install -g ijavascript ijsinstall

I already manage Node with NVM so I don't need to install it with Homebrew.

Since Jupyter is running on a virtual environment, there's no need to install Jupyter with Homebrew either

Youjin1985 commented 3 days ago

I can't build with error

npm error /Users/username/Library/Caches/node-gyp/22.8.0/include/node/v8-local-handle.h:269:5: error: static assertion failed due to requirement 'std::is_base_of<v8::Value, v8::Data>::value': type check

caraya commented 3 days ago

@Youjin1985

Can you open a separate issue with your report? This will make your problem visible to developers. I don't think that the error you're experiencing is related to the documentation issue described here.