2

Alright I have a package Pythran which is a Python to C++ (PYD module) complier. The package itself on conda-forge says it requires clang and clangxx. BUT I have MS Build Tools clang-12 already installed, so these packages are not used at all.

Now every time I go to conda install [package_name] it tells me my environment is inconsistent, because I force removed the clang libraries I don't need (or want) via a:

conda remove clang clangxx clang-13 --force

So I looked around a bit at the installation of things. And I found that there is a \Anaconda3\conda-meta\pythran-0.11.0-py39h832f523_0.json (note the name after the version changes)...

So I opened that file up, scrolled down to:

 "depends": [
    "beniget 0.4.*",
    "decorator",
    "gast 0.5.*",
    "numpy >=1.19.5,<2.0a0",
    "ply >=3.4",
    "python >=3.9,<3.10.0a0",
    "python_abi 3.9.* *_cp39",
    "xsimd >=8.0.5,<8.1"
  ],

Which had these entries, which I manually removed:

"clang",
"clangxx",

So now when I go to run conda it doesn't say my environment is inconsistent anymore. However, when I try to add a package, it insists on installing clang, clang-13, clangxx.

Anyone have a way to completely remove these dependencies? I think maybe it's referring to files online rather than local, since I deleted those required libraries. I ran a command prompt: findstr /S /C:'clang' * which is like calling grep from Linux. It shows all the files that reference clang somewhere. It isn't referenced anywhere other than what I deleted already, hence my confusion.

Yes I understand these package managers like conda are supposed to ensure your environment works. But I can compile Python to C++ to PYD (modules) no problem at all with these clang libraries missing. Since I already have clang-12 in the path. This is more of an annoyance than anything else, as every package install / upgrade keeps wanting to install clang-13 libraries that aren't needed...

1 Answer 1

4

Dummy Packages

The cleaner solution is to create a dummy package that one can install as an indicator that the corresponding software is already available on the system. This is what Conda Forge provides for the mpich package. Specifically, they provide an external build (see recipe), that one installs with

conda install 'mpich=*=external_*'

Creating clang Dummy Packages

For custom configurations like what you want, create your own dummy version of the clang and clangxx packages that would satisfy the requirements and install them to the environment. Something like

meta.yaml

{% set version = "12.0.1" %}
{% set build = 0 %}

package:
  name: clang-dummies
  version: {{ version }}

build:
  number: {{ build }}

outputs:
  - name: clang
    string: external_{{ build }}
  - name: clangxx
    string: external_{{ build }}

about:
  license: GPL-3.0-only
  summary: Dummy package for external clang(xx) compiler.

After building this (conda build .), you can install these local versions with

conda install --use-local 'clang=12=external*' 'clangxx=12=external*'

or upload them to a user Anaconda Cloud channel.

9
  • Very interesting suggestion. I tried (naively) to just take what you put above into a file and changed the clang to v13, it builds with the conda build . into the Anaconda3/conda-bld/ folder, but exits with an error: conda_build\utils.py", line 536, in _copy_with_shell_fallback ,raise OSError(f"Failed to copy {src} to {dst}. Error was: {e}") along with some other cryptic things relating to OSX and Py2.7, no idea why... Probably need to read up a bit more on this dummy package solution. I'm on Win10 so this is quite odd.
    – Matt
    Mar 1, 2022 at 5:07
  • @Matt you may need to put it in an isolated folder (e.g., recipe). Otherwise, please edit the question to show the full error output. If needs be, I can generate a build for you.
    – merv
    Mar 1, 2022 at 6:18
  • That was the issue - I placed into a new folder, then when installing I had to just list as you said: conda install --use-local clang=15.0=external* clangxx=15.0=external* built from the meta.yaml file. Great solution BTW now no more attempts by conda to install those packages! I made the revision # higher than anything out there so that should keep it working for a while (hence the 15.0 version, it's on v13 now)
    – Matt
    Mar 1, 2022 at 14:09
  • I don’t recommend making a fake version. It would make more sense to match the version to exactly the version on your system. If other packages have specific clang version requirements, you want Conda to accurately detect such dependency issues. You can use package pinning to prevent the package from being replaced.
    – merv
    Mar 1, 2022 at 14:29
  • 1
    @mateuszb sorry, I just noticed I didn’t indicate that the specifications need to be escaped (put in quotes), otherwise the shell might try to interpret the *. That could potentially have caused an issue. Using a tarball directly has the downside that it won’t resolve any dependencies, but that might be a moot point for such dummy packages.
    – merv
    Dec 2, 2022 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.