getpelican / pelican

Static site generator that supports Markdown and reST syntax. Powered by Python.
https://getpelican.com
GNU Affero General Public License v3.0
12.61k stars 1.81k forks source link

Installation error related to Pip and Rust/Cargo #3411

Closed lordfeck closed 1 month ago

lordfeck commented 1 month ago

Hi, when installing Pelican pip will exit with the following error:

  Using cached Unidecode-1.3.8-py3-none-any.whl.metadata (13 kB)
Collecting watchfiles>=0.21.0 (from pelican)
  Using cached watchfiles-0.24.0.tar.gz (37 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]

      Cargo, the Rust package manager, is not installed or is not on PATH.
      This package requires Rust and Cargo to compile extensions. Install it through
      the system's package manager or via https://rustup.rs/

      Checking for Rust toolchain....
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Is this being serious? Do I really now need rust installed before I can install Pelican?

Fwiw, my workarround is to run pip3 install --force-reinstall -v "pelican==4.8.0" and install an older release, which did not prompt me with the above error.

justinmayer commented 1 month ago

I cannot reproduce this problem with the latest Pelican release, and I am not aware of any Pelican dependencies that require Cargo to build Rust extensions. With such limited information provided in this issue, it is nigh on impossible to provide troubleshooting suggestions. What is the operating system and version, what is the exact original Pip invocation that failed, etc. Perhaps with more detailed information regarding your environment, we could collaboratively track down the source of the problem.

Seemingly related topics:

lordfeck commented 1 month ago

Thanks for your response @justinmayer . Certainly I can provide more details:

My OS is MacOS Sonoma 14.5. I am using the latest Python 3.13.0 and it was installed from asdf. I am not using a venv (I don't use many python packages so it would be needless).

The exact command I used to install Pelican was:

pip3 install pelican

If you need any more details please let me know. I'm hoping to avoid installing Rust - nothing against it, just I'd prefer to keep my system lean, and I've no particular use for Rust.

justinmayer commented 1 month ago

My first suggestion is to retire pip3 invocations and always use python -m pip […] instead.

Moreover, despite your impression that virtual environments are unnecessary, I find they are indispensable when trying to isolate problems, so I always use them — especially when troubleshooting.

Given that, I still can't reproduce the problem you encountered. On macOS Sonoma 14.7 and asdf-installed Python 3.13.0:

➤ ~/.asdf/installs/python/3.13.0/bin/python -m venv pelican
➤ source pelican/bin/activate
➤ python -m pip install pelican
[…]
Successfully installed [all the dependencies, including Pelican]

It would seem the problem is at least somewhat specific to your environment, but the origin remains a mystery.

lordfeck commented 1 month ago

I've fixed the issue by going with an earlier release of Pelican which did not report the Rust dependency when installing - it's sufficient for my needs. I'll leave it to your discretion whether this ticket should be left open, should it crop up again for anyone else in the future.

justinmayer commented 1 month ago

Glad you found a solution that works for you. 😊