markfinal / cruiz

Conan recipe user interface
https://cruiz.readthedocs.io/
Apache License 2.0
11 stars 1 forks source link

cruiz detects the wrong Conan version than the one installed to its environment if another one is available from PATH #146

Closed arvidfm closed 3 months ago

arvidfm commented 9 months ago
  1. Install Conan 1 and cruiz using pipx:
    $ pipx install conan==1.63.0
    $ pipx install git+https://github.com/markfinal/cruiz
  2. Ensure ~/.local/bin is on your PATH

This installs Conan and cruiz to two separate environments but makes the conan and cruiz available on the PATH. The conan command here is version 1.63.0, but cruiz will have pulled in Conan 2 into its own local environment (whose conan command is not made available on the PATH by pipx by default). This seems to cause cruiz to detect the wrong Conan version because it uses the executable from the PATH instead of the one from its local environment:

  File "[...]/.local/pipx/venvs/cruiz/lib/python3.11/site-packages/cruiz/workers/api/v1/monkeypatch.py", line 38, in _monkey_patch_logger
    conans.util.log.configure_logger = qt_configure_logger
    ^^^^^^^^^^^
AttributeError: module 'conans' has no attribute 'util'

Consider using importlib.metadata.version("conan") instead

markfinal commented 4 months ago

I could reproduce the issue with the commands above.

Interesting point to note is that I couldn't immediately test with a development install

pipx install -e .

on a local clone of cruiz.

This failed earlier than the reported error with

FileNotFoundError: [Errno 2] No such file or directory: 'pyside6-rcc'

which is installed to the pipx venv, but not exposed in ~/.local/bin.

The difference is that the development install waits until runtime to process the Qt resource files (since they may change), whereas the non-development install processes them at install time.

Hacking it by making some symbolic links to the pyside6 files allowed that workflow to progress.

markfinal commented 4 months ago

Hacking it by making some symbolic links to the pyside6 files allowed that workflow to progress.

That was down to my lack of experience with pipx, as I subsequently spotted I could use --include-deps:

pipx install -e . --python 3.11 --include-deps
⚠️  File exists at /home/parallels/.local/bin/conan and points to /home/parallels/.local/share/pipx/venvs/conan/bin/conan, not
    /home/parallels/.local/share/pipx/venvs/cruiz/bin/conan. Not modifying.
⚠️  Note: normalizer was already on your PATH at /usr/bin/normalizer
⚠️  Note: distro was already on your PATH at /usr/bin/distro
  installed package cruiz 1.4.0a4.dev26, installed using Python 3.11.9
  These apps are now globally available
    - cruiz
    - distro
    - normalizer
    - pyside6-android-deploy
    - pyside6-assistant
    - pyside6-deploy
    - pyside6-designer
    - pyside6-genpyi
    - pyside6-linguist
    - pyside6-lrelease
    - pyside6-lupdate
    - pyside6-metaobjectdump
    - pyside6-project
    - pyside6-qml
    - pyside6-qmlcachegen
    - pyside6-qmlformat
    - pyside6-qmlimportscanner
    - pyside6-qmllint
    - pyside6-qmlls
    - pyside6-qmltyperegistrar
    - pyside6-qtpy2cpp
    - pyside6-rcc
    - pyside6-uic
    - qtpy
    - conan (symlink missing or pointing to unexpected location)
done! ✨ 🌟 ✨

although there are warnings, but good warnings, as it's honouring a prior Conan installation.